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: matches!(diagnostic.level, Error | Warning | Allow) #126751

Open
matthiaskrgr opened this issue Jun 20, 2024 · 5 comments
Open
Assignees
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-lint_reasons `#![feature(lint_reasons)]` 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.

Comments

@matthiaskrgr
Copy link
Member

code:

#![feature(lint_reasons)]
macro_rules! foo {
    ($val:ident) => {
        (5_i32.overflowing_sub(3));
    };
}

fn main() {
    #[expect(semicolon_in_expressions_from_macros)]
    let _ = foo!(x);
}

Version information

rustc 1.81.0-nightly (1ca578e68 2024-06-20)
binary: rustc
commit-hash: 1ca578e68eb715e772fc0c1b9e6ca7c5b122765a
commit-date: 2024-06-20
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(lint_reasons)

Program output

thread 'rustc' panicked at compiler/rustc_errors/src/lib.rs:1462:13:
assertion failed: matches!(diagnostic.level, Error | Warning | Allow)
stack backtrace:
   0:     0x74a1ae426915 - std::backtrace_rs::backtrace::libunwind::trace::h796e75e96c439f3e
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x74a1ae426915 - std::backtrace_rs::backtrace::trace_unsynchronized::h57b5b13bb46e11ba
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x74a1ae426915 - std::sys::backtrace::_print_fmt::h11ce45f986076e87
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/std/src/sys/backtrace.rs:68:5
   3:     0x74a1ae426915 - <std::sys::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hcd09ba6a4fc236f1
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/std/src/sys/backtrace.rs:44:22
   4:     0x74a1ae4774bb - core::fmt::rt::Argument::fmt::h914f09f4a1c58d59
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/core/src/fmt/rt.rs:165:63
   5:     0x74a1ae4774bb - core::fmt::write::hc590b91d463e6a2c
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/core/src/fmt/mod.rs:1168:21
   6:     0x74a1ae41b5af - std::io::Write::write_fmt::hc69b1d0ded026622
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/std/src/io/mod.rs:1835:15
   7:     0x74a1ae4266ee - std::sys::backtrace::_print::hc852e4497da27a95
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/std/src/sys/backtrace.rs:47:5
   8:     0x74a1ae4266ee - std::sys::backtrace::print::hc624de700d5fe576
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/std/src/sys/backtrace.rs:34:9
   9:     0x74a1ae429129 - std::panicking::default_hook::{{closure}}::hf8d8481f1d9702fb
  10:     0x74a1ae428ecc - std::panicking::default_hook::he469b58de751f8ee
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/std/src/panicking.rs:292:9
  11:     0x74a1aab47870 - std[eca1b30e63fdea7a]::panicking::update_hook::<alloc[79c37403ec1ba474]::boxed::Box<rustc_driver_impl[93e75e0175b92285]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x74a1ae429a4f - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7fb9108d23a6d563
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/alloc/src/boxed.rs:2076:9
  13:     0x74a1ae429a4f - std::panicking::rust_panic_with_hook::h738066c73a52890f
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/std/src/panicking.rs:804:13
  14:     0x74a1ae429643 - std::panicking::begin_panic_handler::{{closure}}::h8534a2aac695431b
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/std/src/panicking.rs:663:13
  15:     0x74a1ae426dd9 - std::sys::backtrace::__rust_end_short_backtrace::h3420ee35d28bf807
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/std/src/sys/backtrace.rs:171:18
  16:     0x74a1ae429304 - rust_begin_unwind
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/std/src/panicking.rs:661:5
  17:     0x74a1ae473a73 - core::panicking::panic_fmt::h51cb44e3a97167f8
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/core/src/panicking.rs:74:14
  18:     0x74a1ae473afc - core::panicking::panic::h01e4b12779f48d55
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/core/src/panicking.rs:148:5
  19:     0x74a1acd3c4e9 - <rustc_errors[812476ca5bead492]::DiagCtxtInner>::emit_diagnostic
  20:     0x74a1aab8f43b - <rustc_errors[812476ca5bead492]::DiagCtxtHandle>::update_unstable_expectation_id
  21:     0x74a1ab001df2 - rustc_lint[d375b8f4745d3144]::levels::lint_expectations
  22:     0x74a1ab4cbf6e - rustc_query_impl[da2d3b64247f93f0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[da2d3b64247f93f0]::query_impl::lint_expectations::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a7abdaade2c6424c]::query::erase::Erased<[u8; 8usize]>>
  23:     0x74a1ace329d2 - rustc_query_system[5e65d9b3abdd3162]::query::plumbing::try_execute_query::<rustc_query_impl[da2d3b64247f93f0]::DynamicConfig<rustc_query_system[5e65d9b3abdd3162]::query::caches::SingleCache<rustc_middle[a7abdaade2c6424c]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[da2d3b64247f93f0]::plumbing::QueryCtxt, false>
  24:     0x74a1ab4cfe06 - rustc_query_impl[da2d3b64247f93f0]::query_impl::lint_expectations::get_query_non_incr::__rust_end_short_backtrace
  25:     0x74a1ad0c3598 - rustc_lint[d375b8f4745d3144]::expect::check_expectations
  26:     0x74a1ad0c353b - rustc_query_impl[da2d3b64247f93f0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[da2d3b64247f93f0]::query_impl::check_expectations::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a7abdaade2c6424c]::query::erase::Erased<[u8; 0usize]>>
  27:     0x74a1ad0c309a - rustc_query_system[5e65d9b3abdd3162]::query::plumbing::try_execute_query::<rustc_query_impl[da2d3b64247f93f0]::DynamicConfig<rustc_query_system[5e65d9b3abdd3162]::query::caches::DefaultCache<core[daaba097f859fa28]::option::Option<rustc_span[1efc0ab8e6bb0790]::symbol::Symbol>, rustc_middle[a7abdaade2c6424c]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[da2d3b64247f93f0]::plumbing::QueryCtxt, false>
  28:     0x74a1ad0c2e25 - rustc_query_impl[da2d3b64247f93f0]::query_impl::check_expectations::get_query_non_incr::__rust_end_short_backtrace
  29:     0x74a1ac7f5818 - rustc_interface[7fb7dc76513cf959]::passes::analysis
  30:     0x74a1ac7f4ac7 - rustc_query_impl[da2d3b64247f93f0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[da2d3b64247f93f0]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a7abdaade2c6424c]::query::erase::Erased<[u8; 1usize]>>
  31:     0x74a1ace33ea5 - rustc_query_system[5e65d9b3abdd3162]::query::plumbing::try_execute_query::<rustc_query_impl[da2d3b64247f93f0]::DynamicConfig<rustc_query_system[5e65d9b3abdd3162]::query::caches::SingleCache<rustc_middle[a7abdaade2c6424c]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[da2d3b64247f93f0]::plumbing::QueryCtxt, false>
  32:     0x74a1ace33c0f - rustc_query_impl[da2d3b64247f93f0]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  33:     0x74a1accdd252 - rustc_interface[7fb7dc76513cf959]::interface::run_compiler::<core[daaba097f859fa28]::result::Result<(), rustc_span[1efc0ab8e6bb0790]::ErrorGuaranteed>, rustc_driver_impl[93e75e0175b92285]::run_compiler::{closure#0}>::{closure#1}
  34:     0x74a1acc9dac9 - std[eca1b30e63fdea7a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[7fb7dc76513cf959]::util::run_in_thread_with_globals<rustc_interface[7fb7dc76513cf959]::util::run_in_thread_pool_with_globals<rustc_interface[7fb7dc76513cf959]::interface::run_compiler<core[daaba097f859fa28]::result::Result<(), rustc_span[1efc0ab8e6bb0790]::ErrorGuaranteed>, rustc_driver_impl[93e75e0175b92285]::run_compiler::{closure#0}>::{closure#1}, core[daaba097f859fa28]::result::Result<(), rustc_span[1efc0ab8e6bb0790]::ErrorGuaranteed>>::{closure#0}, core[daaba097f859fa28]::result::Result<(), rustc_span[1efc0ab8e6bb0790]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[daaba097f859fa28]::result::Result<(), rustc_span[1efc0ab8e6bb0790]::ErrorGuaranteed>>
  35:     0x74a1acc9d880 - <<std[eca1b30e63fdea7a]::thread::Builder>::spawn_unchecked_<rustc_interface[7fb7dc76513cf959]::util::run_in_thread_with_globals<rustc_interface[7fb7dc76513cf959]::util::run_in_thread_pool_with_globals<rustc_interface[7fb7dc76513cf959]::interface::run_compiler<core[daaba097f859fa28]::result::Result<(), rustc_span[1efc0ab8e6bb0790]::ErrorGuaranteed>, rustc_driver_impl[93e75e0175b92285]::run_compiler::{closure#0}>::{closure#1}, core[daaba097f859fa28]::result::Result<(), rustc_span[1efc0ab8e6bb0790]::ErrorGuaranteed>>::{closure#0}, core[daaba097f859fa28]::result::Result<(), rustc_span[1efc0ab8e6bb0790]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[daaba097f859fa28]::result::Result<(), rustc_span[1efc0ab8e6bb0790]::ErrorGuaranteed>>::{closure#2} as core[daaba097f859fa28]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x74a1ae4338cb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha1ad2417ff4e2c89
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/alloc/src/boxed.rs:2062:9
  37:     0x74a1ae4338cb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha5ab2243447620ef
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/alloc/src/boxed.rs:2062:9
  38:     0x74a1ae4338cb - std::sys::pal::unix::thread::Thread::new::thread_start::he00df2d38aeed7a5
                               at /rustc/1ca578e68eb715e772fc0c1b9e6ca7c5b122765a/library/std/src/sys/pal/unix/thread.rs:108:17
  39:     0x74a1a76a6ded - <unknown>
  40:     0x74a1a772a0dc - <unknown>
  41:                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 make sure that you have updated to the latest nightly

note: rustc 1.81.0-nightly (1ca578e68 2024-06-20) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z crate-attr=feature(lint_reasons) -Z dump-mir-dir=dir

query stack during panic:
#0 [lint_expectations] computing `#[expect]`ed lints in this crate
#1 [check_expectations] checking lint expectations (RFC 2383)
end of query stack

@rustbot label +F-lint_reasons

@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. labels Jun 20, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-lint_reasons `#![feature(lint_reasons)]` labels Jun 20, 2024
@compiler-errors
Copy link
Member

fixed by #126719?

@matthiaskrgr
Copy link
Member Author

no?

@compiler-errors
Copy link
Member

actually probably broken by #126719 cc @nnethercote

@nnethercote
Copy link
Contributor

actually probably broken by #126719 cc @nnethercote

Not broken by #126719. Like #126521, #120699 is the regressing PR.

Has the fuzzer been updated recently to use more expected lints with future breakage? That would be my guess as to why these two crashes appeared close to each other.

@nnethercote nnethercote self-assigned this Jun 21, 2024
@matthiaskrgr
Copy link
Member Author

I've been using several batches of flags like all lints, mir optimisations, debuginfo, etc since mostly forever, however, I also automatically reduce to try to find a minimal set of required RUSTFLAGS for each ICE.
The first ice did not require any special flags but this one did which is why it showed up in my reports again, but now with the flag ^^'

@matthiaskrgr matthiaskrgr added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jul 4, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 5, 2024
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. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-lint_reasons `#![feature(lint_reasons)]` 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.
Projects
None yet
Development

No branches or pull requests

5 participants