Repository navigation
Constant is being evaluated despite failing const_precise_live_drops #163973
Copy link
Copy link
Open
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Activity
- addedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Oct 8, 2026 Oh I think we never made const_precise_live_drops taint the MIR
- addedE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.Category: This is a bug.and removedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Oct 8, 2026 @rustbot claim
Hi @RalfJung I'd be happy to work on this :)
That's great! But I just reported the issue, that doesn't mean I have the time or knowledge to mentor someone for how to fix it. Please be mindful when pinging people, don't just ping random folks that show up in the issue.
In this case @oli-obk added the E-mentor label so it looks like he may have the capacity to mentor this.
Reacted by Marton Moro- added 5 commits that reference this issue
on Oct 9, 2026 - added a commit that references this issue
on Oct 9, 2026 - addedI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
on Oct 10, 2026 error[E0493]: destructor of `Option<NotConstDestruct>` cannot be evaluated at compile-time --> crsh.rs:11:9 | 11 | let mut x = None; | ^^^^^ the destructor for this type cannot be evaluated in constants ... 17 | }; | - value is dropped here error: internal compiler error: /rustc-dev/32dba69d69c5b10ea89a4042de8d0619f7756203/compiler/rustc_const_eval/src/const_eval/machine.rs:460:21: calling non-const function `<NotConstDestruct as Drop>::drop` --> /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:848:1 | 848 | / pub(crate) const unsafe fn drop_glue<T: PointeeSized>(_: &mut T) 849 | | where 850 | | T: [const] Destruct, | |________________________^ thread 'rustc' (1723946) panicked at /rustc-dev/32dba69d69c5b10ea89a4042de8d0619f7756203/compiler/rustc_const_eval/src/const_eval/machine.rs:460:21: Box<dyn Any> stack backtrace: 0: 0x7f8aa601cee6 - <<std[b76485d3782cc82]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[a3d7fcd5cfdd2c51]::fmt::Display>::fmt 1: 0x7f8aa6606ddf - core[a3d7fcd5cfdd2c51]::fmt::write 2: 0x7f8aa60334cc - <std[b76485d3782cc82]::sys::stdio::unix::Stderr as core[a3d7fcd5cfdd2c51]::io::write::Write>::write_fmt 3: 0x7f8aa5fee1aa - std[b76485d3782cc82]::panicking::default_hook::{closure#0} 4: 0x7f8aa6010723 - std[b76485d3782cc82]::panicking::default_hook 5: 0x7f8aa4d80775 - std[b76485d3782cc82]::panicking::update_hook::<alloc[8104f853b11633b9]::boxed::Box<rustc_driver_impl[50c5c3a0f8569617]::install_ice_hook::{closure#1}>>::{closure#0} 6: 0x7f8aa6010bc2 - std[b76485d3782cc82]::panicking::panic_with_hook 7: 0x7f8aa5b9870a - std[b76485d3782cc82]::panicking::begin_panic::<rustc_span[ebedf997a91a4466]::macros::ExplicitBug>::{closure#0} 8: 0x7f8aa5b97226 - std[b76485d3782cc82]::sys::backtrace::__rust_end_short_backtrace::<std[b76485d3782cc82]::panicking::begin_panic<rustc_span[ebedf997a91a4466]::macros::ExplicitBug>::{closure#0}, !> 9: 0x7f8aa5b969cc - std[b76485d3782cc82]::panicking::begin_panic::<rustc_span[ebedf997a91a4466]::macros::ExplicitBug> 10: 0x7f8aa2043c71 - rustc_span[ebedf997a91a4466]::macros::bug_impl 11: 0x7f8aa7477a5c - <rustc_const_eval[6709b28d84b25c8d]::const_eval::machine::CompileTimeMachine as rustc_const_eval[6709b28d84b25c8d]::interpret::machine::Machine>::find_mir_or_eval_fn 12: 0x7f8aa747b8ab - <rustc_const_eval[6709b28d84b25c8d]::interpret::eval_context::InterpCx<rustc_const_eval[6709b28d84b25c8d]::const_eval::machine::CompileTimeMachine>>::init_fn_call 13: 0x7f8aa4072233 - rustc_const_eval[6709b28d84b25c8d]::const_eval::eval_queries::eval_to_allocation_raw_provider 14: 0x7f8aa6636f16 - rustc_query_impl[fa78e9cdac69778c]::query_vtables::eval_to_allocation_raw::invoke_provider_fn::__rust_begin_short_backtrace 15: 0x7f8aa77d2043 - rustc_query_impl[fa78e9cdac69778c]::execution::try_execute_query::<rustc_middle[5a5db90388d4e3c4]::query::caches::DefaultCache<rustc_middle[5a5db90388d4e3c4]::ty::PseudoCanonicalInput<rustc_middle[5a5db90388d4e3c4]::mir::interpret::GlobalId>, rustc_middle[5a5db90388d4e3c4]::query::erase::ErasedData<[u8; 24usize]>>, false> 16: 0x7f8aa77d15a7 - rustc_query_impl[fa78e9cdac69778c]::query_vtables::eval_to_allocation_raw::execute_query_non_incr::__rust_end_short_backtrace 17: 0x7f8aa77d4735 - rustc_const_eval[6709b28d84b25c8d]::const_eval::eval_queries::eval_to_const_value_raw_provider 18: 0x7f8aa77d43ac - rustc_query_impl[fa78e9cdac69778c]::query_vtables::eval_to_const_value_raw::invoke_provider_fn::__rust_begin_short_backtrace 19: 0x7f8aa77d1a49 - rustc_query_impl[fa78e9cdac69778c]::execution::try_execute_query::<rustc_middle[5a5db90388d4e3c4]::query::caches::DefaultCache<rustc_middle[5a5db90388d4e3c4]::ty::PseudoCanonicalInput<rustc_middle[5a5db90388d4e3c4]::mir::interpret::GlobalId>, rustc_middle[5a5db90388d4e3c4]::query::erase::ErasedData<[u8; 24usize]>>, false> 20: 0x7f8aa77d15ed - rustc_query_impl[fa78e9cdac69778c]::query_vtables::eval_to_const_value_raw::execute_query_non_incr::__rust_end_short_backtrace 21: 0x7f8aa77d526a - rustc_const_eval[6709b28d84b25c8d]::const_eval::eval_queries::eval_to_const_value_raw_provider 22: 0x7f8aa77d43ac - rustc_query_impl[fa78e9cdac69778c]::query_vtables::eval_to_const_value_raw::invoke_provider_fn::__rust_begin_short_backtrace 23: 0x7f8aa77d1a49 - rustc_query_impl[fa78e9cdac69778c]::execution::try_execute_query::<rustc_middle[5a5db90388d4e3c4]::query::caches::DefaultCache<rustc_middle[5a5db90388d4e3c4]::ty::PseudoCanonicalInput<rustc_middle[5a5db90388d4e3c4]::mir::interpret::GlobalId>, rustc_middle[5a5db90388d4e3c4]::query::erase::ErasedData<[u8; 24usize]>>, false> 24: 0x7f8aa77d15ed - rustc_query_impl[fa78e9cdac69778c]::query_vtables::eval_to_const_value_raw::execute_query_non_incr::__rust_end_short_backtrace 25: 0x7f8aa6ca1e96 - <rustc_middle[5a5db90388d4e3c4]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[48ab5c7f3aee4011]::check_crate::{closure#1}>::{closure#0} 26: 0x7f8aa6ca0ea5 - rustc_hir_analysis[48ab5c7f3aee4011]::check_crate 27: 0x7f8aa6c2adb9 - rustc_interface[f1b69b3f87983cd3]::passes::analysis 28: 0x7f8aa7855b47 - rustc_query_impl[fa78e9cdac69778c]::execution::try_execute_query::<rustc_middle[5a5db90388d4e3c4]::query::caches::SingleCache<rustc_middle[5a5db90388d4e3c4]::query::erase::ErasedData<[u8; 0usize]>>, false> 29: 0x7f8aa785592b - rustc_query_impl[fa78e9cdac69778c]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace 30: 0x7f8aa78d890e - rustc_interface[f1b69b3f87983cd3]::interface::run_compiler::<(), rustc_driver_impl[50c5c3a0f8569617]::compiler_entrypoint::{closure#0}>::{closure#2} 31: 0x7f8aa7903f02 - std[b76485d3782cc82]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[f1b69b3f87983cd3]::util::run_in_thread_with_globals<rustc_interface[f1b69b3f87983cd3]::util::run_in_thread_pool_with_globals<rustc_interface[f1b69b3f87983cd3]::interface::run_compiler<(), rustc_driver_impl[50c5c3a0f8569617]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> 32: 0x7f8aa7903cad - <std[b76485d3782cc82]::thread::lifecycle::spawn_unchecked<rustc_interface[f1b69b3f87983cd3]::util::run_in_thread_with_globals<rustc_interface[f1b69b3f87983cd3]::util::run_in_thread_pool_with_globals<rustc_interface[f1b69b3f87983cd3]::interface::run_compiler<(), rustc_driver_impl[50c5c3a0f8569617]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[a3d7fcd5cfdd2c51]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 33: 0x7f8aa790225b - <std[b76485d3782cc82]::sys::thread::unix::Thread>::new::thread_start 34: 0x7f8aa08980a2 - <unknown> 35: 0x7f8aa092080c - <unknown> 36: 0x0 - <unknown> 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 `/tmp/rs/rustc-ice-2026-10-10T21_40_45-1723936.txt` to your bug report note: rustc 1.101.0-nightly (32dba69d6 2026-10-09) running on x86_64-unknown-linux-gnu query stack during panic: #0 [eval_to_allocation_raw] const-evaluating + checking `A1` #1 [eval_to_const_value_raw] simplifying constant for the type system `A1` #2 [eval_to_const_value_raw] simplifying constant for the type system `A1` #3 [analysis] running analysis passes on crate `crsh` end of query stack error: aborting due to 3 previous errors Some errors have detailed explanations: E0493, E0601. For more information about an error, try `rustc --explain E0493`. ``Yes, that's an expected side-effect of #163972.
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
The point of const_precise_live_drops is to ensure that the program can never execute a non-const drop during CTFE. The following code must therefore be rejected:
And it is:
However, for some reason, we are then still executing this code, which obviously cannot work as the destructor is non-const:
That second error should never be reached in normal operation. Apparently we're failing to properly taint this MIR body or so? @oli-obk any idea what is happening here?