Skip to content

[ICE]: !self.token.kind.is_close_delim_or_eof() #157853

Description

@matthiaskrgr

snippet:

fn main() { Test([&raw 2]) }

Version information

rustc 1.98.0-nightly (4e391cf24 2026-06-12)
binary: rustc
commit-hash: 4e391cf2425cf96521af17ff460e9f220e9bca00
commit-date: 2026-06-12
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.6

Possibly related line of code:

debug_assert!(self.token.kind.close_delim().is_some());
// Consume close delimiter
self.bump();
tree
} else {
assert!(!self.token.kind.is_close_delim_or_eof());
let prev_spacing = self.token_spacing;
self.bump();
TokenTree::Token(self.prev_token, prev_spacing)
}
}

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

Program output

error: expected one of `!`, `,`, `.`, `::`, `;`, `?`, `]`, `const`, `mut`, `{`, or an operator, found `2`
 --> /tmp/icemaker_global_tempdir.Gqh0YrYSvrfj/rustc_testrunner_tmpdir_reporting.pYtzgzYDCHEb/mvce.rs:1:24
  |
1 | fn main() { Test([&raw 2]) }
  |                        ^ expected one of 11 possible tokens
  |
help: `&raw` must be followed by `const` or `mut` to be a raw reference expression
  |
1 | fn main() { Test([&raw const 2]) }
  |                        +++++
1 | fn main() { Test([&raw mut 2]) }
  |                        +++


thread 'rustc' (3920208) panicked at /rustc-dev/4e391cf2425cf96521af17ff460e9f220e9bca00/compiler/rustc_parse/src/parser/mod.rs:1446:13:
assertion failed: !self.token.kind.is_close_delim_or_eof()
stack backtrace:
   0:     0x7f552f2d2ed9 - <<std[eb341474a0652f47]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[79b03ec5e6dd4535]::fmt::Display>::fmt
   1:     0x7f552fa0ebde - core[79b03ec5e6dd4535]::fmt::write
   2:     0x7f552f2e9206 - <std[eb341474a0652f47]::sys::stdio::unix::Stderr as std[eb341474a0652f47]::io::Write>::write_fmt
   3:     0x7f552f2a881e - std[eb341474a0652f47]::panicking::default_hook::{closure#0}
   4:     0x7f552f2c5fe3 - std[eb341474a0652f47]::panicking::default_hook
   5:     0x7f552e0a1e8c - std[eb341474a0652f47]::panicking::update_hook::<alloc[302e4f29f7d0cfe9]::boxed::Box<rustc_driver_impl[64306d8d688724fa]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f552f2c62c2 - std[eb341474a0652f47]::panicking::panic_with_hook
   7:     0x7f552f2a8914 - std[eb341474a0652f47]::panicking::panic_handler::{closure#0}
   8:     0x7f552f29f5e9 - std[eb341474a0652f47]::sys::backtrace::__rust_end_short_backtrace::<std[eb341474a0652f47]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f552f2aa34d - __rustc[90ed4aa68b0521cf]::rust_begin_unwind
  10:     0x7f552bd58b8c - core[79b03ec5e6dd4535]::panicking::panic_fmt
  11:     0x7f552c35cec2 - core[79b03ec5e6dd4535]::panicking::panic
  12:     0x7f552fc42781 - <rustc_parse[7b2ecb2d92d788c8]::parser::Parser>::parse_token_tree
  13:     0x7f552fbe080a - <rustc_parse[7b2ecb2d92d788c8]::parser::Parser>::parse_expr_dot_or_call_with::{closure#0}
  14:     0x7f5530a7e904 - <rustc_parse[7b2ecb2d92d788c8]::parser::Parser>::collect_tokens::<rustc_ast[81a297a2d8b86587]::ast::Stmt, <rustc_parse[7b2ecb2d92d788c8]::parser::Parser>::parse_stmt_without_recovery::{closure#4}>
  15:     0x7f552fbc4647 - <rustc_parse[7b2ecb2d92d788c8]::parser::Parser>::parse_stmt_without_recovery
  16:     0x7f552fbcc6b5 - <rustc_parse[7b2ecb2d92d788c8]::parser::Parser>::parse_block_common
  17:     0x7f552fbd5ebc - <rustc_parse[7b2ecb2d92d788c8]::parser::Parser>::parse_fn
  18:     0x7f552fb96358 - <rustc_parse[7b2ecb2d92d788c8]::parser::Parser>::parse_item_kind
  19:     0x7f552fb903c6 - <rustc_parse[7b2ecb2d92d788c8]::parser::Parser>::parse_item_common
  20:     0x7f552fbc2014 - <rustc_parse[7b2ecb2d92d788c8]::parser::Parser>::parse_mod
  21:     0x7f55308cbafd - rustc_interface[b57a7abdcd622953]::passes::parse
  22:     0x7f5530b523f2 - rustc_interface[b57a7abdcd622953]::interface::run_compiler::<(), rustc_driver_impl[64306d8d688724fa]::run_compiler::{closure#0}>::{closure#1}
  23:     0x7f5530b8bbba - std[eb341474a0652f47]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[b57a7abdcd622953]::util::run_in_thread_with_globals<rustc_interface[b57a7abdcd622953]::util::run_in_thread_pool_with_globals<rustc_interface[b57a7abdcd622953]::interface::run_compiler<(), rustc_driver_impl[64306d8d688724fa]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  24:     0x7f5530b8b96d - <std[eb341474a0652f47]::thread::lifecycle::spawn_unchecked<rustc_interface[b57a7abdcd622953]::util::run_in_thread_with_globals<rustc_interface[b57a7abdcd622953]::util::run_in_thread_pool_with_globals<rustc_interface[b57a7abdcd622953]::interface::run_compiler<(), rustc_driver_impl[64306d8d688724fa]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[79b03ec5e6dd4535]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7f5530b81e90 - <std[eb341474a0652f47]::sys::thread::unix::Thread>::new::thread_start
  26:     0x7f552a0981b9 - <unknown>
  27:     0x7f552a11d21c - <unknown>
  28:                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.98.0-nightly (4e391cf24 2026-06-12) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to 1 previous error


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) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions