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 @@ -687,6 +687,7 @@ impl InterfaceGenerator<'_> {
uwrite!(
macro_src,
"
const _: () = {{
#[doc(hidden)]
#[export_name = \"cabi_post_{export_name}\"]
#[allow(non_snake_case)]
Expand All @@ -708,7 +709,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.post_return(func, &mut f);
Expand Down
23 changes: 23 additions & 0 deletions crates/rust/tests/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,20 @@ mod symbol_does_not_conflict {
foo: func()
}

interface bar1 {
bar: func() -> string
}

interface bar2 {
bar: func() -> string
}


world foo {
export foo1
export foo2
export bar1
export bar2
}
",
});
Expand All @@ -201,5 +212,17 @@ mod symbol_does_not_conflict {
fn foo() {}
}

impl exports::my::inline::bar1::Bar1 for Component {
fn bar() -> String {
String::new()
}
}

impl exports::my::inline::bar2::Bar2 for Component {
fn bar() -> String {
String::new()
}
}

export_foo!(Component);
}