Skip to content

Commit 56f7dec

Browse files
authored
Test no_std MSRV in CI (#4292)
Remove internal crates from MSRV tests, they are tested transitively.
1 parent 69a626c commit 56f7dec

File tree

5 files changed

+37
-28
lines changed

5 files changed

+37
-28
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,13 +540,22 @@ jobs:
540540
msrv-lib:
541541
name: Check MSRV for libraries
542542
runs-on: ubuntu-latest
543+
strategy:
544+
fail-fast: false
545+
matrix:
546+
target:
547+
- x86_64-unknown-linux-gnu
548+
- wasm32-unknown-unknown
549+
features:
550+
- --no-default-features
551+
- ""
543552
defaults:
544553
run:
545554
working-directory: crates/msrv/lib
546555
steps:
547556
- uses: actions/checkout@v4
548-
- run: rustup update --no-self-update 1.57 && rustup default 1.57
549-
- run: cargo build
557+
- run: rustup update --no-self-update 1.57 && rustup default 1.57 && rustup target add ${{ matrix.target }}
558+
- run: cargo build --target ${{ matrix.target }} ${{ matrix.features }}
550559

551560
msrv-cli:
552561
name: Check MSRV for CLI tools

crates/msrv/cli/Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,3 @@ version = "0.0.0"
66

77
[dependencies]
88
wasm-bindgen-cli = { path = "../../cli" }
9-
wasm-bindgen-cli-support = { path = "../../cli-support" }
10-
wasm-bindgen-externref-xform = { path = "../../externref-xform" }
11-
wasm-bindgen-multi-value-xform = { path = "../../multi-value-xform" }
12-
wasm-bindgen-threads-xform = { path = "../../threads-xform" }
13-
wasm-bindgen-wasm-conventions = { path = "../../wasm-conventions" }
14-
wasm-bindgen-wasm-interpreter = { path = "../../wasm-interpreter" }

crates/msrv/lib/Cargo.toml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@ name = "msrv-library-test"
44
publish = false
55
version = "0.0.0"
66

7+
[features]
8+
default = ["std"]
9+
std = [
10+
"wasm-bindgen/std",
11+
"js-sys/std",
12+
"wasm-bindgen-futures/std",
13+
"web-sys/std",
14+
"wasm-bindgen-test/std",
15+
]
16+
717
[dependencies]
8-
js-sys = { path = "../../js-sys" }
9-
wasm-bindgen = { path = "../../../" }
10-
wasm-bindgen-backend = { path = "../../backend" }
11-
wasm-bindgen-futures = { path = "../../futures" }
12-
wasm-bindgen-macro = { path = "../../macro" }
13-
wasm-bindgen-macro-support = { path = "../../macro-support" }
14-
wasm-bindgen-shared = { path = "../../shared" }
15-
wasm-bindgen-test = { path = "../../test" }
16-
wasm-bindgen-test-macro = { path = "../../test-macro" }
17-
web-sys = { path = "../../web-sys" }
18+
js-sys = { path = "../../js-sys", default-features = false }
19+
wasm-bindgen = { path = "../../../", default-features = false }
20+
wasm-bindgen-futures = { path = "../../futures", default-features = false }
21+
wasm-bindgen-test = { path = "../../test", default-features = false }
22+
web-sys = { path = "../../web-sys", default-features = false }
1823

24+
# Pinned sub-dependencies for MSRV
1925
bumpalo = "=3.12.0"
2026
log = "=0.4.18"
21-
scoped-tls = "=1.0.0"
22-
23-
[patch.crates-io]
24-
wasm-bindgen = { path = "../../../" }
27+
scoped-tls = { version = "=1.0.0", optional = false }

crates/test/src/rt/scoped_tls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl<T> ScopedKey<T> {
3737
#[doc(hidden)]
3838
/// # Safety
3939
/// `inner` must only be accessed through `ScopedKey`'s API
40-
pub const unsafe fn new(inner: &'static Wrapper<Cell<*const ()>>) -> Self {
40+
pub(super) const unsafe fn new(inner: &'static Wrapper<Cell<*const ()>>) -> Self {
4141
Self {
4242
inner,
4343
_marker: PhantomData,

src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,20 +1595,23 @@ pub mod __rt {
15951595
/// Wrapper around [`::once_cell::unsync::Lazy`] adding some compatibility methods with
15961596
/// [`std::thread::LocalKey`] and adding `Send + Sync` when `atomics` is not enabled.
15971597
#[cfg(not(feature = "std"))]
1598-
pub struct LazyCell<T>(::once_cell::unsync::Lazy<T>);
1598+
pub struct LazyCell<T, F = fn() -> T>(::once_cell::unsync::Lazy<T, F>);
15991599

16001600
#[cfg(all(not(target_feature = "atomics"), not(feature = "std")))]
1601-
unsafe impl<T> Sync for LazyCell<T> {}
1601+
unsafe impl<T, F> Sync for LazyCell<T, F> {}
16021602

16031603
#[cfg(all(not(target_feature = "atomics"), not(feature = "std")))]
1604-
unsafe impl<T> Send for LazyCell<T> {}
1604+
unsafe impl<T, F> Send for LazyCell<T, F> {}
16051605

16061606
#[cfg(not(feature = "std"))]
1607-
impl<T> LazyCell<T> {
1608-
pub const fn new(init: fn() -> T) -> LazyCell<T> {
1607+
impl<T, F> LazyCell<T, F> {
1608+
pub const fn new(init: F) -> LazyCell<T, F> {
16091609
Self(::once_cell::unsync::Lazy::new(init))
16101610
}
1611+
}
16111612

1613+
#[cfg(not(feature = "std"))]
1614+
impl<T, F: FnOnce() -> T> LazyCell<T, F> {
16121615
pub(crate) fn try_with<R>(
16131616
&self,
16141617
f: impl FnOnce(&T) -> R,

0 commit comments

Comments
 (0)