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
4 changes: 3 additions & 1 deletion crates/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ impl InterfaceGenerator<'_> {
uwrite!(
macro_src,
"
const _: () = {{
#[doc(hidden)]
#[export_name = \"{export_name}\"]
#[allow(non_snake_case)]
Expand Down Expand Up @@ -647,7 +648,8 @@ impl InterfaceGenerator<'_> {
for param in params.iter() {
uwrite!(macro_src, "{param},");
}
uwriteln!(macro_src, ")\n}}");
uwriteln!(macro_src, ")\n}}"); // close function call and function
uwriteln!(macro_src, "\n}};"); // close `const _: () = { ...`

let mut f = FunctionBindgen::new(self, params);
f.gen.resolve.call(
Expand Down
33 changes: 33 additions & 0 deletions crates/rust/tests/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,36 @@ mod skip {

export_baz!(Component);
}

mod symbol_does_not_conflict {
wit_bindgen::generate!({
inline: "
package my:inline

interface foo1 {
foo: func()
}

interface foo2 {
foo: func()
}

world foo {
export foo1
export foo2
}
",
});

struct Component;

impl exports::my::inline::foo1::Foo1 for Component {
fn foo() {}
}

impl exports::my::inline::foo2::Foo2 for Component {
fn foo() {}
}

export_foo!(Component);
}