Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions crates/component-macro/tests/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,17 @@ mod trappable_errors {
#[allow(dead_code)]
type MyX = u32;
}

mod interface_name_with_rust_keyword {
wasmtime::component::bindgen!({
inline: "
package foo:foo;

interface crate { }

world foo {
export crate;
}
"
});
}
4 changes: 2 additions & 2 deletions crates/wit-bindgen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl Wasmtime {
let pkgname = &resolve.packages[iface.package.unwrap()].name;
path.push(pkgname.namespace.to_snake_case());
path.push(self.name_package_module(resolve, iface.package.unwrap()));
path.push(iface.name.as_ref().unwrap().to_snake_case());
path.push(to_rust_ident(iface.name.as_ref().unwrap()));
}
}
let entry = if let Some(remapped_path) = self.lookup_replacement(resolve, name, None) {
Expand Down Expand Up @@ -440,7 +440,7 @@ impl Wasmtime {
}

let module = &gen.src[..];
let snake = iface_name.to_snake_case();
let snake = to_rust_ident(iface_name);

let module = format!(
"
Expand Down