File tree Expand file tree Collapse file tree 6 files changed +38
-4
lines changed Expand file tree Collapse file tree 6 files changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -744,7 +744,7 @@ macro_rules! __export_{world_name}_impl {{
744
744
fn emit_custom_section (
745
745
& mut self ,
746
746
resolve : & Resolve ,
747
- world : WorldId ,
747
+ world_id : WorldId ,
748
748
section_suffix : & str ,
749
749
func_name : Option < & str > ,
750
750
) {
@@ -755,11 +755,13 @@ macro_rules! __export_{world_name}_impl {{
755
755
// concatenated to other custom sections by LLD by accident since LLD will
756
756
// concatenate custom sections of the same name.
757
757
let opts_suffix = self . opts . type_section_suffix . as_deref ( ) . unwrap_or ( "" ) ;
758
- let world_name = & resolve. worlds [ world] . name ;
758
+ let world = & resolve. worlds [ world_id] ;
759
+ let world_name = & world. name ;
760
+ let pkg = & resolve. packages [ world. package . unwrap ( ) ] . name ;
759
761
let version = env ! ( "CARGO_PKG_VERSION" ) ;
760
762
self . src . push_str ( & format ! (
761
763
"#[link_section = \" component-type:wit-bindgen:{version}:\
762
- {world_name}:{section_suffix}{opts_suffix}\" ]\n "
764
+ {pkg}:{ world_name}:{section_suffix}{opts_suffix}\" ]\n "
763
765
) ) ;
764
766
765
767
let mut producers = wasm_metadata:: Producers :: empty ( ) ;
@@ -771,7 +773,7 @@ macro_rules! __export_{world_name}_impl {{
771
773
772
774
let component_type = wit_component:: metadata:: encode (
773
775
resolve,
774
- world ,
776
+ world_id ,
775
777
wit_component:: StringEncoding :: UTF8 ,
776
778
Some ( & producers) ,
777
779
)
Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ use self::test::suffix::imports::Host;
7
7
#[ derive( Default ) ]
8
8
pub struct MyFoo ;
9
9
10
+ impl RequiredExportsImports for MyFoo {
11
+ fn foo ( & mut self ) { }
12
+ fn bar ( & mut self ) { }
13
+ }
14
+
10
15
impl Host for MyFoo {
11
16
fn foo ( & mut self ) { }
12
17
}
Original file line number Diff line number Diff line change
1
+ package test : a ;
2
+
3
+ world imports {
4
+ import foo : func ();
5
+ }
Original file line number Diff line number Diff line change
1
+ package test : b ;
2
+
3
+ world imports {
4
+ import bar : func ();
5
+ }
Original file line number Diff line number Diff line change @@ -22,11 +22,26 @@ mod b {
22
22
} ) ;
23
23
}
24
24
25
+ mod c {
26
+ wit_bindgen:: generate!( {
27
+ world: "test:a/imports" ,
28
+ path: "../../tests/runtime/type_section_suffix" ,
29
+ } ) ;
30
+ }
31
+ mod d {
32
+ wit_bindgen:: generate!( {
33
+ world: "test:b/imports" ,
34
+ path: "../../tests/runtime/type_section_suffix" ,
35
+ } ) ;
36
+ }
37
+
25
38
struct Exports ;
26
39
27
40
impl Guest for Exports {
28
41
fn run ( ) {
29
42
a:: test:: suffix:: imports:: foo ( ) ;
30
43
b:: test:: suffix:: imports:: foo ( ) ;
44
+ c:: foo ( ) ;
45
+ d:: bar ( ) ;
31
46
}
32
47
}
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ interface imports {
6
6
7
7
world available-imports {
8
8
import imports ;
9
+ include test :a /imports ;
10
+ include test :b /imports ;
9
11
}
10
12
11
13
world required-exports {
You can’t perform that action at this time.
0 commit comments