Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ice: assertion failed: promoted.is_none() || Q::ALLOW_PROMOTED' #114179

Closed
matthiaskrgr opened this issue Jul 28, 2023 · 2 comments
Closed

ice: assertion failed: promoted.is_none() || Q::ALLOW_PROMOTED' #114179

matthiaskrgr opened this issue Jul 28, 2023 · 2 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jul 28, 2023

Code

~/.rustup/toolchains/317ec04d18ab9c5d09a4d9b4418a12da8974b961/bin/rustc ./tests/ui/consts/precise-drop-with-promoted.rs --crate-type lib

// Regression test for issue #89938.
// check-pass
// compile-flags: --crate-type=lib
#![feature(const_precise_live_drops)]

pub const fn f() {
    let _: Option<String> = None;
    let _: &'static Option<String> = &None;
}
Backtrace

thread 'rustc' panicked at 'assertion failed: promoted.is_none() || Q::ALLOW_PROMOTED', compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs:370:9
stack backtrace:
   0:     0x7f95ed962fc1 - std::backtrace_rs::backtrace::libunwind::trace::h59991b981c5287c1
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f95ed962fc1 - std::backtrace_rs::backtrace::trace_unsynchronized::hb8ad91f071341da2
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f95ed962fc1 - std::sys_common::backtrace::_print_fmt::h42309d0372aa0305
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f95ed962fc1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he508018a1d2558c5
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f95ed9c949c - core::fmt::rt::Argument::fmt::h974de3f325024a6a
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/core/src/fmt/rt.rs:138:9
   5:     0x7f95ed9c949c - core::fmt::write::h6568507fd6fbd8e7
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f95ed9557ae - std::io::Write::write_fmt::hb0e531fb021517a1
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/std/src/io/mod.rs:1714:15
   7:     0x7f95ed962dd5 - std::sys_common::backtrace::_print::h64513e567ed012df
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f95ed962dd5 - std::sys_common::backtrace::print::hb570de3a5eabf190
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f95ed965e2a - std::panicking::panic_hook_with_disk_dump::{{closure}}::h9a144349d0daca0a
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/std/src/panicking.rs:278:22
  10:     0x7f95ed965ac3 - std::panicking::panic_hook_with_disk_dump::h4953ecb0a9225883
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/std/src/panicking.rs:312:9
  11:     0x7f95f0c0a349 - <rustc_driver_impl[5794e20b60233f09]::install_ice_hook::{closure#0} as core[c77199ccfcb9e47a]::ops::function::FnOnce<(&core[c77199ccfcb9e47a]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7f95ed9666d0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h49f5b2a64dbc47c1
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/alloc/src/boxed.rs:2021:9
  13:     0x7f95ed9666d0 - std::panicking::rust_panic_with_hook::he2dec82ec7ad641b
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/std/src/panicking.rs:733:13
  14:     0x7f95ed966411 - std::panicking::begin_panic_handler::{{closure}}::h1648ef9af5900638
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/std/src/panicking.rs:619:13
  15:     0x7f95ed963426 - std::sys_common::backtrace::__rust_end_short_backtrace::h9650ffdb0776cb74
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/std/src/sys_common/backtrace.rs:151:18
  16:     0x7f95ed9661a2 - rust_begin_unwind
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/std/src/panicking.rs:617:5
  17:     0x7f95ed9c5853 - core::panicking::panic_fmt::ha90f78f5cebcb87c
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/core/src/panicking.rs:67:14
  18:     0x7f95ed9c58e3 - core::panicking::panic::h00d22fc62b66689d
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/core/src/panicking.rs:117:5
  19:     0x7f95efda0ed9 - rustc_const_eval[ebb36ce959869d78]::transform::check_consts::qualifs::in_operand::<rustc_const_eval[ebb36ce959869d78]::transform::check_consts::qualifs::NeedsDrop, <rustc_const_eval[ebb36ce959869d78]::transform::check_consts::resolver::TransferFunction<rustc_const_eval[ebb36ce959869d78]::transform::check_consts::qualifs::NeedsDrop> as rustc_middle[cfff05fcf76cc9ce]::mir::visit::Visitor>::visit_assign::{closure#0}>
  20:     0x7f95efd9c6d6 - <rustc_const_eval[ebb36ce959869d78]::transform::check_consts::resolver::FlowSensitiveAnalysis<rustc_const_eval[ebb36ce959869d78]::transform::check_consts::qualifs::NeedsDrop> as rustc_mir_dataflow[2d44b638fe982fc7]::framework::Analysis>::apply_statement_effect
  21:     0x7f95efd927f3 - <rustc_const_eval[ebb36ce959869d78]::transform::check_consts::check::Qualifs>::needs_drop
  22:     0x7f95f0bdbd1d - <rustc_const_eval[ebb36ce959869d78]::transform::check_consts::post_drop_elaboration::CheckLiveDrops as rustc_middle[cfff05fcf76cc9ce]::mir::visit::Visitor>::visit_terminator
  23:     0x7f95f0bdb813 - rustc_const_eval[ebb36ce959869d78]::transform::check_consts::post_drop_elaboration::check_live_drops
  24:     0x7f95ef377ff0 - rustc_mir_transform[31f447ec97da68c4]::mir_drops_elaborated_and_const_checked
  25:     0x7f95eec5e98e - rustc_query_impl[fb60eba705f21227]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fb60eba705f21227]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cfff05fcf76cc9ce]::query::erase::Erased<[u8; 8usize]>>
  26:     0x7f95eec5e95e - <rustc_query_impl[fb60eba705f21227]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2} as core[c77199ccfcb9e47a]::ops::function::FnOnce<(rustc_middle[cfff05fcf76cc9ce]::ty::context::TyCtxt, rustc_span[471984cae341c897]::def_id::LocalDefId)>>::call_once
  27:     0x7f95eed9e34d - rustc_query_system[bb6b3584dde46c05]::query::plumbing::try_execute_query::<rustc_query_impl[fb60eba705f21227]::DynamicConfig<rustc_query_system[bb6b3584dde46c05]::query::caches::VecCache<rustc_span[471984cae341c897]::def_id::LocalDefId, rustc_middle[cfff05fcf76cc9ce]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[fb60eba705f21227]::plumbing::QueryCtxt, false>
  28:     0x7f95f0569bef - rustc_query_impl[fb60eba705f21227]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7f95f00a2e54 - <rustc_session[f5739c170fbc16da]::session::Session>::time::<(), rustc_interface[9ab7ff69e90a1b39]::passes::analysis::{closure#2}>
  30:     0x7f95f009fbe5 - rustc_interface[9ab7ff69e90a1b39]::passes::analysis
  31:     0x7f95f01058da - rustc_query_impl[fb60eba705f21227]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fb60eba705f21227]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cfff05fcf76cc9ce]::query::erase::Erased<[u8; 1usize]>>
  32:     0x7f95f01058c9 - <rustc_query_impl[fb60eba705f21227]::query_impl::analysis::dynamic_query::{closure#2} as core[c77199ccfcb9e47a]::ops::function::FnOnce<(rustc_middle[cfff05fcf76cc9ce]::ty::context::TyCtxt, ())>>::call_once
  33:     0x7f95f02ae3d8 - rustc_query_system[bb6b3584dde46c05]::query::plumbing::try_execute_query::<rustc_query_impl[fb60eba705f21227]::DynamicConfig<rustc_query_system[bb6b3584dde46c05]::query::caches::SingleCache<rustc_middle[cfff05fcf76cc9ce]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[fb60eba705f21227]::plumbing::QueryCtxt, false>
  34:     0x7f95f02ae167 - rustc_query_impl[fb60eba705f21227]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7f95efe236e5 - <rustc_middle[cfff05fcf76cc9ce]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[5794e20b60233f09]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[c77199ccfcb9e47a]::result::Result<(), rustc_span[471984cae341c897]::ErrorGuaranteed>>
  36:     0x7f95efe22d12 - <rustc_interface[9ab7ff69e90a1b39]::interface::Compiler>::enter::<rustc_driver_impl[5794e20b60233f09]::run_compiler::{closure#1}::{closure#2}, core[c77199ccfcb9e47a]::result::Result<core[c77199ccfcb9e47a]::option::Option<rustc_interface[9ab7ff69e90a1b39]::queries::Linker>, rustc_span[471984cae341c897]::ErrorGuaranteed>>
  37:     0x7f95efe1bdc8 - std[41f1c318fc4ca9f3]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[9ab7ff69e90a1b39]::util::run_in_thread_pool_with_globals<rustc_interface[9ab7ff69e90a1b39]::interface::run_compiler<core[c77199ccfcb9e47a]::result::Result<(), rustc_span[471984cae341c897]::ErrorGuaranteed>, rustc_driver_impl[5794e20b60233f09]::run_compiler::{closure#1}>::{closure#0}, core[c77199ccfcb9e47a]::result::Result<(), rustc_span[471984cae341c897]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c77199ccfcb9e47a]::result::Result<(), rustc_span[471984cae341c897]::ErrorGuaranteed>>
  38:     0x7f95efe1b54e - <<std[41f1c318fc4ca9f3]::thread::Builder>::spawn_unchecked_<rustc_interface[9ab7ff69e90a1b39]::util::run_in_thread_pool_with_globals<rustc_interface[9ab7ff69e90a1b39]::interface::run_compiler<core[c77199ccfcb9e47a]::result::Result<(), rustc_span[471984cae341c897]::ErrorGuaranteed>, rustc_driver_impl[5794e20b60233f09]::run_compiler::{closure#1}>::{closure#0}, core[c77199ccfcb9e47a]::result::Result<(), rustc_span[471984cae341c897]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c77199ccfcb9e47a]::result::Result<(), rustc_span[471984cae341c897]::ErrorGuaranteed>>::{closure#1} as core[c77199ccfcb9e47a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:     0x7f95ed970dc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6d36b437bd2c3626
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/alloc/src/boxed.rs:2007:9
  40:     0x7f95ed970dc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h72c892e089db1d9f
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/alloc/src/boxed.rs:2007:9
  41:     0x7f95ed970dc5 - std::sys::unix::thread::Thread::new::thread_start::he096636bb1958c5f
                               at /rustc/317ec04d18ab9c5d09a4d9b4418a12da8974b961/library/std/src/sys/unix/thread.rs:108:17
  42:     0x7f95ed70244b - <unknown>
  43:     0x7f95ed785e40 - <unknown>
  44:                0x0 - <unknown>

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 attach the file at `/home/matthias/vcs/github/rust/rustc-ice-2023-07-28T17:24:51.673713381Z-3672316.txt` to your bug report

note: compiler flags: --crate-type lib

query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `f`
#1 [analysis] running analysis passes on this crate
end of query stack

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. labels Jul 28, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 28, 2023
@matthiaskrgr
Copy link
Member Author

Regression in aafd75a #114134 cc @fee1-dead

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 29, 2023
@fee1-dead
Copy link
Member

#114134 has marked this as a known-bug already. Closing as duplicate of #110395.

@fee1-dead fee1-dead closed this as not planned Won't fix, can't repro, duplicate, stale Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants