Skip to content

Commit 453ae5d

Browse files
authored
Update to the latest wit-bindgen (#113)
* Update to the latest `wit-bindgen` * Minor preparations for hopeful inclusion into libstd * Reexport the new `bitflags` feature * Update `link_section` outputs in generated code Closes #112 * Update to crates.io-based versions * Regenerate files with 0.45.0
1 parent d720c28 commit 453ae5d

File tree

6 files changed

+2207
-1117
lines changed

6 files changed

+2207
-1117
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ jobs:
7272
run: |
7373
./ci/vendor-wit.sh
7474
git diff --exit-code
75-
- run: cargo install wit-bindgen-cli@0.39.0 --locked
75+
- run: cargo install wit-bindgen-cli@0.45.0 --locked
7676
- run: ./ci/regenerate.sh
7777
- run: git diff --exit-code

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,18 @@ wasi = { version = "0.14", path = ".", default-features = false }
2424
members = ["./crates/*"]
2525

2626
[dependencies]
27-
wit-bindgen-rt = { version = "0.39.0", features = ["bitflags"] }
27+
wit-bindgen = { version = "0.45.0", default-features = false }
2828

2929
# When built as part of libstd
3030
core = { version = "1.0", optional = true, package = "rustc-std-workspace-core" }
31-
rustc-std-workspace-alloc = { version = "1.0", optional = true }
31+
alloc = { version = "1.0", optional = true, package = "rustc-std-workspace-alloc" }
3232

3333
[features]
34-
default = ["std"]
34+
default = ["std", "bitflags"]
3535
std = []
36+
bitflags = ["wit-bindgen/bitflags"]
3637
# Unstable feature to support being a libstd dependency
37-
rustc-dep-of-std = ["core", "rustc-std-workspace-alloc"]
38+
rustc-dep-of-std = ["core", "alloc", "wit-bindgen/rustc-dep-of-std"]
3839

3940
[[example]]
4041
name = "cli-command-no_std"

ci/regenerate.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ set -ex
55
generate() {
66
file="$1"
77
shift
8-
wit-bindgen rust wit --async none --out-dir src --std-feature "$@" --format \
9-
--runtime-path wit_bindgen_rt
8+
wit-bindgen rust wit --out-dir src --std-feature "$@" --format
9+
10+
sed -z -i 's/#\[unsafe(\n link_section = "\(.*\)"\n)\]/\
11+
#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "\1-in-libstd"))]\
12+
#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "\1"))]\
13+
/' $file
1014
}
1115

1216
# Generate the main body of the bindings which includes all imports from the two

0 commit comments

Comments
 (0)