Skip to content

Commit 9b61ffe

Browse files
committed
Merge remote-tracking branch 'upstream/main' into feat/cfg_attr-structs-rel
2 parents b610c3f + 8fa299f commit 9b61ffe

File tree

129 files changed

+3295
-1418
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+3295
-1418
lines changed

.github/workflows/main.yml

+57-9
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- run: rustup update --no-self-update stable && rustup default stable
3030
- run: rustup component add rustfmt
3131
- run: cargo fmt --all -- --check
32-
32+
3333
# Check TOML style by using Taplo.
3434
taplo:
3535
name: Taplo
@@ -68,12 +68,12 @@ jobs:
6868
- run: cargo clippy --no-deps --all-features -p example-tests -- -D warnings
6969
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-externref-xform -- -D warnings
7070
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-futures -- -D warnings
71-
- run: cargo clippy --no-deps --features spans,strict-macro -p wasm-bindgen-macro -- -D warnings
72-
- run: cargo clippy --no-deps --features extra-traits,spans,strict-macro -p wasm-bindgen-macro-support -- -D warnings
71+
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro -- -D warnings
72+
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro-support -- -D warnings
7373
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-multi-value-xform -- -D warnings
7474
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-shared -- -D warnings
7575
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-test -- -D warnings
76-
- run: cargo clippy --no-deps -p wasm-bindgen-test-macro -- -D warnings
76+
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-test-macro -- -D warnings
7777
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-threads-xform -- -D warnings
7878
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p typescript-tests -- -D warnings
7979
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-wasm-conventions -- -D warnings
@@ -121,8 +121,8 @@ jobs:
121121
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen -Zbuild-std=core,alloc -- -D warnings
122122
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p js-sys -Zbuild-std=core,alloc -- -D warnings
123123
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p web-sys -Zbuild-std=core,alloc -- -D warnings
124-
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-futures --features once_cell/critical-section -Zbuild-std=core,alloc -- -D warnings
125-
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-test --features once_cell/critical-section -Zbuild-std=core,alloc -- -D warnings
124+
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-futures -Zbuild-std=core,alloc -- -D warnings
125+
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-test -Zbuild-std=core,alloc -- -D warnings
126126

127127
# Run `cargo clippy` over the project
128128
clippy_project:
@@ -206,15 +206,16 @@ jobs:
206206
test_threads:
207207
name: "Run wasm-bindgen crate tests with multithreading"
208208
runs-on: ubuntu-latest
209+
env:
210+
WASM_BINDGEN_SPLIT_LINKED_MODULES: 1
209211
steps:
210212
- uses: actions/checkout@v4
211213
- run: rustup default nightly-2024-07-06
212214
- run: rustup target add wasm32-unknown-unknown
213215
- run: rustup component add rust-src
214-
# Note: we only run the browser tests here, because wasm-bindgen doesn't support threading in Node yet.
215216
- run: |
216217
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \
217-
cargo test --target wasm32-unknown-unknown --test headless -Z build-std=std,panic_abort
218+
cargo test --target wasm32-unknown-unknown -Z build-std=std,panic_abort
218219
219220
# I don't know why this is failing so comment this out for now, but ideally
220221
# this would be figured out at some point and solved.
@@ -239,6 +240,22 @@ jobs:
239240
# WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE: 1
240241
# - run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features "Node Window Document"
241242

243+
# This checks that the output of the CLI is actually valid JavaScript and TypeScript
244+
test_cli_reference_typescript:
245+
name: Run CLI reference TypeScript check
246+
runs-on: ubuntu-latest
247+
steps:
248+
- uses: actions/checkout@v4
249+
- uses: actions/setup-node@v4
250+
with:
251+
node-version: 'lts/*'
252+
- run: npm i -g typescript
253+
- run: npm i --save @types/node @types/deno
254+
- name: Check TypeScript output
255+
run: tsc --noEmit --skipLibCheck --lib esnext,dom $(echo crates/cli/tests/reference/*.d.ts)
256+
- name: Check JavaScript output
257+
run: tsc --noEmit --skipLibCheck --lib esnext,dom --module esnext --allowJs $(echo crates/cli/tests/reference/*.js)
258+
242259
test_native:
243260
name: Run native tests
244261
runs-on: ubuntu-latest
@@ -325,7 +342,7 @@ jobs:
325342
runs-on: ubuntu-latest
326343
steps:
327344
- uses: actions/checkout@v4
328-
- run: rustup update --no-self-update 1.76.0 && rustup default 1.76.0
345+
- run: rustup update --no-self-update 1.78.0 && rustup default 1.78.0
329346
- run: cargo test -p wasm-bindgen-macro
330347
- run: cargo test -p wasm-bindgen-test-macro
331348

@@ -538,6 +555,35 @@ jobs:
538555
name: doc_api
539556
path: docs.tar.gz
540557

558+
msrv-resolver:
559+
name: Check feature resolver version 1 compatibility
560+
runs-on: ubuntu-latest
561+
strategy:
562+
fail-fast: false
563+
matrix:
564+
rust:
565+
- 1.57
566+
- stable
567+
target:
568+
- x86_64-unknown-linux-gnu
569+
- wasm32-unknown-unknown
570+
features:
571+
- --no-default-features
572+
- --no-default-features --features std
573+
- --no-default-features --features msrv
574+
- ""
575+
defaults:
576+
run:
577+
working-directory: crates/msrv/resolver
578+
steps:
579+
- uses: actions/checkout@v4
580+
- run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} && rustup target add ${{ matrix.target }}
581+
- if: matrix.rust == '1.57'
582+
run: |
583+
cargo update -p bumpalo --precise 3.12.0
584+
cargo update -p log --precise 0.4.18
585+
- run: cargo build --target ${{ matrix.target }} ${{ matrix.features }}
586+
541587
msrv-lib:
542588
name: Check MSRV for libraries
543589
runs-on: ubuntu-latest
@@ -549,6 +595,8 @@ jobs:
549595
- wasm32-unknown-unknown
550596
features:
551597
- --no-default-features
598+
- --no-default-features --features std
599+
- --no-default-features --features msrv
552600
- ""
553601
defaults:
554602
run:

CHANGELOG.md

+73
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,79 @@
11
# `wasm-bindgen` Change Log
22
--------------------------------------------------------------------------------
33

4+
## Unreleased
5+
6+
### Added
7+
8+
* Add a `copy_to_uninit()` method to all `TypedArray`s. It takes `&mut [MaybeUninit<T>]` and returns `&mut [T]`.
9+
[#4340](https://github.com/rustwasm/wasm-bindgen/pull/4340)
10+
11+
### Changed
12+
13+
* Optional parameters are now typed as `T | undefined | null` to reflect the actual JS behavior.
14+
[#4188](https://github.com/rustwasm/wasm-bindgen/pull/4188)
15+
16+
* Adding `getter`, `setter`, and `constructor` methods to enums now results in a compiler error. This was previously erroneously allowed and resulted in invalid JS code gen.
17+
[#4278](https://github.com/rustwasm/wasm-bindgen/pull/4278)
18+
19+
### Fixed
20+
21+
- Fixed using [JavaScript keyword](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords) as identifiers not being handled correctly.
22+
[#4329](https://github.com/rustwasm/wasm-bindgen/pull/4329)
23+
24+
- Using JS keywords as `struct` and `enum` names will now error at compile time, instead of causing invalid JS code gen.
25+
- Using JS keywords that are not valid to call or access properties on will now error at compile time, instead of causing invalid JS code gen if used as:
26+
1. The first part of a `js_namespace` on imports.
27+
2. The name of an imported type or constant if the type or constant does not have a `js_namespace` or `module` attribute.
28+
3. The name of an imported function if the function is not a method and does not have a `js_namespace` or `module` attribute.
29+
- Using JS keywords on imports in places other than the above will no longer cause the keywords to be escaped as `_{keyword}`.
30+
31+
--------------------------------------------------------------------------------
32+
33+
## [0.2.99](https://github.com/rustwasm/wasm-bindgen/compare/0.2.98...0.2.99)
34+
35+
Released 2024-12-07
36+
37+
### Fixed
38+
39+
- Mark `wasm-bindgen` v0.2.98 only compatible with `wasm-bindgen-cli` of the same version.
40+
[#4331](https://github.com/rustwasm/wasm-bindgen/pull/4331)
41+
42+
--------------------------------------------------------------------------------
43+
44+
## [0.2.98](https://github.com/rustwasm/wasm-bindgen/compare/0.2.97...0.2.98)
45+
46+
Released 2024-12-07
47+
48+
### Added
49+
50+
* Add support for multi-threading in Node.js.
51+
[#4318](https://github.com/rustwasm/wasm-bindgen/pull/4318)
52+
53+
* Add `WASM_BINDGEN_TEST_DRIVER_TIMEOUT` environment variable to control the timeout to start and connect to the test driver.
54+
[#4320](https://github.com/rustwasm/wasm-bindgen/pull/4320)
55+
56+
* Add support for number slices of type `MaybeUninit<T>`.
57+
[#4316](https://github.com/rustwasm/wasm-bindgen/pull/4316)
58+
59+
### Changed
60+
61+
* Remove `once_cell/critical-section` requirement for `no_std` with atomics.
62+
[#4322](https://github.com/rustwasm/wasm-bindgen/pull/4322)
63+
64+
* `static FOO: Option<T>` now returns `None` if undeclared in JS instead of throwing an error in JS.
65+
[#4319](https://github.com/rustwasm/wasm-bindgen/pull/4319)
66+
67+
### Fixed
68+
69+
* Fix macro-hygiene for calls to `std::thread_local!`.
70+
[#4315](https://github.com/rustwasm/wasm-bindgen/pull/4315)
71+
72+
* Fix feature resolver version 1 compatibility.
73+
[#4327](https://github.com/rustwasm/wasm-bindgen/pull/4327)
74+
75+
--------------------------------------------------------------------------------
76+
477
## [0.2.97](https://github.com/rustwasm/wasm-bindgen/compare/0.2.96...0.2.97)
578

679
Released 2024-11-30

Cargo.toml

+18-18
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ name = "wasm-bindgen"
1313
readme = "README.md"
1414
repository = "https://github.com/rustwasm/wasm-bindgen"
1515
rust-version = "1.57"
16-
version = "0.2.97"
16+
version = "0.2.99"
1717

1818
[package.metadata.docs.rs]
1919
features = ["serde-serialize"]
@@ -22,46 +22,46 @@ features = ["serde-serialize"]
2222
test = false
2323

2424
[features]
25-
default = ["spans", "std"]
25+
default = ["std", "msrv"]
2626
enable-interning = ["std"]
2727
serde-serialize = ["serde", "serde_json", "std"]
28-
spans = ["wasm-bindgen-macro/spans"]
29-
std = ["wasm-bindgen-macro/std", "once_cell/std"]
28+
spans = []
29+
std = []
30+
31+
# Opt-in for Rust language features that require a higher MSRV.
32+
#
33+
# The current rustc version is detected at compile-time, so enabling this
34+
# feature for older compilers will NOT result in a compilation error. Instead,
35+
# any unsupported language feature will not be used.
36+
msrv = ["rustversion"]
3037

3138
# Whether or not the `#[wasm_bindgen]` macro is strict and generates an error on
3239
# all unused attributes
3340
strict-macro = ["wasm-bindgen-macro/strict-macro"]
3441

35-
# Enables gg-alloc as system allocator when using wasm-bindgen-test to check that large pointers
42+
# INTERNAL ONLY: Enables gg-alloc as system allocator when using wasm-bindgen-test to check that large pointers
3643
# are handled correctly
3744
gg-alloc = ["wasm-bindgen-test/gg-alloc"]
3845

39-
# This is only for debugging wasm-bindgen! No stability guarantees, so enable
46+
# INTERNAL ONLY: This is only for debugging wasm-bindgen! No stability guarantees, so enable
4047
# this at your own peril!
4148
xxx_debug_only_print_generated_code = ["wasm-bindgen-macro/xxx_debug_only_print_generated_code"]
4249

4350
[dependencies]
4451
cfg-if = "1.0.0"
4552
once_cell = { version = "1.12", default-features = false }
53+
rustversion = { version = "1.0", optional = true }
4654
serde = { version = "1.0", optional = true }
4755
serde_json = { version = "1.0", optional = true }
48-
wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.97", default-features = false }
49-
50-
[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"), target_feature = "atomics"))'.dependencies]
51-
wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.97", default-features = false, features = [
52-
"atomics",
53-
] }
54-
55-
[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"), wasm_bindgen_unstable_test_coverage))'.dependencies]
56-
wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.97", default-features = false, features = [
57-
"coverage",
58-
] }
56+
wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.99" }
5957

6058
[dev-dependencies]
59+
once_cell = "1"
6160
wasm-bindgen-test = { path = 'crates/test' }
6261

6362
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
6463
js-sys = { path = 'crates/js-sys' }
64+
paste = "1"
6565
serde_derive = "1.0"
6666
wasm-bindgen-futures = { path = 'crates/futures' }
6767
wasm-bindgen-test-crate-a = { path = 'tests/crates/a' }
@@ -85,7 +85,7 @@ too_many_arguments = "allow"
8585
type_complexity = "allow"
8686

8787
[workspace]
88-
exclude = ["crates/msrv"]
88+
exclude = ["crates/msrv/resolver", "crates/msrv/lib", "crates/msrv/cli"]
8989
members = [
9090
"benchmarks",
9191
"crates/cli",

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ Libraries that are released on [crates.io](https://crates.io) have a MSRV of v1.
114114

115115
CLI tools and their corresponding support libraries have a MSRV of v1.76. Changes to the MSRV will be accompanied by a patch version bump.
116116

117-
[Feature resolver version 2](https://doc.rust-lang.org/1.83.0/cargo/reference/resolver.html#feature-resolver-version-2) is required.
118-
119117
## License
120118

121119
This project is licensed under either of

crates/backend/Cargo.toml

+2-8
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,18 @@ license = "MIT OR Apache-2.0"
1111
name = "wasm-bindgen-backend"
1212
repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend"
1313
rust-version = "1.57"
14-
version = "0.2.97"
14+
version = "0.2.99"
1515

1616
[features]
17-
atomics = []
18-
coverage = []
19-
default = ["std"]
2017
extra-traits = ["syn/extra-traits"]
21-
spans = []
22-
std = []
2318

2419
[dependencies]
2520
bumpalo = "3.0.0"
2621
log = "0.4"
27-
once_cell = "1.12"
2822
proc-macro2 = "1.0"
2923
quote = '1.0'
3024
syn = { version = '2.0', features = ['full'] }
31-
wasm-bindgen-shared = { path = "../shared", version = "=0.2.97" }
25+
wasm-bindgen-shared = { path = "../shared", version = "=0.2.99" }
3226

3327
[lints]
3428
workspace = true

0 commit comments

Comments
 (0)