- Notifications
You must be signed in to change notification settings - Fork 14k
Description
Code
Pretty much any Rust code that isn't an empty fn main() {}. For example, tests/ui/traits/map-types.rs:
use std::collections::HashMap; trait Map<K, V> { fn get(&self, k: K) -> V { panic!() } } impl<K, V> Map<K, V> for HashMap<K, V> {} // Test that trait types printed in error msgs include the type arguments. fn main() { let x: Box<HashMap<isize, isize>> = HashMap::new().into(); let x: Box<dyn Map<isize, isize>> = x; let y: Box<dyn Map<usize, isize>> = Box::new(x); //~^ ERROR `Box<dyn Map<isize, isize>>: Map<usize, isize>` is not satisfied }Meta
rustc --version --verbose:
rustc 1.89.0-dev binary: rustc commit-hash: unknown commit-date: unknown host: powerpc64-unknown-linux-musl release: 1.89.0-dev LLVM version: 20.1.5 Error output
thread 'rustc' panicked at /usr/lib/rustlib/src/rust/library/core/src/panicking.rs:226:5: unsafe precondition(s) violated: slice::from_raw_parts_mut requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX` This indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety. Backtrace
stack backtrace: 0: 0x3998da863028 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h6b7a16c5580db569 1: 0x3998da8c49e8 - core::fmt::write::h412196edc8a0bac6 2: 0x3998da852710 - std::io::Write::write_fmt::h601d56a19420a788 3: 0x3998da862ea0 - std::sys::backtrace::BacktraceLock::print::h17bff0d3f977264e 4: 0x3998da867bf8 - std::panicking::default_hook::{{closure}}::ha5fc841ae5cd04eb 5: 0x3998da867884 - std::panicking::default_hook::h87486f900b0501f7 6: 0x3998d58bedfc - <std[907ab836018c748a]::panicking::default_hook as core[a1430d4ba98a45c9]::ops::function::Fn<(&std[907ab836018c748a]::panic::PanicHookInfo,)>>::call at /usr/lib/rustlib/src/rust/library/core/src/ops/function.rs:79:5 7: 0x3998d58d363c - <alloc[8a3938205d7c8a1c]::boxed::Box<dyn for<'a, 'b> core[a1430d4ba98a45c9]::ops::function::Fn<(&'a std[907ab836018c748a]::panic::PanicHookInfo<'b>,), Output = ()> + core[a1430d4ba98a45c9]::marker::Send + core[a1430d4ba98a45c9]::marker::Sync> as core[a1430d4ba98a45c9]::ops::function::Fn<(&std[907ab836018c748a]::panic::PanicHookInfo,)>>::call at /usr/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1980:9 8: 0x3998d58d372c - {closure#1} at /home/adrian/rust/compiler/rustc_driver_impl/src/lib.rs:1362:17 9: 0x3998d58d372c - call<(&(dyn core::ops::function::Fn<(&std::panic::PanicHookInfo), Output=()> + core::marker::Send + core::marker::Sync), &std::panic::PanicHookInfo), rustc_driver_impl::install_ice_hook::{closure_env#1}, alloc::alloc::Global> at /usr/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1980:9 10: 0x3998d58bebcc - std[907ab836018c748a]::panicking::update_hook::<alloc[8a3938205d7c8a1c]::boxed::Box<rustc_driver_impl[3cb4f2869d0b6653]::install_ice_hook::{closure#1}>>::{closure#0} at /usr/lib/rustlib/src/rust/library/std/src/panicking.rs:243:47 11: 0x3998da868d38 - std::panicking::rust_panic_with_hook::h01dad58d372d72b9 12: 0x3998da86875c - std::panicking::begin_panic_handler::{{closure}}::h0921d5db50e2f3db 13: 0x3998da8636dc - std::sys::backtrace::__rust_end_short_backtrace::h2a52412d337f6395 14: 0x3998da868200 - __rustc[820ce06c06146c08]::rust_begin_unwind 15: 0x3998da8bf4e4 - core::panicking::panic_nounwind_fmt::hea1385ba292cdf61 16: 0x3998da8bf5c4 - core::panicking::panic_nounwind::h910baf6dda7e5e34 17: 0x3998da6aee7c - precondition_check at /usr/lib/rustlib/src/rust/library/core/src/ub_checks.rs:68:21 18: 0x3998da6aee7c - from_raw_parts_mut<alloc::boxed::Box<rustc_ast::ast::Item<rustc_ast::ast::ItemKind>, alloc::alloc::Global>> at /usr/lib/rustlib/src/rust/library/core/src/ub_checks.rs:75:17 19: 0x3998da6aee7c - as_mut_slice<alloc::boxed::Box<rustc_ast::ast::Item<rustc_ast::ast::ItemKind>, alloc::alloc::Global>> at /home/adrian/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/thin-vec-0.2.14/src/lib.rs:1047:18 20: 0x3998da6aee7c - deref_mut<alloc::boxed::Box<rustc_ast::ast::Item<rustc_ast::ast::ItemKind>, alloc::alloc::Global>> at /home/adrian/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/thin-vec-0.2.14/src/lib.rs:1711:9 21: 0x3998da6aee7c - drop_non_singleton<alloc::boxed::Box<rustc_ast::ast::Item<rustc_ast::ast::ItemKind>, alloc::alloc::Global>> at /home/adrian/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/thin-vec-0.2.14/src/lib.rs:1684:41 22: 0x3998d588c7cc - drop<alloc::boxed::Box<rustc_ast::ast::Item<rustc_ast::ast::ItemKind>, alloc::alloc::Global>> at /home/adrian/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/thin-vec-0.2.14/src/lib.rs:1696:13 23: 0x3998d588c7cc - drop_in_place<thin_vec::ThinVec<alloc::boxed::Box<rustc_ast::ast::Item<rustc_ast::ast::ItemKind>, alloc::alloc::Global>>> at /usr/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524:1 24: 0x3998d588c7cc - drop_in_place<rustc_ast::ast::Crate> at /usr/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524:1 25: 0x3998d58c5d80 - drop_in_place<rustc_interface::passes::create_and_enter_global_ctxt::{closure#2}::{closure_env#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>> at /usr/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524:1 26: 0x3998d58c5060 - enter<rustc_interface::passes::create_and_enter_global_ctxt::{closure#2}::{closure_env#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>, core::option::Option<rustc_interface::queries::Linker>> at /home/adrian/rust/compiler/rustc_middle/src/ty/context.rs:1497:5 27: 0x3998d58c5060 - create_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt::{closure#2}::{closure_env#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>> at /home/adrian/rust/compiler/rustc_middle/src/ty/context.rs:1717:9 28: 0x3998d581aaf4 - {closure#2}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}> at /home/adrian/rust/compiler/rustc_interface/src/passes.rs:873:9 29: 0x3998d581aaf4 - call_once<rustc_interface::passes::create_and_enter_global_ctxt::{closure_env#2}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>, (&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy, alloc::alloc::Global>, &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_env#2})> at /usr/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5 30: 0x3998d58d2f90 - call_once<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy, alloc::alloc::Global>, &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_env#2}), dyn core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy, alloc::alloc::Global>, &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_env#2}), Output=core::option::Option<rustc_interface::queries::Linker>>, alloc::alloc::Global> at /usr/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1966:9 31: 0x3998d58195f4 - create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}> at /home/adrian/rust/compiler/rustc_interface/src/passes.rs:914:5 32: 0x3998d581896c - {closure#0} at /home/adrian/rust/compiler/rustc_driver_impl/src/lib.rs:338:22 33: 0x3998d581896c - {closure#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}> at /home/adrian/rust/compiler/rustc_interface/src/interface.rs:526:80 34: 0x3998d581896c - call_once<(), rustc_interface::interface::run_compiler::{closure#1}::{closure_env#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}>> at /usr/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9 35: 0x3998d581896c - do_call<core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler::{closure#1}::{closure_env#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}>>, ()> at /usr/lib/rustlib/src/rust/library/std/src/panicking.rs:589:40 36: 0x3998d581896c - try<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler::{closure#1}::{closure_env#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}>>> at /usr/lib/rustlib/src/rust/library/std/src/panicking.rs:552:19 37: 0x3998d581896c - catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler::{closure#1}::{closure_env#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}>>, ()> at /usr/lib/rustlib/src/rust/library/std/src/panic.rs:359:14 38: 0x3998d5815778 - {closure#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}> at /home/adrian/rust/compiler/rustc_interface/src/interface.rs:526:23 39: 0x3998d5815778 - {closure#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()> at /home/adrian/rust/compiler/rustc_interface/src/util.rs:199:17 40: 0x3998d5815778 - {closure#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()> at /home/adrian/rust/compiler/rustc_interface/src/util.rs:153:24 41: 0x3998d5815778 - set<rustc_span::SessionGlobals, rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()> at /home/adrian/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/scoped-tls-1.0.1/src/lib.rs:137:9 42: 0x3998d58fe9a4 - create_session_globals_then<(), rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>> at /home/adrian/rust/compiler/rustc_span/src/lib.rs:144:5 43: 0x3998d58f5b10 - {closure#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()> at /home/adrian/rust/compiler/rustc_interface/src/util.rs:149:17 44: 0x3998d58f5b10 - __rust_begin_short_backtrace<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()> at /usr/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:152:18 45: 0x3998d58f4cc0 - {closure#0}<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()> at /usr/lib/rustlib/src/rust/library/std/src/thread/mod.rs:559:17 46: 0x3998d58f4cc0 - call_once<(), std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>> at /usr/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9 47: 0x3998d58f4cc0 - do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>>, ()> at /usr/lib/rustlib/src/rust/library/std/src/panicking.rs:589:40 48: 0x3998d58f4cc0 - try<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>>> at /usr/lib/rustlib/src/rust/library/std/src/panicking.rs:552:19 49: 0x3998d58f4cc0 - catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>>, ()> at /usr/lib/rustlib/src/rust/library/std/src/panic.rs:359:14 50: 0x3998d58f4cc0 - {closure#1}<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()> at /usr/lib/rustlib/src/rust/library/std/src/thread/mod.rs:557:30 51: 0x3998d58f4cc0 - call_once<std::thread::{impl#0}::spawn_unchecked_::{closure_env#1}<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>, ()> at /usr/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5 52: 0x3998da86c670 - std::sys::pal::unix::thread::Thread::new::thread_start::h62bfbd8292ec418b error: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md note: please make sure that you have updated to the latest nightly note: please attach the file at `/home/adrian/rust/rustc-ice-2025-06-10T23_26_31-12576.txt` to your bug report note: compiler flags: -C target-feature=-crt-static I encountered this when running the testsuite natively, weirdly enough my stage0 compiler (rustc 1.88.0-nightly (d6a325d93 2025-05-03), cross compiled from x86_64 and dynamically linked) never crashes, but the natively compiled stage1 does. I immediately thought this may be an allocator issue, since my musl libc is patched to use mimalloc, but nope, mallocng (aka unmodified, "stock" musl malloc) musl also crashes.
The crash manifests in every couple of invocations - it sometimes compiles just fine, other times it will trigger the unsafe precondition evaluation, other times it will exit with SIGSEGV and no error message.
I'll try some older versions to see if this was a recent regression.
Things I tested so far: beta branch - also occurs