Port all viable contracts from verify-rust-std
Ports over all contracts (other than those for Alignment, see the separate PR) that can be expressed using the current, experimental contracts syntax. (Notably, this excludes all contracts that refer to pointer validity.)
The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
|
966 | // Precondition 2: substracting the computed offset from `self` does not cause overflow.
| ^^^^^^^^^^^^
|
rerun tidy with `--extra-checks=spellcheck --bless` to fix typos
tidy [extra_checks]: checks with external tool 'typos' failed
tidy [extra_checks]: FAIL
tidy: The following check failed: extra_checks
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy /checkout /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo /checkout/obj/build 4 /node/bin/npm --extra-checks=py,cpp,js,spellcheck` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:1561:23
Executed at: src/bootstrap/src/core/build_steps/test.rs:1281:29
Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Build completed unsuccessfully in 0:02:30
local time: Mon Sep 29 07:15:20 UTC 2025
network time: Mon, 29 Sep 2025 07:15:20 GMT
##[error]Process completed with exit code 1.
:umbrella: The latest upstream changes (presumably #142771) made this pull request unmergeable. Please resolve the merge conflicts.
The job aarch64-gnu-llvm-20-2 failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] rand test:false 1.099
error[E0658]: use of unstable library feature `contracts`
##[error] --> alloctests/../alloc/src/collections/vec_deque/iter_mut.rs:212:7
|
212 | #[core::contracts::requires(idx < self.len())]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= help: add `#![feature(contracts)]` to the crate attributes to enable
= note: this compiler was built on 2025-10-29; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature `contracts`
##[error] --> alloctests/../alloc/src/collections/vec_deque/iter.rs:147:7
|
147 | #[core::contracts::requires(idx < self.len())]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= help: add `#![feature(contracts)]` to the crate attributes to enable
= note: this compiler was built on 2025-10-29; consider upgrading it if it is out of date
---
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] corebenches test:true 8.174
[RUSTC-TIMING] alloctests test:true 14.863
[RUSTC-TIMING] coretests test:true 71.577
env -u RUSTC_WRAPPER CARGO_ENCODED_RUSTDOCFLAGS="-Csymbol-mangling-version=v0\u{1f}-Zrandomize-layout\u{1f}-Zunstable-options\u{1f}--check-cfg=cfg(bootstrap)\u{1f}-Dwarnings\u{1f}-Wrustdoc::invalid_codeblock_attributes\u{1f}--crate-version\u{1f}1.93.0-nightly\t(1dfe3efd0\t2025-10-29)" CARGO_ENCODED_RUSTFLAGS="-Csymbol-mangling-version=v0\u{1f}-Zrandomize-layout\u{1f}-Zunstable-options\u{1f}--check-cfg=cfg(bootstrap)\u{1f}-Zmacro-backtrace\u{1f}-Csplit-debuginfo=off\u{1f}-Clink-arg=-L/usr/lib/llvm-20/lib\u{1f}-Cllvm-args=-import-instr-limit=10\u{1f}-Clink-args=-Wl,-z,origin\u{1f}-Clink-args=-Wl,-rpath,$ORIGIN/../lib\u{1f}-Alinker-messages\u{1f}--cap-lints=allow\u{1f}--cfg\u{1f}randomized_layouts" RUSTC="/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-codegen/cg_clif/dist/rustc-clif" RUSTDOC="/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-codegen/cg_clif/dist/rustdoc-clif" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "test" "--manifest-path" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-codegen/cg_clif/build/sysroot_tests/Cargo.toml" "--target-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-codegen/cg_clif/build/sysroot_tests_target" "--locked" "--target" "aarch64-unknown-linux-gnu" "-p" "coretests" "-p" "alloctests" "--tests" "--" "-q" exited with status ExitStatus(unix_wait_status(25856))
Bootstrap failed while executing `--stage 2 test --skip tests --skip coverage-map --skip coverage-run --skip library --skip tidyselftest`
Command `/checkout/obj/build/aarch64-unknown-linux-gnu/stage0/bin/cargo run --target aarch64-unknown-linux-gnu -Zbinary-dep-depinfo -j 4 -Zroot-dir=/checkout --locked --color always --release --manifest-path /checkout/compiler/rustc_codegen_cranelift/build_system/Cargo.toml -- test --download-dir /checkout/obj/build/cg_clif_download --out-dir /checkout/obj/build/aarch64-unknown-linux-gnu/stage2-codegen/cg_clif --no-unstable-features --use-backend cranelift --sysroot llvm --skip-test testsuite.extended_sysroot [workdir=/checkout/compiler/rustc_codegen_cranelift]` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/test.rs:3689:25
Executed at: src/bootstrap/src/core/build_steps/test.rs:3734:26
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:21:40
local time: Wed Oct 29 13:15:02 UTC 2025
network time: Wed, 29 Oct 2025 13:15:02 GMT
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"
The job x86_64-gnu-miri failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
tests/pass/shims/x86/rounding-error.rs ... ok
tests/pass/shims/x86/intrinsics-x86-gfni.rs ... ok
FAILED TEST: tests/pass/shims/time-with-isolation.rs
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp/miri-uitest-b9L0KQ" RUST_BACKTRACE="1" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/miri" "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/tmp/miri_ui/0/tests/pass/shims" "tests/pass/shims/time-with-isolation.rs" "--edition" "2021"
error: actual output differed from expected
Execute `./miri test --bless` to update `tests/pass/shims/time-with-isolation.stdout` to the actual output
--- tests/pass/shims/time-with-isolation.stdout
+++ <stdout output>
---
Location:
/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ui_test-0.30.2/src/lib.rs:365
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1: <color_eyre[a7056aff10ada0ce]::config::EyreHook>::into_eyre_hook::{closure#0}<unknown>
at <unknown source file>:<unknown line>
2: eyre[a53daa490cb2b6db]::private::format_err<unknown>
at <unknown source file>:<unknown line>
3: ui_test[2291afd050d8074c]::run_tests_generic::<ui_test[2291afd050d8074c]::default_file_filter, ui[b8f434506ba49ee]::run_tests::{closure#1}, alloc[186c8bf19c55001b]::boxed::Box<dyn ui_test[2291afd050d8074c]::status_emitter::StatusEmitter>><unknown>
at <unknown source file>:<unknown line>
4: ui[b8f434506ba49ee]::ui<unknown>
at <unknown source file>:<unknown line>
5: ui[b8f434506ba49ee]::main<unknown>
at <unknown source file>:<unknown line>
6: std[53d38a3009d6846a]::sys::backtrace::__rust_begin_short_backtrace::<fn() -> core[b50788df90f093ca]::result::Result<(), eyre[a53daa490cb2b6db]::Report>, core[b50788df90f093ca]::result::Result<(), eyre[a53daa490cb2b6db]::Report>><unknown>
at <unknown source file>:<unknown line>
7: std[53d38a3009d6846a]::rt::lang_start::<core[b50788df90f093ca]::result::Result<(), eyre[a53daa490cb2b6db]::Report>>::{closure#0}<unknown>
at <unknown source file>:<unknown line>
8: std[53d38a3009d6846a]::rt::lang_start_internal<unknown>
at <unknown source file>:<unknown line>
9: main<unknown>
at <unknown source file>:<unknown line>
10: __libc_start_main<unknown>
at <unknown source file>:<unknown line>
11: _start<unknown>
at <unknown source file>:<unknown line>
Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.
error: test failed, to rerun pass `--test ui`
Caused by:
process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/ui-c0a05ecf0b9c0490` (exit status: 1)
Bootstrap failed while executing `test --stage 2 src/tools/miri src/tools/miri/cargo-miri`
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo test --target x86_64-unknown-linux-gnu -Zbinary-dep-depinfo -j 4 -Zroot-dir=/checkout --locked --color always --release --manifest-path /checkout/src/tools/miri/Cargo.toml -- [workdir=/checkout]` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:191:21
Executed at: src/bootstrap/src/core/build_steps/test.rs:677:19
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:39:54
local time: Thu Oct 30 09:36:31 UTC 2025
network time: Thu, 30 Oct 2025 09:36:31 GMT
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"
⚠️ #[rustc_allow_const_fn_unstable] needs careful audit to avoid accidentally exposing unstable
implementation details on stable.
cc @rust-lang/wg-const-eval
The Miri subtree was changed
cc @rust-lang/miri
Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter gets adapted for the changes, if necessary.
cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr
r? @scottmcm
rustbot has assigned @scottmcm. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r? to explicitly pick a reviewer
@bors try @rust-timer queue
Insufficient permissions to issue commands to rust-timer.
@tautschnig: :key: Insufficient privileges: not in try users
@bors try @rust-timer queue
You can always ask for a perf run here: https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/perf.20run/with/543397764
Awaiting bors try build completion.
@rustbot label: +S-waiting-on-perf
:hourglass: Trying commit 357743fc90d7975e36a0da4e58020f17eea173fb with merge 2c09cd94b5816629b10657151037a6951ff7a7d6…
To cancel the try build, run the command @bors try cancel.
Workflow: https://github.com/rust-lang/rust/actions/runs/18950231364
:sunny: Try build successful (CI)
Build commit: 2c09cd94b5816629b10657151037a6951ff7a7d6 (2c09cd94b5816629b10657151037a6951ff7a7d6, parent: 8205e6b75ec656305ac235d4726d2c7a1ddcef14)
Queued 2c09cd94b5816629b10657151037a6951ff7a7d6 with parent 8205e6b75ec656305ac235d4726d2c7a1ddcef14, future comparison URL. There is currently 1 preceding artifact in the queue. It will probably take at least ~2.1 hours until the benchmark run finishes.
Finished benchmarking commit (2c09cd94b5816629b10657151037a6951ff7a7d6): comparison URL.
Overall result: ❌ regressions - please read the text below
Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.
Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.
@bors rollup=never @rustbot label: -S-waiting-on-perf +perf-regression
Instruction count
Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
| mean | range | count | |
|---|---|---|---|
| Regressions ❌ (primary) |
1.0% | [0.1%, 12.2%] | 79 |
| Regressions ❌ (secondary) |
3.3% | [0.0%, 17.6%] | 53 |
| Improvements ✅ (primary) |
- | - | 0 |
| Improvements ✅ (secondary) |
-0.1% | [-0.3%, -0.1%] | 3 |
| All ❌✅ (primary) | 1.0% | [0.1%, 12.2%] | 79 |
Max RSS (memory usage)
Results (primary 1.6%, secondary 2.9%)
A less reliable metric. May be of interest, but not used to determine the overall result above.
| mean | range | count | |
|---|---|---|---|
| Regressions ❌ (primary) |
2.0% | [0.8%, 3.8%] | 22 |
| Regressions ❌ (secondary) |
3.5% | [1.0%, 8.0%] | 28 |
| Improvements ✅ (primary) |
-2.2% | [-3.6%, -0.7%] | 2 |
| Improvements ✅ (secondary) |
-3.1% | [-4.2%, -1.3%] | 3 |
| All ❌✅ (primary) | 1.6% | [-3.6%, 3.8%] | 24 |
Cycles
Results (primary 4.5%, secondary 4.1%)
A less reliable metric. May be of interest, but not used to determine the overall result above.
| mean | range | count | |
|---|---|---|---|
| Regressions ❌ (primary) |
4.5% | [2.1%, 10.7%] | 8 |
| Regressions ❌ (secondary) |
6.0% | [1.4%, 18.2%] | 36 |
| Improvements ✅ (primary) |
- | - | 0 |
| Improvements ✅ (secondary) |
-4.6% | [-8.0%, -1.3%] | 8 |
| All ❌✅ (primary) | 4.5% | [2.1%, 10.7%] | 8 |
Binary size
Results (primary 0.3%, secondary 0.9%)
A less reliable metric. May be of interest, but not used to determine the overall result above.
| mean | range | count | |
|---|---|---|---|
| Regressions ❌ (primary) |
0.3% | [0.0%, 1.2%] | 103 |
| Regressions ❌ (secondary) |
0.9% | [0.0%, 3.9%] | 42 |
| Improvements ✅ (primary) |
-0.0% | [-0.0%, -0.0%] | 1 |
| Improvements ✅ (secondary) |
- | - | 0 |
| All ❌✅ (primary) | 0.3% | [-0.0%, 1.2%] | 104 |
Bootstrap: 475.886s -> 478.145s (0.47%) Artifact size: 390.36 MiB -> 390.64 MiB (0.07%)
:umbrella: The latest upstream changes (presumably #148412) made this pull request unmergeable. Please resolve the merge conflicts.
So I like contracts, but it seems like we shouldn't be getting rustc-perf impacts this high to add them when they're not even being used to do anything? Is there anything feasible to do about that?
@rustbot author
Reminder, once the PR becomes ready for a review, use @rustbot ready.
So I like contracts, but it seems like we shouldn't be getting rustc-perf impacts this high to add them when they're not even being used to do anything? Is there anything feasible to do about that?
I don't have the expertise to interpret the runs of rustc-perf, but I would imagine that parsing, type-checking, generating the MIR, and optimising out disabled contracts etc. adds to the compilation time of the standard library, and therefore to the compiler.
#145229 was proposed to completely disable macro expansion of contracts when those are disabled, but was rejected as having contracts not be type checked was considered undesirable. Maybe we can revisit this and implement some sort of hybrid solution, giving the option to opt-in or opt-out of contract macro expansion as a new compiler flag. Then e.g. the flag could be enabled in CI, checking the well-typedness of contracts, whereas for fast iterations to build rustc, developers would have the flag disabled.
Any thoughts on this approach? Should contract expansion be opt-in or opt-out? I would image opt-out is a better fit, as by default having type-checking on contracts is nice for the general user, and we can set the opt-out flag in the x script as a default for rustc developers.
The issue here is not the performance regression of compiling libstd, but that other crates have regressions when calling those functions
but that other crates have regressions when calling those functions
Wouldn't the flag still do the job? We can expose the stdlib for consumption by crates with the contracts macro expansion disabled, and then users can override that with build-std if they wish.
I don't have the expertise to interpret the runs of rustc-perf
In case it helps anyone, I found this blog post by Jakub Beránek useful in getting up to speed with the benchmark suite.