Skip to content

ICE: failed to reparse #137874

Closed
Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

pub fn main() {
    match X {
        deref!([0b101010f64, _, 3]) => {}
    }
}

original:

//@ run-pass

struct Foo;

static X: Foo = Foo;

pub fn main() {
    match X {
        deref!([0b101010f64, _, 3]) => {}
    }
}

Version information

rustc 1.87.0-nightly (351686bcf 2025-03-01)
binary: rustc
commit-hash: 351686bcfd18dd0f652aba69a806bfa68c57234d
commit-date: 2025-03-01
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

Possibly related line of code:

) -> Option<T> {
if let token::OpenDelim(delim) = self.token.kind
&& let Delimiter::Invisible(InvisibleOrigin::MetaVar(mv_kind)) = delim
&& match_mv_kind(mv_kind)
{
self.bump();
let res = f(self).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)
{
self.bump();
Some(res)

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

Program output

error[E0658]: use of unstable library feature `deref_patterns`: placeholder syntax for deref patterns
 --> /tmp/icemaker_global_tempdir.wxhLJkXfbxMZ/rustc_testrunner_tmpdir_reporting.FgtN60LYeTIA/mvce.rs:3:9
  |
3 |         deref!([0b101010f64, _, 3]) => {}
  |         ^^^^^
  |
  = note: see issue #87121 <https://github.com/rust-lang/rust/issues/87121> for more information
  = help: add `#![feature(deref_patterns)]` to the crate attributes to enable
  = note: this compiler was built on 2025-03-01; consider upgrading it if it is out of date


thread 'rustc' panicked at compiler/rustc_parse/src/parser/mod.rs:768:31:
failed to reparse {mv_kind:?}: Some(DiagInner { level: Error, messages: [(FluentIdentifier("parse_expected_identifier_found_str", None), NoStyle)], code: None, span: MultiSpan { primary_spans: [/tmp/icemaker_global_tempdir.wxhLJkXfbxMZ/rustc_testrunner_tmpdir_reporting.FgtN60LYeTIA/mvce.rs:3:17: 3:28 (#0)], span_labels: [(/tmp/icemaker_global_tempdir.wxhLJkXfbxMZ/rustc_testrunner_tmpdir_reporting.FgtN60LYeTIA/mvce.rs:3:17: 3:28 (#0), FluentIdentifier("parse_expected_identifier", None))] }, children: [Subdiag { level: Help, messages: [(FluentIdentifier("parse_invalid_identifier_with_leading_number", None), NoStyle)], span: MultiSpan { primary_spans: [/tmp/icemaker_global_tempdir.wxhLJkXfbxMZ/rustc_testrunner_tmpdir_reporting.FgtN60LYeTIA/mvce.rs:3:17: 3:25 (#0)], span_labels: [] } }], suggestions: Enabled([]), args: {"token": Str("0b101010f64")}, sort_span: /tmp/icemaker_global_tempdir.wxhLJkXfbxMZ/rustc_testrunner_tmpdir_reporting.FgtN60LYeTIA/mvce.rs:3:17: 3:28 (#0), is_lint: None, long_ty_path: None, emitted_at: DiagLocation { file: "compiler/rustc_parse/src/parser/diagnostics.rs", line: 371, col: 34 } })
stack backtrace:
   0:     0x7b7181dbf0d4 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h512fc0ab65645de5
   1:     0x7b71826057e2 - core::fmt::write::hdbee15e0a2df9fd7
   2:     0x7b71839f6411 - std::io::Write::write_fmt::hc06675d21e69e541
   3:     0x7b7181dbef32 - std::sys::backtrace::BacktraceLock::print::h71b425936fc3e4b8
   4:     0x7b7181dc1812 - std::panicking::default_hook::{{closure}}::hbba6d1889ba06809
   5:     0x7b7181dc1404 - std::panicking::default_hook::ha1628e5560225566
   6:     0x7b7180f19137 - std[73fc39335cd1ceda]::panicking::update_hook::<alloc[7449611bcb229259]::boxed::Box<rustc_driver_impl[c7033648bfdf4c80]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7b7181dc2083 - std::panicking::rust_panic_with_hook::h9f3cc492432ffe0a
   8:     0x7b7181dc1d7a - std::panicking::begin_panic_handler::{{closure}}::h7255667d7ab4e1d4
   9:     0x7b7181dbf5a9 - std::sys::backtrace::__rust_end_short_backtrace::hcf69635c7990946c
  10:     0x7b7181dc1a3d - rust_begin_unwind
  11:     0x7b717ea5b2c0 - core::panicking::panic_fmt::ha881f14dc09ed01c
  12:     0x7b717ebe96b6 - core::result::unwrap_failed::h08d9e0d600154a82
  13:     0x7b7182f1f2a6 - <rustc_parse[3959de2b5713e24e]::parser::Parser>::parse_pat_with_range_pat
  14:     0x7b7182effaea - <rustc_parse[3959de2b5713e24e]::parser::Parser>::parse_pat_no_top_guard_inner
  15:     0x7b7182eff86a - <rustc_parse[3959de2b5713e24e]::parser::Parser>::parse_pat_allow_top_guard
  16:     0x7b71817734d7 - <rustc_parse[3959de2b5713e24e]::parser::Parser>::parse_builtin::<rustc_ast[fbe4be00de71ee9f]::ast::PatKind, <rustc_parse[3959de2b5713e24e]::parser::Parser>::parse_pat_builtin::{closure#0}>
  17:     0x7b7182f1ea6c - <rustc_parse[3959de2b5713e24e]::parser::Parser>::parse_pat_with_range_pat
  18:     0x7b7182effaea - <rustc_parse[3959de2b5713e24e]::parser::Parser>::parse_pat_no_top_guard_inner
  19:     0x7b7182eff86a - <rustc_parse[3959de2b5713e24e]::parser::Parser>::parse_pat_allow_top_guard
  20:     0x7b7182f53b0b - <rustc_expand[a7ac4f37f407a022]::mbe::macro_rules::ParserAnyMacro>::make
  21:     0x7b7180fcbe1d - <rustc_expand[a7ac4f37f407a022]::mbe::macro_rules::ParserAnyMacro as rustc_expand[a7ac4f37f407a022]::base::MacResult>::make_pat
  22:     0x7b7183931749 - <rustc_expand[a7ac4f37f407a022]::expand::MacroExpander>::fully_expand_fragment
  23:     0x7b718390656b - <rustc_expand[a7ac4f37f407a022]::expand::MacroExpander>::expand_crate
  24:     0x7b71829e0133 - rustc_interface[b107db532c72b558]::passes::resolver_for_lowering_raw
  25:     0x7b71829df58d - rustc_query_impl[ad104e1204eb17fd]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ad104e1204eb17fd]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b86a10067019e542]::query::erase::Erased<[u8; 16usize]>>
  26:     0x7b71829df577 - <rustc_query_impl[ad104e1204eb17fd]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[6fd456830ce7e084]::ops::function::FnOnce<(rustc_middle[b86a10067019e542]::ty::context::TyCtxt, ())>>::call_once
  27:     0x7b718369f198 - rustc_query_system[2707bc4b3550dbed]::query::plumbing::try_execute_query::<rustc_query_impl[ad104e1204eb17fd]::DynamicConfig<rustc_query_system[2707bc4b3550dbed]::query::caches::SingleCache<rustc_middle[b86a10067019e542]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[ad104e1204eb17fd]::plumbing::QueryCtxt, false>
  28:     0x7b718369ed07 - rustc_query_impl[ad104e1204eb17fd]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7b718373752d - rustc_interface[b107db532c72b558]::passes::create_and_enter_global_ctxt::<core[6fd456830ce7e084]::option::Option<rustc_interface[b107db532c72b558]::queries::Linker>, rustc_driver_impl[c7033648bfdf4c80]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  30:     0x7b71836b26a0 - rustc_interface[b107db532c72b558]::interface::run_compiler::<(), rustc_driver_impl[c7033648bfdf4c80]::run_compiler::{closure#0}>::{closure#1}
  31:     0x7b718355afc8 - std[73fc39335cd1ceda]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[b107db532c72b558]::util::run_in_thread_with_globals<rustc_interface[b107db532c72b558]::util::run_in_thread_pool_with_globals<rustc_interface[b107db532c72b558]::interface::run_compiler<(), rustc_driver_impl[c7033648bfdf4c80]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  32:     0x7b718355b8b4 - <<std[73fc39335cd1ceda]::thread::Builder>::spawn_unchecked_<rustc_interface[b107db532c72b558]::util::run_in_thread_with_globals<rustc_interface[b107db532c72b558]::util::run_in_thread_pool_with_globals<rustc_interface[b107db532c72b558]::interface::run_compiler<(), rustc_driver_impl[c7033648bfdf4c80]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[6fd456830ce7e084]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  33:     0x7b718355ccab - std::sys::pal::unix::thread::Thread::new::thread_start::hbc7f68edabc6a613
  34:     0x7b717d6a370a - <unknown>
  35:     0x7b717d727aac - <unknown>
  36:                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.87.0-nightly (351686bcf 2025-03-01) 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 1 previous error

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

Metadata

Metadata

Assignees

Labels

A-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.S-has-bisectionStatus: a bisection has been found for this issueT-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