Skip to content

ICE: failed to reparse  #139445

Closed
Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

fn main() {
    let mut c;

    assert_eq!(a::call2<'u, 'a, F>, 1234);
}

original:

struct Struct<S, T> {
    a: S,
    b: T,
}

fn main() {
    let (mut a, b);
    let mut c;
    let d = Struct { a: 0, b: 1 };
    Struct { a, b, c } = Struct { a: 0, b: 1 }; //~ ERROR does not have a field named `c`
    assert_eq!(a::call2<'u, 'a, F>, 1234); //~ ERROR pattern does not mention field `b`
    //~| ERROR expected identifier, found reserved identifier `_`
    Struct { a, ..z2 } = Struct { a: 1, b: 2 };
    //~^ ERROR functional record updates are not allowed in destructuring assignments
    Struct { a, .. }; //~ ERROR base expression required after `..`
}

Version information

rustc 1.88.0-nightly (1de931283 2025-04-06)
binary: rustc
commit-hash: 1de931283df18f3af4922fe9a96adcc8936ac42e
commit-date: 2025-04-06
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2

Possibly related line of code:

self.bump();
// Recovery is disabled when parsing macro arguments, so it must
// also be disabled when reparsing pasted macro arguments,
// otherwise we get inconsistent results (e.g. #137874).
let res = self.with_recovery(Recovery::Forbidden, |this| {
f(this).expect("failed to reparse {mv_kind:?}")
});
if let token::CloseDelim(delim) = self.token.kind
&& let Delimiter::Invisible(InvisibleOrigin::MetaVar(mv_kind)) = delim
&& match_mv_kind(mv_kind)
{

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error: expected `while`, `for`, `loop` or `{` after a label
 --> /tmp/icemaker_global_tempdir.JH8ZEyq8otjH/rustc_testrunner_tmpdir_reporting.h7pzT4t4mPph/mvce.rs:4:27
  |
4 |     assert_eq!(a::call2<'u, 'a, F>, 1234);
  |                           ^ expected `while`, `for`, `loop` or `{` after a label

error: expected `while`, `for`, `loop` or `{` after a label
 --> /tmp/icemaker_global_tempdir.JH8ZEyq8otjH/rustc_testrunner_tmpdir_reporting.h7pzT4t4mPph/mvce.rs:4:31
  |
4 |     assert_eq!(a::call2<'u, 'a, F>, 1234);
  |                               ^ expected `while`, `for`, `loop` or `{` after a label

error: expected `while`, `for`, `loop` or `{` after a label
 --> /tmp/icemaker_global_tempdir.JH8ZEyq8otjH/rustc_testrunner_tmpdir_reporting.h7pzT4t4mPph/mvce.rs:4:5
  |
4 |     assert_eq!(a::call2<'u, 'a, F>, 1234);
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `while`, `for`, `loop` or `{` after a label
  |
  = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)


thread 'rustc' panicked at compiler/rustc_parse/src/parser/mod.rs:786:25:
failed to reparse {mv_kind:?}: Some(DiagInner { level: Error, messages: [(Str("expected expression, found ``"), NoStyle)], code: None, lint_id: None, span: MultiSpan { primary_spans: [/home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/macros/mod.rs:57:17: 57:22 (#4)], span_labels: [(/home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/macros/mod.rs:57:17: 57:22 (#4), Str("expected expression"))] }, children: [], suggestions: Enabled([]), args: {}, sort_span: /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/macros/mod.rs:57:17: 57:22 (#4), is_lint: None, long_ty_path: None, emitted_at: DiagLocation { file: "compiler/rustc_parse/src/parser/diagnostics.rs", line: 2393, col: 34 } })
stack backtrace:
   0:     0x77c727894703 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h17a82c1e4262b993
   1:     0x77c728006111 - core::fmt::write::ha356953bd35d22ed
   2:     0x77c7293ec191 - std::io::Write::write_fmt::h70957b67820ef10c
   3:     0x77c727894562 - std::sys::backtrace::BacktraceLock::print::h874892c1f8b64952
   4:     0x77c72789804a - std::panicking::default_hook::{{closure}}::ha45d88db4a7da1c9
   5:     0x77c727897bcf - std::panicking::default_hook::h455b2036d00abb9e
   6:     0x77c7268f2ac3 - std[ff77399157f2e3bd]::panicking::update_hook::<alloc[c0810c7e581b39d]::boxed::Box<rustc_driver_impl[c97d372510f3a631]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x77c7278988c3 - std::panicking::rust_panic_with_hook::hfa17a275c3ae0e04
   8:     0x77c7278985ba - std::panicking::begin_panic_handler::{{closure}}::h5d63d79094a75fde
   9:     0x77c727894bd9 - std::sys::backtrace::__rust_end_short_backtrace::h7983c26ddc3b68d2
  10:     0x77c72789827d - __rustc[1d1bf72e3c1d98cf]::rust_begin_unwind
  11:     0x77c724297800 - core::panicking::panic_fmt::h31dfe277ad6692b2
  12:     0x77c724478746 - core::result::unwrap_failed::h7eeb7fad7101bd4f
  13:     0x77c7288f5a7c - <rustc_parse[d98407f81c1c930e]::parser::Parser>::collect_tokens_for_expr::<<rustc_parse[d98407f81c1c930e]::parser::Parser>::parse_expr_dot_or_call::{closure#0}>
  14:     0x77c7288cf21f - <rustc_parse[d98407f81c1c930e]::parser::Parser>::parse_expr_prefix
  15:     0x77c7288c8a56 - <rustc_parse[d98407f81c1c930e]::parser::Parser>::collect_tokens::<rustc_ast[20c80cea4dd33402]::ptr::P<rustc_ast[20c80cea4dd33402]::ast::Expr>, <rustc_parse[d98407f81c1c930e]::parser::Parser>::collect_tokens_for_expr<<rustc_parse[d98407f81c1c930e]::parser::Parser>::parse_expr_prefix::{closure#7}>::{closure#0}>
  16:     0x77c7288cf2b0 - <rustc_parse[d98407f81c1c930e]::parser::Parser>::parse_expr_prefix
  17:     0x77c7288cbad8 - <rustc_parse[d98407f81c1c930e]::parser::Parser>::parse_expr_assoc_with
  18:     0x77c7288d6177 - <rustc_parse[d98407f81c1c930e]::parser::Parser>::collect_tokens_for_expr::<<rustc_parse[d98407f81c1c930e]::parser::Parser>::parse_expr_dot_or_call::{closure#0}>
  19:     0x77c7288cf21f - <rustc_parse[d98407f81c1c930e]::parser::Parser>::parse_expr_prefix
  20:     0x77c7288cbad8 - <rustc_parse[d98407f81c1c930e]::parser::Parser>::parse_expr_assoc_with
  21:     0x77c7288e0af5 - <rustc_parse[d98407f81c1c930e]::parser::Parser>::collect_tokens_for_expr::<<rustc_parse[d98407f81c1c930e]::parser::Parser>::parse_expr_dot_or_call::{closure#0}>
  22:     0x77c7288cf21f - <rustc_parse[d98407f81c1c930e]::parser::Parser>::parse_expr_prefix
  23:     0x77c7288cbad8 - <rustc_parse[d98407f81c1c930e]::parser::Parser>::parse_expr_assoc_with
  24:     0x77c7288ae34c - <rustc_parse[d98407f81c1c930e]::parser::Parser>::collect_tokens::<rustc_ast[20c80cea4dd33402]::ptr::P<rustc_ast[20c80cea4dd33402]::ast::Expr>, <rustc_parse[d98407f81c1c930e]::parser::Parser>::parse_stmt_without_recovery::{closure#6}>
  25:     0x77c7288af76f - <rustc_parse[d98407f81c1c930e]::parser::Parser>::parse_stmt_without_recovery
  26:     0x77c728b3b722 - <rustc_parse[d98407f81c1c930e]::parser::Parser>::parse_full_stmt
  27:     0x77c728b382a8 - <rustc_expand[3764d10bfe44683]::mbe::macro_rules::ParserAnyMacro>::make
  28:     0x77c729384b32 - <rustc_expand[3764d10bfe44683]::expand::MacroExpander>::fully_expand_fragment
  29:     0x77c729373f4d - <rustc_expand[3764d10bfe44683]::expand::MacroExpander>::expand_crate
  30:     0x77c72880cb25 - rustc_interface[5e09446742ca674e]::passes::resolver_for_lowering_raw
  31:     0x77c72880bf21 - rustc_query_impl[c9170f90b2b49a1e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c9170f90b2b49a1e]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5ef2b07f0bf9281b]::query::erase::Erased<[u8; 16usize]>>
  32:     0x77c72880bf0f - <rustc_query_impl[c9170f90b2b49a1e]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[ad9c8bd38939abda]::ops::function::FnOnce<(rustc_middle[5ef2b07f0bf9281b]::ty::context::TyCtxt, ())>>::call_once
  33:     0x77c728ff5451 - rustc_query_system[dd895b260cdb9224]::query::plumbing::try_execute_query::<rustc_query_impl[c9170f90b2b49a1e]::DynamicConfig<rustc_query_system[dd895b260cdb9224]::query::caches::SingleCache<rustc_middle[5ef2b07f0bf9281b]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[c9170f90b2b49a1e]::plumbing::QueryCtxt, false>
  34:     0x77c728ff4fc0 - rustc_query_impl[c9170f90b2b49a1e]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  35:     0x77c7291895f1 - rustc_interface[5e09446742ca674e]::passes::create_and_enter_global_ctxt::<core[ad9c8bd38939abda]::option::Option<rustc_interface[5e09446742ca674e]::queries::Linker>, rustc_driver_impl[c97d372510f3a631]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  36:     0x77c72917a239 - rustc_interface[5e09446742ca674e]::interface::run_compiler::<(), rustc_driver_impl[c97d372510f3a631]::run_compiler::{closure#0}>::{closure#1}
  37:     0x77c72913438f - std[ff77399157f2e3bd]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5e09446742ca674e]::util::run_in_thread_with_globals<rustc_interface[5e09446742ca674e]::util::run_in_thread_pool_with_globals<rustc_interface[5e09446742ca674e]::interface::run_compiler<(), rustc_driver_impl[c97d372510f3a631]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  38:     0x77c729134c6b - <<std[ff77399157f2e3bd]::thread::Builder>::spawn_unchecked_<rustc_interface[5e09446742ca674e]::util::run_in_thread_with_globals<rustc_interface[5e09446742ca674e]::util::run_in_thread_pool_with_globals<rustc_interface[5e09446742ca674e]::interface::run_compiler<(), rustc_driver_impl[c97d372510f3a631]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[ad9c8bd38939abda]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:     0x77c72913606b - std::sys::pal::unix::thread::Thread::new::thread_start::h0ea666365484af3d
  40:     0x77c722ea370a - <unknown>
  41:     0x77c722f27aac - <unknown>
  42:                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.88.0-nightly (1de931283 2025-04-06) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack
error: aborting due to 3 previous errors


Metadata

Metadata

Assignees

Labels

A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions