Skip to content

Commit ddada99

Browse files
Prevent use with rust 1.82+ (#1371)
### What Prevent use with rust 1.82+. And run CI builds with 1.81. ### Why stellar/rs-soroban-env#1469 Discussion: https://stellarfoundation.slack.com/archives/C030Z9EHVQE/p1729217606684609 (cherry picked from commit 9e674f2)
1 parent 467fdf5 commit ddada99

5 files changed

Lines changed: 13 additions & 7 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "stable"
2+
channel = "1.81"
33
targets = ["wasm32-unknown-unknown"]
44
components = ["rustc", "cargo", "rustfmt", "clippy", "rust-src"]

soroban-sdk/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ exclude = ["test_snapshots/", "src/tests/"]
1515
[lib]
1616
doctest = false
1717

18+
[build-dependencies]
19+
rustc_version = "0.4.1"
20+
1821
[dependencies]
1922
soroban-sdk-macros = { workspace = true }
2023
bytes-lit = "0.0.5"

soroban-sdk/build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pub fn main() {
2+
#[cfg(all(target_family = "wasm", target_os = "unknown"))]
3+
if let Ok(version) = rustc_version::version() {
4+
if version.major == 1 && version.minor >= 82 {
5+
panic!("Rust compiler 1.82+ with target 'wasm32-unknown-unknown' is unsupported by the Soroban Environment, because the 'wasm32-unknown-unknown' target in Rust 1.82+ has features enabled that are not yet supported and not easily disabled: reference-types, multi-value. Use Rust 1.81 to build for the 'wasm32-unknown-unknown' target.");
6+
}
7+
}
8+
}

soroban-sdk/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@
4747
#[cfg(all(target_family = "wasm", feature = "testutils"))]
4848
compile_error!("'testutils' feature is not supported on 'wasm' target");
4949

50-
#[cfg(all(target_family = "wasm", target_feature = "reference-types"))]
51-
compile_error!("Compiler configuration is unsupported by Soroban Environment, because a Wasm target-feature is enabled that is not yet supported: reference-types. Use Rust 1.81 or older to get a compatible default configuration.");
52-
53-
#[cfg(all(target_family = "wasm", target_feature = "multivalue"))]
54-
compile_error!("Compiler configuration is unsupported by Soroban Environment, because a Wasm target-feature is enabled that is not yet supported: multivalue. Use Rust 1.81 or older to get a compatible default configuration.");
55-
5650
// When used in a no_std contract, provide a panic handler as one is required.
5751
#[cfg(all(not(feature = "alloc"), target_family = "wasm"))]
5852
#[panic_handler]

0 commit comments

Comments
 (0)