Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent use with rust 1.82+ #1371

Merged
merged 6 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "stable"
channel = "1.81"
targets = ["wasm32-unknown-unknown"]
components = ["rustc", "cargo", "rustfmt", "clippy", "rust-src"]
3 changes: 3 additions & 0 deletions soroban-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ exclude = ["test_snapshots/", "src/tests/"]
[lib]
doctest = false

[build-dependencies]
rustc_version = "0.4.1"

[dependencies]
soroban-sdk-macros = { workspace = true }
bytes-lit = "0.0.5"
Expand Down
8 changes: 8 additions & 0 deletions soroban-sdk/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pub fn main() {
#[cfg(all(target_family = "wasm", target_os = "unknown"))]
if let Ok(version) = rustc_version::version() {
if version.major == 1 && version.minor >= 82 {
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 changes: 0 additions & 6 deletions soroban-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@
#[cfg(all(target_family = "wasm", feature = "testutils"))]
compile_error!("'testutils' feature is not supported on 'wasm' target");

#[cfg(all(target_family = "wasm", target_feature = "reference-types"))]
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.");

#[cfg(all(target_family = "wasm", target_feature = "multivalue"))]
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.");

// When used in a no_std contract, provide a panic handler as one is required.
#[cfg(all(not(feature = "alloc"), target_family = "wasm"))]
#[panic_handler]
Expand Down
Loading