Optimize `checked_ilog` and `pow` when `base` is a power of two
Optimize checked_ilog and pow when the base is a power of two
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
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)
note: no errors encountered even though delayed bugs were created
note: those delayed bugs will now be shown as internal compiler errors
error: internal compiler error: alignment greater than 2^29 should be errored on elsewhere
##[error] --> example/mini_core_hello_world.rs:359:12
|
359 | #[repr(align(8192))]
| ^^^^^^^^^^^
|
---
3: <rustc_errors::diagnostic::Diag>::emit_producing_error_guaranteed
4: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
5: <rustc_passes::check_attr::CheckAttrVisitor>::check_attributes
6: <rustc_passes::check_attr::CheckAttrVisitor as rustc_hir::intravisit::Visitor>::visit_item
7: <rustc_middle::ty::context::TyCtxt>::hir_visit_item_likes_in_module::<rustc_passes::check_attr::CheckAttrVisitor>
8: rustc_passes::check_attr::check_mod_attrs
9: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_mod_attrs::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
10: <rustc_query_impl::query_impl::check_mod_attrs::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalModDefId)>>::call_once
11: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalModDefId, rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
13: rustc_query_impl::query_impl::check_mod_attrs::get_query_non_incr::__rust_end_short_backtrace
14: <rustc_middle::ty::context::TyCtxt>::par_hir_for_each_module::<rustc_interface::passes::run_required_analyses::{closure#0}::{closure#1}::{closure#0}::{closure#2}::{closure#0}>::{closure#0}
15: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<(), rustc_interface::passes::run_required_analyses::{closure#0}::{closure#0}::{closure#1}>
16: rustc_interface::passes::analysis
17: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
18: <rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
19: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<rustc_query_system::query::plumbing::execute_job_non_incr<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
21: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
22: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
23: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}>
24: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
25: <alloc::boxed::Box<dyn for<'a> core::ops::function::FnOnce<(&'a rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &'a std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt<'a>>, &'a rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena<'a>>, &'a rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena<'a>>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}), Output = core::option::Option<rustc_interface::queries::Linker>>> as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once
26: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
27: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>
28: rustc_span::create_session_globals_then::<(), rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
29: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
30: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
---
warning: the ICE couldn't be written to `/checkout/compiler/rustc_codegen_cranelift/rustc-ice-2025-10-02T02_02_05-34620.txt`: Read-only file system (os error 30)
note: rustc 1.92.0-nightly (ba891baca 2025-10-02) running on aarch64-unknown-linux-gnu
note: compiler flags: -C panic=abort -Z panic-abort-tests -Z codegen-backend=cranelift -C symbol-mangling-version=v0 -Z randomize-layout -Z unstable-options -Z macro-backtrace -C split-debuginfo=off -C link-arg=-L/usr/lib/llvm-20/lib -C llvm-args=-import-instr-limit=10 -C link-args=-Wl,-z,origin -C link-args=-Wl,-rpath,$ORIGIN/../lib -C debuginfo=2 -C panic=abort -Z force-unstable-if-unmarked
query stack during panic:
end of query stack
"/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-codegen/cg_clif/dist/rustc-clif" "-Csymbol-mangling-version=v0" "-Zrandomize-layout" "-Zunstable-options" "--check-cfg=cfg(bootstrap)" "-Zmacro-backtrace" "-Csplit-debuginfo=off" "-Clink-arg=-L/usr/lib/llvm-20/lib" "-Cllvm-args=-import-instr-limit=10" "-Clink-args=-Wl,-z,origin" "-Clink-args=-Wl,-rpath,$ORIGIN/../lib" "-Alinker-messages" "-L" "crate=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-codegen/cg_clif/build/example" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-codegen/cg_clif/build/example" "-Cdebuginfo=2" "--target" "aarch64-unknown-linux-gnu" "-Cpanic=abort" "--check-cfg=cfg(jit)" "example/mini_core_hello_world.rs" exited with status ExitStatus(unix_wait_status(25856))
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:3658:25
Executed at: src/bootstrap/src/core/build_steps/test.rs:3703:26
Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `--stage 2 test --skip tests --skip coverage-map --skip coverage-run --skip library --skip tidyselftest`
Build completed unsuccessfully in 0:22:45
local time: Thu Oct 2 02:02:05 UTC 2025
network time: Thu, 02 Oct 2025 02:02:05 GMT
##[error]Process completed with exit code 1.
does this affect the codegen in practical circumstances? I would expect even a fairly weak optimizer to perform this optimization, making us hand-coding it irrelevant and potentially even harmful because we introduce more conditional logic to chew through.
does this affect the codegen in practical circumstances?
It replaces a loop by some bit manipulations. Whether anyone actually calls either function with a compile-time known, power of 2 base is another question. But it can't hurt, since it is guarded by is_statically_known.
I would expect even a fairly weak optimizer to perform this optimization, making us hand-coding it irrelevant
No, in either function, LLVM is not able to see that the loop is performing a log/pow and apply the identities: https://godbolt.org/z/6vMsxc9Kh
and potentially even harmful because we introduce more conditional logic to chew through.
They're guarded by is_statically_known so will be ignored if the base is not known at compile-time
No, in either function, LLVM is not able to see that the loop is performing a log/pow and apply the identities: https://godbolt.org/z/6vMsxc9Kh
...then I'm kinda surprised! Nice catch.
does this affect the codegen in practical circumstances?
Would be good to have codegen tests to demonstrate what this is doing -- especially since that way there's a way for people to try removing the special cases later if they think that LLVM no longer needs them.
thanks for the codegen tests!
@rustbot ready
@scottmcm ping?
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.
Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.
The job pr-check-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] std test:true 99.755
error: cannot test inner items
--> library/coretests/tests/num/uint_macros.rs:314:17
|
1 | / macro_rules! uint_module {
2 | | ($T:ident) => {
3 | | use core::num::ParseIntError;
4 | | use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
... |
314 | | #[test]
| | ^^^^^^^ in this attribute macro expansion (#2)
... |
626 | | };
---
| -------------- in this expansion of `#[test]` (#2)
|
::: library/coretests/tests/num/u128.rs:1:1
|
1 | uint_module!(u128);
| ------------------ in this macro invocation (#1)
|
= note: `-D unnameable-test-items` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(unnameable_test_items)]`
error: cannot test inner items
--> library/coretests/tests/num/uint_macros.rs:314:17
|
1 | / macro_rules! uint_module {
2 | | ($T:ident) => {
3 | | use core::num::ParseIntError;
4 | | use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
... |
314 | | #[test]
| | ^^^^^^^ in this attribute macro expansion (#2)
... |
626 | | };
---
| -------------- in this expansion of `#[test]` (#2)
|
::: library/coretests/tests/num/u128.rs:1:1
|
1 | uint_module!(u128);
| ------------------ in this macro invocation (#1)
error: cannot test inner items
--> library/coretests/tests/num/uint_macros.rs:314:17
|
1 | / macro_rules! uint_module {
2 | | ($T:ident) => {
3 | | use core::num::ParseIntError;
4 | | use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
... |
314 | | #[test]
| | ^^^^^^^ in this attribute macro expansion (#2)
... |
626 | | };
---
| -------------- in this expansion of `#[test]` (#2)
|
::: library/coretests/tests/num/u16.rs:1:1
|
1 | uint_module!(u16);
| ----------------- in this macro invocation (#1)
error: cannot test inner items
--> library/coretests/tests/num/uint_macros.rs:314:17
|
1 | / macro_rules! uint_module {
2 | | ($T:ident) => {
3 | | use core::num::ParseIntError;
4 | | use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
... |
314 | | #[test]
| | ^^^^^^^ in this attribute macro expansion (#2)
... |
626 | | };
---
| -------------- in this expansion of `#[test]` (#2)
|
::: library/coretests/tests/num/u32.rs:1:1
|
1 | uint_module!(u32);
| ----------------- in this macro invocation (#1)
error: cannot test inner items
--> library/coretests/tests/num/uint_macros.rs:314:17
|
1 | / macro_rules! uint_module {
2 | | ($T:ident) => {
3 | | use core::num::ParseIntError;
4 | | use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
... |
314 | | #[test]
| | ^^^^^^^ in this attribute macro expansion (#2)
... |
626 | | };
---
| -------------- in this expansion of `#[test]` (#2)
|
::: library/coretests/tests/num/u64.rs:1:1
|
1 | uint_module!(u64);
| ----------------- in this macro invocation (#1)
error: cannot test inner items
--> library/coretests/tests/num/uint_macros.rs:314:17
|
1 | / macro_rules! uint_module {
2 | | ($T:ident) => {
3 | | use core::num::ParseIntError;
4 | | use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
... |
314 | | #[test]
| | ^^^^^^^ in this attribute macro expansion (#2)
... |
626 | | };
---
| -------------- in this expansion of `#[test]` (#2)
|
::: library/coretests/tests/num/u8.rs:1:1
|
1 | uint_module!(u8);
| ---------------- in this macro invocation (#1)
[RUSTC-TIMING] sync test:true 43.836
error: function `test_pow_overflow` is never used
--> library/coretests/tests/num/uint_macros.rs:316:20
|
1 | / macro_rules! uint_module {
2 | | ($T:ident) => {
3 | | use core::num::ParseIntError;
4 | | use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
... |
316 | | fn test_pow_overflow() {
| | ^^^^^^^^^^^^^^^^^
... |
626 | | };
627 | | }
| |_- in this expansion of `uint_module!`
|
::: library/coretests/tests/num/u128.rs:1:1
|
1 | uint_module!(u128);
| ------------------ in this macro invocation
|
= note: `-D dead-code` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(dead_code)]`
error: function `test_pow_overflow` is never used
--> library/coretests/tests/num/uint_macros.rs:316:20
|
1 | / macro_rules! uint_module {
2 | | ($T:ident) => {
3 | | use core::num::ParseIntError;
4 | | use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
... |
316 | | fn test_pow_overflow() {
| | ^^^^^^^^^^^^^^^^^
... |
626 | | };
627 | | }
| |_- in this expansion of `uint_module!`
|
::: library/coretests/tests/num/u16.rs:1:1
|
1 | uint_module!(u16);
| ----------------- in this macro invocation
error: function `test_pow_overflow` is never used
--> library/coretests/tests/num/uint_macros.rs:316:20
|
1 | / macro_rules! uint_module {
2 | | ($T:ident) => {
3 | | use core::num::ParseIntError;
4 | | use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
... |
316 | | fn test_pow_overflow() {
| | ^^^^^^^^^^^^^^^^^
... |
626 | | };
627 | | }
| |_- in this expansion of `uint_module!`
|
::: library/coretests/tests/num/u32.rs:1:1
|
1 | uint_module!(u32);
| ----------------- in this macro invocation
error: function `test_pow_overflow` is never used
--> library/coretests/tests/num/uint_macros.rs:316:20
|
1 | / macro_rules! uint_module {
2 | | ($T:ident) => {
3 | | use core::num::ParseIntError;
4 | | use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
... |
316 | | fn test_pow_overflow() {
| | ^^^^^^^^^^^^^^^^^
... |
626 | | };
627 | | }
| |_- in this expansion of `uint_module!`
|
::: library/coretests/tests/num/u64.rs:1:1
|
1 | uint_module!(u64);
| ----------------- in this macro invocation
error: function `test_pow_overflow` is never used
--> library/coretests/tests/num/uint_macros.rs:316:20
|
1 | / macro_rules! uint_module {
2 | | ($T:ident) => {
3 | | use core::num::ParseIntError;
4 | | use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
... |
316 | | fn test_pow_overflow() {
| | ^^^^^^^^^^^^^^^^^
... |
626 | | };
627 | | }
| |_- in this expansion of `uint_module!`
|
::: library/coretests/tests/num/u8.rs:1:1
|
1 | uint_module!(u8);
| ---------------- in this macro invocation
[RUSTC-TIMING] alloctests test:true 104.670
[RUSTC-TIMING] coretests test:true 85.406
error: could not compile `coretests` (test "coretests") due to 15 previous errors
The job x86_64-gnu-gcc failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
For more information how to resolve CI failures of this job, visit this link.
@scottmcm ping?
Reminder, once the PR becomes ready for a review, use @rustbot ready.
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.
Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.
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)
num::u8::strict_pow
test result: FAILED. 2253 passed; 10 failed; 6 ignored; 0 measured; 0 filtered out; finished in 3.73s
error: test failed, to rerun pass `-p coretests --test coretests`
env -u RUSTC_WRAPPER CARGO_ENCODED_RUSTDOCFLAGS="-Csymbol-mangling-version=v0\u{1f}-Zannotate-moves\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(b37825bd9\t2025-11-22)" CARGO_ENCODED_RUSTFLAGS="-Csymbol-mangling-version=v0\u{1f}-Zannotate-moves\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:3723:25
Executed at: src/bootstrap/src/core/build_steps/test.rs:3768:26
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:28:00
local time: Sat Nov 22 02:04:58 UTC 2025
network time: Sat, 22 Nov 2025 02:04:59 GMT
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"
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)
num::u8::strict_pow
test result: FAILED. 2253 passed; 10 failed; 6 ignored; 0 measured; 0 filtered out; finished in 3.57s
error: test failed, to rerun pass `-p coretests --test coretests`
env -u RUSTC_WRAPPER CARGO_ENCODED_RUSTDOCFLAGS="-Csymbol-mangling-version=v0\u{1f}-Zannotate-moves\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(1b0799f26\t2025-11-22)" CARGO_ENCODED_RUSTFLAGS="-Csymbol-mangling-version=v0\u{1f}-Zannotate-moves\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:3723:25
Executed at: src/bootstrap/src/core/build_steps/test.rs:3768:26
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:21:42
local time: Sat Nov 22 03:50:37 UTC 2025
network time: Sat, 22 Nov 2025 03:50:38 GMT
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"
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)
num::u8::panicking_pow
test result: FAILED. 2253 passed; 5 failed; 6 ignored; 0 measured; 0 filtered out; finished in 2.99s
error: test failed, to rerun pass `-p coretests --test coretests`
env -u RUSTC_WRAPPER CARGO_ENCODED_RUSTDOCFLAGS="-Csymbol-mangling-version=v0\u{1f}-Zannotate-moves\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(739c484aa\t2025-11-23)" CARGO_ENCODED_RUSTFLAGS="-Csymbol-mangling-version=v0\u{1f}-Zannotate-moves\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))
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:3723:25
Executed at: src/bootstrap/src/core/build_steps/test.rs:3768:26
Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `--stage 2 test --skip tests --skip coverage-map --skip coverage-run --skip library --skip tidyselftest`
Build completed unsuccessfully in 0:22:50
local time: Sun Nov 23 18:01:23 UTC 2025
network time: Sun, 23 Nov 2025 18:01:23 GMT
##[error]Process completed with exit code 1.
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.
Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.
The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
failures:
---- [ui] tests/ui/numbers-arithmetic/overflowing-pow-unsigned.rs stdout ----
error: error pattern 'attempt to (multiply|shift left) with overflow' not found!
status: exit status: 101
command: cd "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/numbers-arithmetic/overflowing-pow-unsigned" && RUSTC="/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" RUST_TEST_THREADS="4" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/numbers-arithmetic/overflowing-pow-unsigned/a"
stdout: none
--- stderr -------------------------------
@rustbot ready