Skip to content

[ICE]: missing tokens for node #153745

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#[eii]
#[core::contracts::ensures]
fn implementation() {}

original:

#![feature(extern_item_impls)]
#![feature(contracts)]
#[eii]
#[core::contracts::ensures]
fn implementation() {}

Version information

rustc 1.96.0-nightly (3b1b0ef4d 2026-03-11)
binary: rustc
commit-hash: 3b1b0ef4d80d3117924d91352c8b6ca528708b3c
commit-date: 2026-03-11
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0

Possibly related line of code:

/// `Spacing::Alone`.
pub fn token_alone(kind: TokenKind, span: Span) -> TokenStream {
TokenStream::new(vec![TokenTree::token_alone(kind, span)])
}
pub fn from_ast(node: &(impl HasAttrs + HasTokens + fmt::Debug)) -> TokenStream {
let tokens = node.tokens().unwrap_or_else(|| panic!("missing tokens for node: {:?}", node));
let mut tts = vec![];
attrs_and_tokens_to_token_trees(node.attrs(), tokens, &mut tts);
TokenStream::new(tts)
}
// If `vec` is not empty, try to glue `tt` onto its last token. The return

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

Program output

error[E0658]: use of unstable library feature `extern_item_impls`
 --> /tmp/icemaker_global_tempdir.JoCG9GsXcVxc/rustc_testrunner_tmpdir_reporting.p9qJImGkbFTT/mvce.rs:1:3
  |
1 | #[eii]
  |   ^^^
  |
  = note: see issue #125418 <https://github.com/rust-lang/rust/issues/125418> for more information
  = help: add `#![feature(extern_item_impls)]` to the crate attributes to enable
  = note: this compiler was built on 2026-03-11; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature `contracts`
 --> /tmp/icemaker_global_tempdir.JoCG9GsXcVxc/rustc_testrunner_tmpdir_reporting.p9qJImGkbFTT/mvce.rs:2:3
  |
2 | #[core::contracts::ensures]
  |   ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
  = help: add `#![feature(contracts)]` to the crate attributes to enable
  = note: this compiler was built on 2026-03-11; consider upgrading it if it is out of date


thread 'rustc' (954638) panicked at /rustc-dev/3b1b0ef4d80d3117924d91352c8b6ca528708b3c/compiler/rustc_ast/src/tokenstream.rs:638:54:
missing tokens for node: Item { attrs: [Attribute { kind: Normal(NormalAttr { item: AttrItem { unsafety: Default, path: Path { span: /tmp/icemaker_global_tempdir.JoCG9GsXcVxc/rustc_testrunner_tmpdir_reporting.p9qJImGkbFTT/mvce.rs:1:1: 1:7 (#4), segments: [PathSegment { ident: rustc_eii_foreign_item#4, id: NodeId(4294967040), args: None }], tokens: None }, args: Unparsed(Empty), tokens: None }, tokens: None }), id: AttrId(3), style: Outer, span: /tmp/icemaker_global_tempdir.JoCG9GsXcVxc/rustc_testrunner_tmpdir_reporting.p9qJImGkbFTT/mvce.rs:1:1: 1:7 (#4) }], id: NodeId(4294967040), span: /tmp/icemaker_global_tempdir.JoCG9GsXcVxc/rustc_testrunner_tmpdir_reporting.p9qJImGkbFTT/mvce.rs:3:1: 3:20 (#0), vis: Visibility { kind: Inherited, span: /tmp/icemaker_global_tempdir.JoCG9GsXcVxc/rustc_testrunner_tmpdir_reporting.p9qJImGkbFTT/mvce.rs:3:1: 3:1 (#0), tokens: None }, kind: Fn(Fn { defaultness: Implicit, ident: implementation#0, generics: Generics { params: [], where_clause: WhereClause { has_where_token: false, predicates: [], span: /tmp/icemaker_global_tempdir.JoCG9GsXcVxc/rustc_testrunner_tmpdir_reporting.p9qJImGkbFTT/mvce.rs:3:20: 3:20 (#0) }, span: /tmp/icemaker_global_tempdir.JoCG9GsXcVxc/rustc_testrunner_tmpdir_reporting.p9qJImGkbFTT/mvce.rs:3:18: 3:18 (#0) }, sig: FnSig { header: FnHeader { constness: No, coroutine_kind: None, safety: Safe(/tmp/icemaker_global_tempdir.JoCG9GsXcVxc/rustc_testrunner_tmpdir_reporting.p9qJImGkbFTT/mvce.rs:3:1: 3:20 (#0)), ext: None }, decl: FnDecl { inputs: [], output: Default(/tmp/icemaker_global_tempdir.JoCG9GsXcVxc/rustc_testrunner_tmpdir_reporting.p9qJImGkbFTT/mvce.rs:3:20: 3:20 (#0)) }, span: /tmp/icemaker_global_tempdir.JoCG9GsXcVxc/rustc_testrunner_tmpdir_reporting.p9qJImGkbFTT/mvce.rs:3:1: 3:20 (#0) }, contract: None, define_opaque: None, body: None, eii_impls: [] }), tokens: None }
stack backtrace:
   0:     0x7fa1cdf488db - <<std[98a29328132e9808]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[d6e61f80bd84b1aa]::fmt::Display>::fmt
   1:     0x7fa1ce61cd08 - core[d6e61f80bd84b1aa]::fmt::write
   2:     0x7fa1cdf5f8e6 - <std[98a29328132e9808]::sys::stdio::unix::Stderr as std[98a29328132e9808]::io::Write>::write_fmt
   3:     0x7fa1cdf1e9c8 - std[98a29328132e9808]::panicking::default_hook::{closure#0}
   4:     0x7fa1cdf3bd53 - std[98a29328132e9808]::panicking::default_hook
   5:     0x7fa1ccf36a0c - std[98a29328132e9808]::panicking::update_hook::<alloc[181a33ef8c443c3d]::boxed::Box<rustc_driver_impl[da6c6aa1c22ed2c8]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fa1cdf3c032 - std[98a29328132e9808]::panicking::panic_with_hook
   7:     0x7fa1cdf1ea88 - std[98a29328132e9808]::panicking::panic_handler::{closure#0}
   8:     0x7fa1cdf157b9 - std[98a29328132e9808]::sys::backtrace::__rust_end_short_backtrace::<std[98a29328132e9808]::panicking::panic_handler::{closure#0}, !>
   9:     0x7fa1cdf204ed - __rustc[9ef169d0760644a0]::rust_begin_unwind
  10:     0x7fa1caaf39cc - core[d6e61f80bd84b1aa]::panicking::panic_fmt
  11:     0x7fa1cfc8a56a - <rustc_expand[a1d7ead742a1bfef]::expand::MacroExpander>::fully_expand_fragment
  12:     0x7fa1cfc1fadb - <rustc_expand[a1d7ead742a1bfef]::expand::MacroExpander>::expand_crate
  13:     0x7fa1ceb61244 - rustc_interface[165454881ff1a59b]::passes::configure_and_expand
  14:     0x7fa1cf8d5e38 - rustc_interface[165454881ff1a59b]::passes::resolver_for_lowering_raw
  15:     0x7fa1cf8d5ba3 - rustc_query_impl[62dde3202d61a64e]::query_impl::resolver_for_lowering_raw::invoke_provider_fn::__rust_begin_short_backtrace
  16:     0x7fa1cf8a0da9 - rustc_query_impl[62dde3202d61a64e]::execution::try_execute_query::<rustc_middle[c5a7798a8191db22]::query::caches::SingleCache<rustc_middle[c5a7798a8191db22]::query::erase::ErasedData<[u8; 16usize]>>, false>
  17:     0x7fa1cf8a08f8 - rustc_query_impl[62dde3202d61a64e]::query_impl::resolver_for_lowering_raw::execute_query_non_incr::__rust_end_short_backtrace
  18:     0x7fa1cf856172 - rustc_interface[165454881ff1a59b]::interface::run_compiler::<(), rustc_driver_impl[da6c6aa1c22ed2c8]::run_compiler::{closure#0}>::{closure#1}
  19:     0x7fa1cf87b1fe - std[98a29328132e9808]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[165454881ff1a59b]::util::run_in_thread_with_globals<rustc_interface[165454881ff1a59b]::util::run_in_thread_pool_with_globals<rustc_interface[165454881ff1a59b]::interface::run_compiler<(), rustc_driver_impl[da6c6aa1c22ed2c8]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  20:     0x7fa1cf87baa0 - <std[98a29328132e9808]::thread::lifecycle::spawn_unchecked<rustc_interface[165454881ff1a59b]::util::run_in_thread_with_globals<rustc_interface[165454881ff1a59b]::util::run_in_thread_pool_with_globals<rustc_interface[165454881ff1a59b]::interface::run_compiler<(), rustc_driver_impl[da6c6aa1c22ed2c8]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[d6e61f80bd84b1aa]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  21:     0x7fa1cf87c92c - <std[98a29328132e9808]::sys::thread::unix::Thread>::new::thread_start
  22:     0x7fa1c92a598b - <unknown>
  23:     0x7fa1c9329a0c - <unknown>
  24:                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.96.0-nightly (3b1b0ef4d 2026-03-11) 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 2 previous errors

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

@rustbot label +F-extern_item_impls +F-contracts

Metadata

Metadata

Assignees

Labels

A-attributesArea: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.F-contracts`#![feature(contracts)]`F-extern_item_impls`#![feature(extern_item_impls)]`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
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