Skip to content

Commit 6c847f5

Browse files
committed
put crate name and version into type section suffix
this prevents type sections from getting concatenated when two different versions of the crate are in a transitive dependency tree
1 parent 01af74f commit 6c847f5

File tree

7 files changed

+114
-46
lines changed

7 files changed

+114
-46
lines changed

ci/regenerate.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
set -ex
44

5+
suffix() {
6+
name="$1"
7+
extra="$2"
8+
cargo metadata | jq -r \
9+
".packages.[] | select(.name==\"${name}\") | (\"rust-\" + .name + \"-\" + .version + \"-from-crates-io${extra}\")"
10+
}
11+
512
generate() {
613
file="$1"
714
shift
@@ -25,7 +32,7 @@ generate_p2() {
2532
# Generate the main body of the bindings which includes all imports from the two
2633
# worlds below.
2734
generate_p2 crates/wasip2/src/imports.rs \
28-
--type-section-suffix rust-wasi-from-crates-io \
35+
--type-section-suffix $(suffix "wasip2") \
2936
--generate-all \
3037
--world wasi:cli/imports
3138

@@ -63,7 +70,7 @@ with="$with,wasi:sockets/ip-name-lookup@0.2.4=crate::sockets::ip_name_lookup"
6370
generate_p2 crates/wasip2/src/command.rs \
6471
--world wasi:cli/command \
6572
--with "$with" \
66-
--type-section-suffix rust-wasi-from-crates-io-command-world \
73+
--type-section-suffix $(suffix "wasip2" "-command-world") \
6774
--default-bindings-module '$crate' \
6875
--pub-export-macro \
6976
--export-macro-name _export_command
@@ -81,7 +88,7 @@ with="$with,wasi:random/random@0.2.4=crate::random::random"
8188
generate_p2 crates/wasip2/src/proxy.rs \
8289
--world wasi:http/proxy \
8390
--with "$with" \
84-
--type-section-suffix rust-wasi-from-crates-io-proxy-world \
91+
--type-section-suffix $(suffix "wasip2" "-proxy-world") \
8592
--default-bindings-module '$crate' \
8693
--pub-export-macro \
8794
--export-macro-name _export_proxy
@@ -94,7 +101,7 @@ generate_p3() {
94101
}
95102

96103
generate_p3 crates/wasip3/src/imports.rs \
97-
--type-section-suffix rust-wasi-from-crates-io \
104+
--type-section-suffix $(suffix "wasip3") \
98105
--generate-all \
99106
--world wasi:cli/imports
100107

@@ -120,7 +127,7 @@ with="$with,wasi:sockets/ip-name-lookup@0.3.0-rc-2025-08-15=crate::sockets::ip_n
120127
generate_p3 crates/wasip3/src/command.rs \
121128
--world wasi:cli/command \
122129
--with "$with" \
123-
--type-section-suffix rust-wasi-from-crates-io-command-world \
130+
--type-section-suffix $(suffix "wasip3" "-command-world") \
124131
--default-bindings-module '$crate' \
125132
--pub-export-macro \
126133
--async 'wasi:cli/run@0.3.0-rc-2025-08-15#run' \
@@ -135,7 +142,7 @@ with="$with,wasi:random/random@0.3.0-rc-2025-08-15=crate::random::random"
135142
generate_p3 crates/wasip3/src/proxy.rs \
136143
--world wasi:http/proxy \
137144
--with "$with" \
138-
--type-section-suffix rust-wasi-from-crates-io-proxy-world \
145+
--type-section-suffix $(suffix "wasip3" "-proxy-world") \
139146
--default-bindings-module '$crate' \
140147
--pub-export-macro \
141148
--export-macro-name _export_proxy

crates/wasip2/src/command.rs

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Generated by `wit-bindgen` 0.45.0. DO NOT EDIT!
1+
// Generated by `wit-bindgen` 0.45.1. DO NOT EDIT!
22
// Options used:
33
// * std_feature
44
// * with "wasi:cli/environment@0.2.4" = "crate::cli::environment"
@@ -28,36 +28,63 @@
2828
// * with "wasi:sockets/udp@0.2.4" = "crate::sockets::udp"
2929
// * with "wasi:sockets/udp-create-socket@0.2.4" = "crate::sockets::udp_create_socket"
3030
// * with "wasi:sockets/ip-name-lookup@0.2.4" = "crate::sockets::ip_name_lookup"
31-
// * type_section_suffix: "rust-wasi-from-crates-io-command-world"
31+
// * type_section_suffix: "rust-wasip2-1.0.0+wasi-0.2.4-from-crates-io-command-world"
3232
// * default-bindings-module: "$crate"
3333
// * export-macro-name: _export_command
3434
// * pub-export-macro
35+
#[allow(unfulfilled_lint_expectations, unused_imports)]
3536
use crate::cli::environment as __with_name0;
37+
#[allow(unfulfilled_lint_expectations, unused_imports)]
3638
use crate::cli::exit as __with_name1;
39+
#[allow(unfulfilled_lint_expectations, unused_imports)]
3740
use crate::io::error as __with_name2;
41+
#[allow(unfulfilled_lint_expectations, unused_imports)]
3842
use crate::io::poll as __with_name3;
43+
#[allow(unfulfilled_lint_expectations, unused_imports)]
3944
use crate::io::streams as __with_name4;
45+
#[allow(unfulfilled_lint_expectations, unused_imports)]
4046
use crate::cli::stdin as __with_name5;
47+
#[allow(unfulfilled_lint_expectations, unused_imports)]
4148
use crate::cli::stdout as __with_name6;
49+
#[allow(unfulfilled_lint_expectations, unused_imports)]
4250
use crate::cli::stderr as __with_name7;
51+
#[allow(unfulfilled_lint_expectations, unused_imports)]
4352
use crate::cli::terminal_input as __with_name8;
53+
#[allow(unfulfilled_lint_expectations, unused_imports)]
4454
use crate::cli::terminal_output as __with_name9;
55+
#[allow(unfulfilled_lint_expectations, unused_imports)]
4556
use crate::cli::terminal_stdin as __with_name10;
57+
#[allow(unfulfilled_lint_expectations, unused_imports)]
4658
use crate::cli::terminal_stdout as __with_name11;
59+
#[allow(unfulfilled_lint_expectations, unused_imports)]
4760
use crate::cli::terminal_stderr as __with_name12;
61+
#[allow(unfulfilled_lint_expectations, unused_imports)]
4862
use crate::clocks::monotonic_clock as __with_name13;
63+
#[allow(unfulfilled_lint_expectations, unused_imports)]
4964
use crate::clocks::wall_clock as __with_name14;
65+
#[allow(unfulfilled_lint_expectations, unused_imports)]
5066
use crate::filesystem::types as __with_name15;
67+
#[allow(unfulfilled_lint_expectations, unused_imports)]
5168
use crate::filesystem::preopens as __with_name16;
69+
#[allow(unfulfilled_lint_expectations, unused_imports)]
5270
use crate::sockets::network as __with_name17;
71+
#[allow(unfulfilled_lint_expectations, unused_imports)]
5372
use crate::sockets::instance_network as __with_name18;
73+
#[allow(unfulfilled_lint_expectations, unused_imports)]
5474
use crate::sockets::udp as __with_name19;
75+
#[allow(unfulfilled_lint_expectations, unused_imports)]
5576
use crate::sockets::udp_create_socket as __with_name20;
77+
#[allow(unfulfilled_lint_expectations, unused_imports)]
5678
use crate::sockets::tcp as __with_name21;
79+
#[allow(unfulfilled_lint_expectations, unused_imports)]
5780
use crate::sockets::tcp_create_socket as __with_name22;
81+
#[allow(unfulfilled_lint_expectations, unused_imports)]
5882
use crate::sockets::ip_name_lookup as __with_name23;
83+
#[allow(unfulfilled_lint_expectations, unused_imports)]
5984
use crate::random::random as __with_name24;
85+
#[allow(unfulfilled_lint_expectations, unused_imports)]
6086
use crate::random::insecure as __with_name25;
87+
#[allow(unfulfilled_lint_expectations, unused_imports)]
6188
use crate::random::insecure_seed as __with_name26;
6289
#[rustfmt::skip]
6390
#[allow(dead_code, clippy::all)]
@@ -140,7 +167,7 @@ macro_rules! __export_command_impl {
140167
exports::wasi::cli::run::__export_wasi_cli_run_0_2_4_cabi!($ty with_types_in
141168
$($path_to_types_root)*:: exports::wasi::cli::run); const _ : () = {
142169
#[rustfmt::skip] #[cfg(target_arch = "wasm32")] #[unsafe (link_section =
143-
"component-type:wit-bindgen:0.45.0:wasi:cli@0.2.4:command:imports and exportsrust-wasi-from-crates-io-command-world")]
170+
"component-type:wit-bindgen:0.45.1:wasi:cli@0.2.4:command:imports and exportsrust-wasip2-1.0.0+wasi-0.2.4-from-crates-io-command-world")]
144171
#[doc(hidden)] #[allow(clippy::octal_escapes)] pub static
145172
__WIT_BINDGEN_COMPONENT_TYPE : [u8; 10773] = *
146173
b"\
@@ -360,8 +387,8 @@ nsecure-random-u64\x01\x02\x03\0\x1awasi:random/insecure@0.2.4\x05*\x01B\x03\x01
360387
o\x02ww\x01@\0\0\0\x04\0\x0dinsecure-seed\x01\x01\x03\0\x1fwasi:random/insecure-\
361388
seed@0.2.4\x05+\x01B\x03\x01j\0\0\x01@\0\0\0\x04\0\x03run\x01\x01\x04\0\x12wasi:\
362389
cli/run@0.2.4\x05,\x04\0\x16wasi:cli/command@0.2.4\x04\0\x0b\x0d\x01\0\x07comman\
363-
d\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.238.0\x10\
364-
wit-bindgen-rust\x060.45.0";
390+
d\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.238.1\x10\
391+
wit-bindgen-rust\x060.45.1";
365392
};
366393
};
367394
}
@@ -370,8 +397,8 @@ pub use __export_command_impl as _export_command;
370397
#[rustfmt::skip]
371398
#[cfg(target_arch = "wasm32")]
372399

373-
#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "component-type:wit-bindgen:0.45.0:wasi:cli@0.2.4:command-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-command-world-in-libstd"))]
374-
#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "component-type:wit-bindgen:0.45.0:wasi:cli@0.2.4:command-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-command-world"))]
400+
#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "component-type:wit-bindgen:0.45.1:wasi:cli@0.2.4:command-with-all-of-its-exports-removed:encoded worldrust-wasip2-1.0.0+wasi-0.2.4-from-crates-io-command-world-in-libstd"))]
401+
#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "component-type:wit-bindgen:0.45.1:wasi:cli@0.2.4:command-with-all-of-its-exports-removed:encoded worldrust-wasip2-1.0.0+wasi-0.2.4-from-crates-io-command-world"))]
375402

376403
#[doc(hidden)]
377404
#[allow(clippy::octal_escapes)]
@@ -592,7 +619,7 @@ nsecure-random-u64\x01\x02\x03\0\x1awasi:random/insecure@0.2.4\x05*\x01B\x03\x01
592619
o\x02ww\x01@\0\0\0\x04\0\x0dinsecure-seed\x01\x01\x03\0\x1fwasi:random/insecure-\
593620
seed@0.2.4\x05+\x04\06wasi:cli/command-with-all-of-its-exports-removed@0.2.4\x04\
594621
\0\x0b-\x01\0'command-with-all-of-its-exports-removed\x03\0\0\0G\x09producers\x01\
595-
\x0cprocessed-by\x02\x0dwit-component\x070.238.0\x10wit-bindgen-rust\x060.45.0";
622+
\x0cprocessed-by\x02\x0dwit-component\x070.238.1\x10wit-bindgen-rust\x060.45.1";
596623
#[inline(never)]
597624
#[doc(hidden)]
598625
pub fn __link_custom_section_describing_imports() {

crates/wasip2/src/imports.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// Generated by `wit-bindgen` 0.45.0. DO NOT EDIT!
1+
// Generated by `wit-bindgen` 0.45.1. DO NOT EDIT!
22
// Options used:
33
// * std_feature
4-
// * type_section_suffix: "rust-wasi-from-crates-io"
4+
// * type_section_suffix: "rust-wasip2-1.0.0+wasi-0.2.4-from-crates-io"
55
#[rustfmt::skip]
66
#[allow(dead_code, clippy::all)]
77
pub mod wasi {
@@ -10008,8 +10008,8 @@ mod _rt {
1000810008
#[rustfmt::skip]
1000910009
#[cfg(target_arch = "wasm32")]
1001010010

10011-
#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "component-type:wit-bindgen:0.45.0:wasi:cli@0.2.4:imports:encoded worldrust-wasi-from-crates-io-in-libstd"))]
10012-
#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "component-type:wit-bindgen:0.45.0:wasi:cli@0.2.4:imports:encoded worldrust-wasi-from-crates-io"))]
10011+
#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "component-type:wit-bindgen:0.45.1:wasi:cli@0.2.4:imports:encoded worldrust-wasip2-1.0.0+wasi-0.2.4-from-crates-io-in-libstd"))]
10012+
#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "component-type:wit-bindgen:0.45.1:wasi:cli@0.2.4:imports:encoded worldrust-wasip2-1.0.0+wasi-0.2.4-from-crates-io"))]
1001310013

1001410014
#[doc(hidden)]
1001510015
#[allow(clippy::octal_escapes)]
@@ -10229,8 +10229,8 @@ p}\x01@\x01\x03lenw\0\0\x04\0\x10get-random-bytes\x01\x01\x01@\0\0w\x04\0\x0eget
1022910229
nsecure-random-u64\x01\x02\x03\0\x1awasi:random/insecure@0.2.4\x05*\x01B\x03\x01\
1023010230
o\x02ww\x01@\0\0\0\x04\0\x0dinsecure-seed\x01\x01\x03\0\x1fwasi:random/insecure-\
1023110231
seed@0.2.4\x05+\x04\0\x16wasi:cli/imports@0.2.4\x04\0\x0b\x0d\x01\0\x07imports\x03\
10232-
\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.238.0\x10wit-\
10233-
bindgen-rust\x060.45.0";
10232+
\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.238.1\x10wit-\
10233+
bindgen-rust\x060.45.1";
1023410234
#[inline(never)]
1023510235
#[doc(hidden)]
1023610236
pub fn __link_custom_section_describing_imports() {

crates/wasip2/src/proxy.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Generated by `wit-bindgen` 0.45.0. DO NOT EDIT!
1+
// Generated by `wit-bindgen` 0.45.1. DO NOT EDIT!
22
// Options used:
33
// * std_feature
44
// * with "wasi:cli/stdin@0.2.4" = "crate::cli::stdin"
@@ -10,18 +10,27 @@
1010
// * with "wasi:io/poll@0.2.4" = "crate::io::poll"
1111
// * with "wasi:io/streams@0.2.4" = "crate::io::streams"
1212
// * with "wasi:random/random@0.2.4" = "crate::random::random"
13-
// * type_section_suffix: "rust-wasi-from-crates-io-proxy-world"
13+
// * type_section_suffix: "rust-wasip2-1.0.0+wasi-0.2.4-from-crates-io-proxy-world"
1414
// * default-bindings-module: "$crate"
1515
// * export-macro-name: _export_proxy
1616
// * pub-export-macro
17+
#[allow(unfulfilled_lint_expectations, unused_imports)]
1718
use crate::io::poll as __with_name0;
19+
#[allow(unfulfilled_lint_expectations, unused_imports)]
1820
use crate::clocks::monotonic_clock as __with_name1;
21+
#[allow(unfulfilled_lint_expectations, unused_imports)]
1922
use crate::clocks::wall_clock as __with_name2;
23+
#[allow(unfulfilled_lint_expectations, unused_imports)]
2024
use crate::random::random as __with_name3;
25+
#[allow(unfulfilled_lint_expectations, unused_imports)]
2126
use crate::io::error as __with_name4;
27+
#[allow(unfulfilled_lint_expectations, unused_imports)]
2228
use crate::io::streams as __with_name5;
29+
#[allow(unfulfilled_lint_expectations, unused_imports)]
2330
use crate::cli::stdout as __with_name6;
31+
#[allow(unfulfilled_lint_expectations, unused_imports)]
2432
use crate::cli::stderr as __with_name7;
33+
#[allow(unfulfilled_lint_expectations, unused_imports)]
2534
use crate::cli::stdin as __with_name8;
2635
#[rustfmt::skip]
2736
#[allow(dead_code, clippy::all)]
@@ -7134,7 +7143,7 @@ macro_rules! __export_proxy_impl {
71347143
with_types_in $($path_to_types_root)*:: exports::wasi::http::incoming_handler);
71357144
const _ : () = { #[rustfmt::skip] #[cfg(target_arch = "wasm32")] #[unsafe
71367145
(link_section =
7137-
"component-type:wit-bindgen:0.45.0:wasi:http@0.2.4:proxy:imports and exportsrust-wasi-from-crates-io-proxy-world")]
7146+
"component-type:wit-bindgen:0.45.1:wasi:http@0.2.4:proxy:imports and exportsrust-wasip2-1.0.0+wasi-0.2.4-from-crates-io-proxy-world")]
71387147
#[doc(hidden)] #[allow(clippy::octal_escapes)] pub static
71397148
__WIT_BINDGEN_COMPONENT_TYPE : [u8; 7040] = *
71407149
b"\
@@ -7278,7 +7287,7 @@ incoming-request\x02\x03\0\x09\x11response-outparam\x01B\x08\x02\x03\x02\x01\x14
72787287
m\x03\0\x02\x01i\x01\x01i\x03\x01@\x02\x07request\x04\x0cresponse-out\x05\x01\0\x04\
72797288
\0\x06handle\x01\x06\x04\0\x20wasi:http/incoming-handler@0.2.4\x05\x16\x04\0\x15\
72807289
wasi:http/proxy@0.2.4\x04\0\x0b\x0b\x01\0\x05proxy\x03\0\0\0G\x09producers\x01\x0c\
7281-
processed-by\x02\x0dwit-component\x070.238.0\x10wit-bindgen-rust\x060.45.0";
7290+
processed-by\x02\x0dwit-component\x070.238.1\x10wit-bindgen-rust\x060.45.1";
72827291
};
72837292
};
72847293
}
@@ -7287,8 +7296,8 @@ pub use __export_proxy_impl as _export_proxy;
72877296
#[rustfmt::skip]
72887297
#[cfg(target_arch = "wasm32")]
72897298

7290-
#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "component-type:wit-bindgen:0.45.0:wasi:http@0.2.4:proxy-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-proxy-world-in-libstd"))]
7291-
#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "component-type:wit-bindgen:0.45.0:wasi:http@0.2.4:proxy-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-proxy-world"))]
7299+
#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "component-type:wit-bindgen:0.45.1:wasi:http@0.2.4:proxy-with-all-of-its-exports-removed:encoded worldrust-wasip2-1.0.0+wasi-0.2.4-from-crates-io-proxy-world-in-libstd"))]
7300+
#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "component-type:wit-bindgen:0.45.1:wasi:http@0.2.4:proxy-with-all-of-its-exports-removed:encoded worldrust-wasip2-1.0.0+wasi-0.2.4-from-crates-io-proxy-world"))]
72927301

72937302
#[doc(hidden)]
72947303
#[allow(clippy::octal_escapes)]
@@ -7430,7 +7439,7 @@ i\x05\x01j\x01\x0b\x01\x07\x01@\x02\x07request\x08\x07options\x0a\0\x0c\x04\0\x0
74307439
handle\x01\x0d\x03\0\x20wasi:http/outgoing-handler@0.2.4\x05\x13\x04\05wasi:http\
74317440
/proxy-with-all-of-its-exports-removed@0.2.4\x04\0\x0b+\x01\0%proxy-with-all-of-\
74327441
its-exports-removed\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-compo\
7433-
nent\x070.238.0\x10wit-bindgen-rust\x060.45.0";
7442+
nent\x070.238.1\x10wit-bindgen-rust\x060.45.1";
74347443
#[inline(never)]
74357444
#[doc(hidden)]
74367445
pub fn __link_custom_section_describing_imports() {

0 commit comments

Comments
 (0)