Skip to content

Commit 221780b

Browse files
orpuente-MSbillti
andauthored
Upgrade the rust version to 1.88 (#2583)
This PR upgrades the rust toolchain version from 1.86 to 1.88 across multiple workflows and files. To make the upgrade possible, we had to fix a linker issue and a wasm-config flag that changed in 1.87. ## Linker issue Starting on rust 1.87, the Std doesn't link advapi32 on windows anymore. So, C libraries that depend on it, like mimalloc, now need to link it manually. [Link to the Rust PR](rust-lang/rust#138233). ## wasm config flag Rust 1.87 upgraded to LLVM 20, which enables bulk-memory by default. Therefore, `wasm-opt` needs to be configured to expect this setting. This behavior is document [here](https://doc.rust-lang.org/rustc/platform-support/wasm32-unknown-unknown.html#enabled-webassembly-features). --------- Co-authored-by: Bill Ticehurst <billti@microsoft.com>
1 parent e46eec3 commit 221780b

File tree

10 files changed

+30
-10
lines changed

10 files changed

+30
-10
lines changed

.ado/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ schedules:
1919

2020
variables:
2121
CARGO_TERM_COLOR: always
22-
RUST_TOOLCHAIN_VERSION: "1.86"
22+
RUST_TOOLCHAIN_VERSION: "1.88"
2323

2424
resources:
2525
repositories:

.github/workflows/bench-reports.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env:
88
CARGO_TERM_COLOR: always
99
NODE_VERSION: "20.18.2"
1010
PYTHON_VERSION: "3.11"
11-
RUST_TOOLCHAIN_VERSION: "1.86"
11+
RUST_TOOLCHAIN_VERSION: "1.88"
1212

1313
jobs:
1414
runBenchmark:

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ env:
2020
CARGO_TERM_COLOR: always
2121
NODE_VERSION: "20.18.2"
2222
PYTHON_VERSION: "3.11"
23-
RUST_TOOLCHAIN_VERSION: "1.86"
23+
RUST_TOOLCHAIN_VERSION: "1.88"
2424
RUST_TOOLCHAIN_COMPONENTS: rustfmt clippy
2525

2626
jobs:

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup rust toolchain
1616
uses: ./.github/actions/toolchains/rust
1717
with:
18-
toolchain: "1.86"
18+
toolchain: "1.88"
1919
components: rustfmt clippy
2020
- uses: actions/setup-python@v4
2121
with:

.github/workflows/memory_profile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515
CARGO_TERM_COLOR: always
1616
NODE_VERSION: "20.18.2"
1717
PYTHON_VERSION: "3.11"
18-
RUST_TOOLCHAIN_VERSION: "1.86"
18+
RUST_TOOLCHAIN_VERSION: "1.88"
1919
RUST_TOOLCHAIN_COMPONENTS: rustfmt clippy
2020

2121
jobs:

.github/workflows/publish-playground.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
env:
1313
CARGO_TERM_COLOR: always
14-
RUST_TOOLCHAIN_VERSION: "1.86"
14+
RUST_TOOLCHAIN_VERSION: "1.88"
1515
RUST_TOOLCHAIN_COMPONENTS: rustfmt clippy
1616

1717
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages

prereqs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
import functools
1414

1515
python_ver = (3, 11) # Python support for Windows on ARM64 requires v3.11 or later
16-
rust_ver = (1, 86) # Ensure Rust version 1.86 or later is installed
16+
rust_ver = (1, 88) # Ensure Rust version 1.88 or later is installed
1717
node_ver = (
1818
20,
1919
18,
2020
)
2121
wasmpack_ver = (0, 12, 1) # Latest tested wasm-pack version
22-
rust_fmt_ver = (1, 8, 0) # Current version when Rust 1.86 shipped
23-
clippy_ver = (0, 1, 86)
22+
rust_fmt_ver = (1, 8, 0) # Current version when Rust 1.88 shipped
23+
clippy_ver = (0, 1, 88)
2424

2525
# Disable buffered output so that the log statements and subprocess output get interleaved in proper order
2626
print = functools.partial(print, flush=True)

source/allocator/mimalloc-sys/build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ fn main() -> Result<(), Box<dyn Error>> {
2323
// loads extra libraries, changes the name and path around, and does other things that are
2424
// difficult to handle. The cc crate is much simpler and more predictable.
2525
fn compile_mimalloc() {
26+
let target = env::var("TARGET").expect("TARGET variable should exist");
2627
let mimalloc_vendor_dir = PathBuf::from("mimalloc");
2728

2829
let mut build = cc::Build::new();
@@ -62,6 +63,14 @@ fn compile_mimalloc() {
6263
// turn off warnings from the mimalloc code
6364
build.cargo_warnings(false);
6465

66+
// Starting on rust 1.87, the Std doesn't link advapi32 on windows
67+
// anymore. So, C libraries that depended on it, like mimalloc, now
68+
// need to link it manually.
69+
// Link to the Rust PR: <https://github.com/rust-lang/rust/pull/138233>
70+
if target.contains("windows") {
71+
println!("cargo:rustc-link-lib=advapi32");
72+
}
73+
6574
build.compile("mimalloc");
6675
}
6776

source/compiler/qsc_rca/src/core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1808,7 +1808,7 @@ impl<'a> Visitor<'a> for Analyzer<'a> {
18081808
let is_test_callable = current_item_context
18091809
.callable_context
18101810
.as_ref()
1811-
.is_some_and(|f| f.attrs.iter().any(|attr| *attr == Attr::Test));
1811+
.is_some_and(|f| f.attrs.contains(&Attr::Test));
18121812
match callable_impl {
18131813
CallableImpl::Intrinsic => {
18141814
self.analyze_intrinsic_callable();

source/wasm/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,14 @@ indoc = { workspace = true }
4545

4646
[lints]
4747
workspace = true
48+
49+
# Rust 1.87 upgraded to LLVM 20, which enables bulk-memory and non-trapping float by default.
50+
# (See https://github.com/rust-lang/rust/pull/137322)
51+
# Therefore, `wasm-opt` needs to be configured to expect this setting.
52+
# This behavior is document in:
53+
# <https://doc.rust-lang.org/rustc/platform-support/wasm32-unknown-unknown.html#enabled-webassembly-features>.
54+
[package.metadata.wasm-pack.profile.profiling]
55+
wasm-opt = ['-O', '--enable-bulk-memory', '--enable-nontrapping-float-to-int']
56+
57+
[package.metadata.wasm-pack.profile.release]
58+
wasm-opt = ['-O', '--enable-bulk-memory', '--enable-nontrapping-float-to-int']

0 commit comments

Comments
 (0)