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) #126521

Closed
matthiaskrgr opened this issue Jun 15, 2024 · 2 comments · Fixed by #126719
Closed

ICE: assertion failed: matches!(diagnostic.level, Error | Warning | Allow) #126521

matthiaskrgr opened this issue Jun 15, 2024 · 2 comments · Fixed by #126719
Assignees
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. F-lint_reasons `#![feature(lint_reasons)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ L-semicolon_in_expressions_from_macros Lint: semicolon_in_expressions_from_macros S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jun 15, 2024

auto-reduced (treereduce-rust):

macro_rules! foo {
    ($val:ident) => {
        true;
    };
}

fn main() {
    #[expect(semicolon_in_expressions_from_macros)]
    async {
        let _ = foo!(allow_does_not_work);
    };
}
original code

original:

//@ check-pass
//@ edition:2018
#![feature(stmt_expr_attributes)]
#![warn(semicolon_in_expressions_from_macros)]

#[allow(dead_code)]
macro_rules! foo {
    ($val:ident) => {
        true; //~  WARN trailing semicolon in macro
              //~| WARN this was previously accepted
              //~| WARN trailing semicolon in macro
              //~| WARN this was previously accepted
              //~| WARN trailing semicolon in macro
              //~| WARN this was previously accepted
    }
}

#[allow(semicolon_in_expressions_from_macros)]
async fn bar() {
    foo!(first);
}

fn main() {
    #[expect(reason = "I don't know what I'm waiting for")]
    let _ = {
        foo!(clippy)
    };

    #[allow(semicolon_in_expressions_from_macros)]
    let _ = foo!(second);

    #[allow(semicolon_in_expressions_from_macros)]
    fn inner() {
        let _ = foo!(third);
    }

    #[expect(semicolon_in_expressions_from_macros)]
    async {
        let _ = foo!(allow_does_not_work);
    };

    let _ = {
        foo!(warn_in_block)
    };

    let _ = foo!(warn_in_expr);

    // This `#[allow]` does not work, since the attribute gets dropped
    // when we expand the macro
    let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_not_work);
}

Version information

rustc 1.81.0-nightly (1d1356d0f 2024-06-15)
binary: rustc
commit-hash: 1d1356d0f67131f97b4f1631a24cd10d7dbcca42
commit-date: 2024-06-15
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --edition=2021

Program output

error[E0658]: the `#[expect]` attribute is an experimental feature
 --> /tmp/icemaker_global_tempdir.qyEl7I1p3eR3/rustc_testrunner_tmpdir_reporting.ILQhyULMDD3H/mvce.rs:8:5
  |
8 |     #[expect(semicolon_in_expressions_from_macros)]
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #54503 <https://github.com/rust-lang/rust/issues/54503> for more information
  = help: add `#![feature(lint_reasons)]` to the crate attributes to enable
  = note: this compiler was built on 2024-06-15; consider upgrading it if it is out of date

thread 'rustc' panicked at compiler/rustc_errors/src/lib.rs:1432:13:
assertion failed: matches!(diagnostic.level, Error | Warning | Allow)
stack backtrace:
   0:     0x7b7a4bfdaae5 - std::backtrace_rs::backtrace::libunwind::trace::hfdf631fd03f770a2
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7b7a4bfdaae5 - std::backtrace_rs::backtrace::trace_unsynchronized::h4b66a18855df7c81
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7b7a4bfdaae5 - std::sys_common::backtrace::_print_fmt::hc68641ea5ebed78b
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7b7a4bfdaae5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0232bc3c77cf19c0
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7b7a4c02b77b - core::fmt::rt::Argument::fmt::h6f3beb687e719ad0
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/core/src/fmt/rt.rs:165:63
   5:     0x7b7a4c02b77b - core::fmt::write::h293327fa69d57c1b
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/core/src/fmt/mod.rs:1168:21
   6:     0x7b7a4bfcf6bf - std::io::Write::write_fmt::h1a63a575073e52db
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/std/src/io/mod.rs:1835:15
   7:     0x7b7a4bfda8be - std::sys_common::backtrace::_print::h72fe4c54582659e7
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7b7a4bfda8be - std::sys_common::backtrace::print::h8689f207b07afb2c
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7b7a4bfdd2f9 - std::panicking::default_hook::{{closure}}::h6db5d0a05cc91d89
  10:     0x7b7a4bfdd09c - std::panicking::default_hook::h55df27622849dfa3
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/std/src/panicking.rs:292:9
  11:     0x7b7a488c1750 - std[a95b5bdb0bb4e4d9]::panicking::update_hook::<alloc[1c670b1f13e1d787]::boxed::Box<rustc_driver_impl[b19a02a3fded93a]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7b7a4bfddbff - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hc090581d78f54d74
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/alloc/src/boxed.rs:2076:9
  13:     0x7b7a4bfddbff - std::panicking::rust_panic_with_hook::hbdbeac82afc1acf0
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/std/src/panicking.rs:801:13
  14:     0x7b7a4bfdd7f3 - std::panicking::begin_panic_handler::{{closure}}::hb29625ad0c873f9a
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/std/src/panicking.rs:660:13
  15:     0x7b7a4bfdafa9 - std::sys_common::backtrace::__rust_end_short_backtrace::h21cc071853db44df
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7b7a4bfdd4d4 - rust_begin_unwind
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/std/src/panicking.rs:658:5
  17:     0x7b7a4c027d33 - core::panicking::panic_fmt::h67c92866ee1e292f
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/core/src/panicking.rs:74:14
  18:     0x7b7a4c027dbc - core::panicking::panic::h0fbf55b944f855fa
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/core/src/panicking.rs:148:5
  19:     0x7b7a4a7cbd78 - <rustc_errors[1788d6f62428d411]::DiagCtxtInner>::emit_diagnostic
  20:     0x7b7a4a7cb1ab - <rustc_errors[1788d6f62428d411]::DiagCtxt>::emit_diagnostic
  21:     0x7b7a46a0cc07 - <() as rustc_errors[1788d6f62428d411]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  22:     0x7b7a4a5349b9 - rustc_middle[4ec70d05c774b409]::lint::lint_level::lint_level_impl
  23:     0x7b7a48c77de4 - <rustc_lint[5908b024461f3693]::early::EarlyContextAndPass<rustc_lint[5908b024461f3693]::early::RuntimeCombinedEarlyLintPass> as rustc_ast[1167729371985e7]::visit::Visitor>::visit_block
  24:     0x7b7a48c5fe80 - <rustc_lint[5908b024461f3693]::early::EarlyContextAndPass<rustc_lint[5908b024461f3693]::early::RuntimeCombinedEarlyLintPass> as rustc_ast[1167729371985e7]::visit::Visitor>::visit_expr::{closure#0}
  25:     0x7b7a48c2906d - <rustc_lint[5908b024461f3693]::early::EarlyContextAndPass<rustc_lint[5908b024461f3693]::early::RuntimeCombinedEarlyLintPass>>::with_lint_attrs::<<rustc_lint[5908b024461f3693]::early::EarlyContextAndPass<rustc_lint[5908b024461f3693]::early::RuntimeCombinedEarlyLintPass> as rustc_ast[1167729371985e7]::visit::Visitor>::visit_expr::{closure#0}>
  26:     0x7b7a48c78238 - <rustc_lint[5908b024461f3693]::early::EarlyContextAndPass<rustc_lint[5908b024461f3693]::early::RuntimeCombinedEarlyLintPass> as rustc_ast[1167729371985e7]::visit::Visitor>::visit_block
  27:     0x7b7a48c797f3 - <rustc_lint[5908b024461f3693]::early::EarlyContextAndPass<rustc_lint[5908b024461f3693]::early::RuntimeCombinedEarlyLintPass> as rustc_ast[1167729371985e7]::visit::Visitor>::visit_fn
  28:     0x7b7a48c4cef0 - rustc_ast[1167729371985e7]::visit::walk_assoc_item::<rustc_lint[5908b024461f3693]::early::EarlyContextAndPass<rustc_lint[5908b024461f3693]::early::RuntimeCombinedEarlyLintPass>, rustc_ast[1167729371985e7]::ast::ItemKind>
  29:     0x7b7a48c778c8 - <rustc_lint[5908b024461f3693]::early::EarlyContextAndPass<rustc_lint[5908b024461f3693]::early::RuntimeCombinedEarlyLintPass> as rustc_ast[1167729371985e7]::visit::Visitor>::visit_item
  30:     0x7b7a48c4d9c4 - rustc_lint[5908b024461f3693]::early::check_ast_node_inner::<rustc_lint[5908b024461f3693]::early::RuntimeCombinedEarlyLintPass, (&rustc_ast[1167729371985e7]::ast::Crate, &[rustc_ast[1167729371985e7]::ast::Attribute])>
  31:     0x7b7a4a1073b4 - rustc_interface[5e68df66c2caab02]::passes::early_lint_checks
  32:     0x7b7a4a105e31 - rustc_query_impl[56dcb2b13a3b378d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[56dcb2b13a3b378d]::query_impl::early_lint_checks::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4ec70d05c774b409]::query::erase::Erased<[u8; 0usize]>>
  33:     0x7b7a4aa050c1 - rustc_query_system[8f2edcd73119e84f]::query::plumbing::try_execute_query::<rustc_query_impl[56dcb2b13a3b378d]::DynamicConfig<rustc_query_system[8f2edcd73119e84f]::query::caches::SingleCache<rustc_middle[4ec70d05c774b409]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[56dcb2b13a3b378d]::plumbing::QueryCtxt, false>
  34:     0x7b7a4aa04ecf - rustc_query_impl[56dcb2b13a3b378d]::query_impl::early_lint_checks::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7b7a4a1cc69e - rustc_ast_lowering[121b085c28c63178]::lower_to_hir
  36:     0x7b7a4aa06da2 - rustc_query_impl[56dcb2b13a3b378d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[56dcb2b13a3b378d]::query_impl::hir_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4ec70d05c774b409]::query::erase::Erased<[u8; 8usize]>>
  37:     0x7b7a4aa06112 - rustc_query_system[8f2edcd73119e84f]::query::plumbing::try_execute_query::<rustc_query_impl[56dcb2b13a3b378d]::DynamicConfig<rustc_query_system[8f2edcd73119e84f]::query::caches::SingleCache<rustc_middle[4ec70d05c774b409]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[56dcb2b13a3b378d]::plumbing::QueryCtxt, false>
  38:     0x7b7a4aa05d1e - rustc_query_impl[56dcb2b13a3b378d]::query_impl::hir_crate::get_query_non_incr::__rust_end_short_backtrace
  39:     0x7b7a49de6521 - rustc_query_impl[56dcb2b13a3b378d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[56dcb2b13a3b378d]::query_impl::hir_attrs::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4ec70d05c774b409]::query::erase::Erased<[u8; 8usize]>>
  40:     0x7b7a49de5adb - rustc_query_system[8f2edcd73119e84f]::query::plumbing::try_execute_query::<rustc_query_impl[56dcb2b13a3b378d]::DynamicConfig<rustc_query_system[8f2edcd73119e84f]::query::caches::VecCache<rustc_hir[615f113f9b51ba4f]::hir_id::OwnerId, rustc_middle[4ec70d05c774b409]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[56dcb2b13a3b378d]::plumbing::QueryCtxt, false>
  41:     0x7b7a49de584f - rustc_query_impl[56dcb2b13a3b378d]::query_impl::hir_attrs::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7b7a49dd5817 - <rustc_middle[4ec70d05c774b409]::hir::map::Map>::attrs
  43:     0x7b7a4aad1cc1 - rustc_passes[458f96c409ba88ee]::entry::entry_fn
  44:     0x7b7a4aad1c66 - rustc_query_impl[56dcb2b13a3b378d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[56dcb2b13a3b378d]::query_impl::entry_fn::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4ec70d05c774b409]::query::erase::Erased<[u8; 12usize]>>
  45:     0x7b7a4aad1c49 - <rustc_query_impl[56dcb2b13a3b378d]::query_impl::entry_fn::dynamic_query::{closure#2} as core[255d19793ae049e7]::ops::function::FnOnce<(rustc_middle[4ec70d05c774b409]::ty::context::TyCtxt, ())>>::call_once
  46:     0x7b7a4aad1562 - rustc_query_system[8f2edcd73119e84f]::query::plumbing::try_execute_query::<rustc_query_impl[56dcb2b13a3b378d]::DynamicConfig<rustc_query_system[8f2edcd73119e84f]::query::caches::SingleCache<rustc_middle[4ec70d05c774b409]::query::erase::Erased<[u8; 12usize]>>, false, false, false>, rustc_query_impl[56dcb2b13a3b378d]::plumbing::QueryCtxt, false>
  47:     0x7b7a4aad1321 - rustc_query_impl[56dcb2b13a3b378d]::query_impl::entry_fn::get_query_non_incr::__rust_end_short_backtrace
  48:     0x7b7a4a6845f2 - rustc_interface[5e68df66c2caab02]::passes::analysis
  49:     0x7b7a4a684407 - rustc_query_impl[56dcb2b13a3b378d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[56dcb2b13a3b378d]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4ec70d05c774b409]::query::erase::Erased<[u8; 1usize]>>
  50:     0x7b7a4aa07565 - rustc_query_system[8f2edcd73119e84f]::query::plumbing::try_execute_query::<rustc_query_impl[56dcb2b13a3b378d]::DynamicConfig<rustc_query_system[8f2edcd73119e84f]::query::caches::SingleCache<rustc_middle[4ec70d05c774b409]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[56dcb2b13a3b378d]::plumbing::QueryCtxt, false>
  51:     0x7b7a4aa072cf - rustc_query_impl[56dcb2b13a3b378d]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  52:     0x7b7a4a8805d2 - rustc_interface[5e68df66c2caab02]::interface::run_compiler::<core[255d19793ae049e7]::result::Result<(), rustc_span[949d05b7d8fa239b]::ErrorGuaranteed>, rustc_driver_impl[b19a02a3fded93a]::run_compiler::{closure#0}>::{closure#1}
  53:     0x7b7a4a8b13e7 - std[a95b5bdb0bb4e4d9]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5e68df66c2caab02]::util::run_in_thread_with_globals<rustc_interface[5e68df66c2caab02]::util::run_in_thread_pool_with_globals<rustc_interface[5e68df66c2caab02]::interface::run_compiler<core[255d19793ae049e7]::result::Result<(), rustc_span[949d05b7d8fa239b]::ErrorGuaranteed>, rustc_driver_impl[b19a02a3fded93a]::run_compiler::{closure#0}>::{closure#1}, core[255d19793ae049e7]::result::Result<(), rustc_span[949d05b7d8fa239b]::ErrorGuaranteed>>::{closure#0}, core[255d19793ae049e7]::result::Result<(), rustc_span[949d05b7d8fa239b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[255d19793ae049e7]::result::Result<(), rustc_span[949d05b7d8fa239b]::ErrorGuaranteed>>
  54:     0x7b7a4a8b11aa - <<std[a95b5bdb0bb4e4d9]::thread::Builder>::spawn_unchecked_<rustc_interface[5e68df66c2caab02]::util::run_in_thread_with_globals<rustc_interface[5e68df66c2caab02]::util::run_in_thread_pool_with_globals<rustc_interface[5e68df66c2caab02]::interface::run_compiler<core[255d19793ae049e7]::result::Result<(), rustc_span[949d05b7d8fa239b]::ErrorGuaranteed>, rustc_driver_impl[b19a02a3fded93a]::run_compiler::{closure#0}>::{closure#1}, core[255d19793ae049e7]::result::Result<(), rustc_span[949d05b7d8fa239b]::ErrorGuaranteed>>::{closure#0}, core[255d19793ae049e7]::result::Result<(), rustc_span[949d05b7d8fa239b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[255d19793ae049e7]::result::Result<(), rustc_span[949d05b7d8fa239b]::ErrorGuaranteed>>::{closure#2} as core[255d19793ae049e7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  55:     0x7b7a4bfe7a7b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0425b9f5e54ebe0c
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/alloc/src/boxed.rs:2062:9
  56:     0x7b7a4bfe7a7b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h54d26adcfa3b7e83
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/alloc/src/boxed.rs:2062:9
  57:     0x7b7a4bfe7a7b - std::sys::pal::unix::thread::Thread::new::thread_start::h1619c9bedefd3e87
                               at /rustc/1d1356d0f67131f97b4f1631a24cd10d7dbcca42/library/std/src/sys/pal/unix/thread.rs:108:17
  58:     0x7b7a454a6ded - <unknown>
  59:     0x7b7a4552a0dc - <unknown>
  60:                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 (1d1356d0f 2024-06-15) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options -Z dump-mir-dir=dir

query stack during panic:
#0 [early_lint_checks] perform lints prior to macro expansion
#1 [hir_crate] getting the crate HIR
end of query stack
error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0658`.

@rustbot label +F-stmt_expr_attributes

@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 15, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 15, 2024
@matthiaskrgr matthiaskrgr changed the title ICE: `assertion failed: matches!(diagnostic.level, Error | Warning | Allow) ICE: assertion failed: matches!(diagnostic.level, Error | Warning | Allow) Jun 15, 2024
@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Jun 15, 2024

bisects to #120699 🤔 cc @nnethercote

edit: ah the assertion was added there...

@jieyouxu jieyouxu added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. L-semicolon_in_expressions_from_macros Lint: semicolon_in_expressions_from_macros S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jun 15, 2024
@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Jun 15, 2024

macro_rules! foo {
    ($val:ident) => {
        true;
    };
}

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

@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Jun 17, 2024
@nnethercote nnethercote self-assigned this Jun 19, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 20, 2024
Fix assertion failure for some `Expect` diagnostics.

In rust-lang#120699 I moved some code dealing with `has_future_breakage` earlier in `emit_diagnostic`. Issue rust-lang#126521 identified a case where that reordering was invalid (leading to an assertion failure) for some `Expect` diagnostics.

This commit partially undoes the change, by moving the handling of unstable `Expect` diagnostics earlier again. This makes `emit_diagnostic` a bit uglier, but is necessary to fix the problem.

Fixes rust-lang#126521.

r? `@oli-obk`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 20, 2024
Fix assertion failure for some `Expect` diagnostics.

In rust-lang#120699 I moved some code dealing with `has_future_breakage` earlier in `emit_diagnostic`. Issue rust-lang#126521 identified a case where that reordering was invalid (leading to an assertion failure) for some `Expect` diagnostics.

This commit partially undoes the change, by moving the handling of unstable `Expect` diagnostics earlier again. This makes `emit_diagnostic` a bit uglier, but is necessary to fix the problem.

Fixes rust-lang#126521.

r? ``@oli-obk``
@bors bors closed this as completed in 19b7192 Jun 20, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 20, 2024
Rollup merge of rust-lang#126719 - nnethercote:fix-126521, r=oli-obk

Fix assertion failure for some `Expect` diagnostics.

In rust-lang#120699 I moved some code dealing with `has_future_breakage` earlier in `emit_diagnostic`. Issue rust-lang#126521 identified a case where that reordering was invalid (leading to an assertion failure) for some `Expect` diagnostics.

This commit partially undoes the change, by moving the handling of unstable `Expect` diagnostics earlier again. This makes `emit_diagnostic` a bit uglier, but is necessary to fix the problem.

Fixes rust-lang#126521.

r? ``@oli-obk``
@xFrednet xFrednet added the F-lint_reasons `#![feature(lint_reasons)]` label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. F-lint_reasons `#![feature(lint_reasons)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ L-semicolon_in_expressions_from_macros Lint: semicolon_in_expressions_from_macros S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants