Skip to content

ICE: eii on impl: expected statement #149980

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

fn main() {
    #[eii]
    impl Bar {}
}

original:

#![feature(extern_item_impls)]
fn main() {
    #[eii]
    impl Bar {}
}

Version information

rustc 1.94.0-nightly (3f4dc1e02 2025-12-14)
binary: rustc
commit-hash: 3f4dc1e02d759aa3c3807d4efc1f7f6e293536a5
commit-date: 2025-12-14
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.5

Possibly related line of code:

}
}
pub fn expect_stmt(self) -> ast::Stmt {
match self {
Annotatable::Stmt(stmt) => *stmt,
_ => panic!("expected statement"),
}
}
pub fn expect_expr(self) -> Box<ast::Expr> {
match self {
Annotatable::Expr(expr) => expr,

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

Program output

error[E0658]: use of unstable library feature `extern_item_impls`
 --> /tmp/icemaker_global_tempdir.H7kAaxdihhDG/rustc_testrunner_tmpdir_reporting.UmhLa2FjaPWt/mvce.rs:2:7
  |
2 |     #[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 2025-12-14; consider upgrading it if it is out of date

error: `#[eii]` is only valid on functions
 --> /tmp/icemaker_global_tempdir.H7kAaxdihhDG/rustc_testrunner_tmpdir_reporting.UmhLa2FjaPWt/mvce.rs:2:5
  |
2 |     #[eii]
  |     ^^^^^^


thread 'rustc' (3711055) panicked at compiler/rustc_expand/src/base.rs:176:18:
expected statement
stack backtrace:
   0:     0x7f6b52190173 - <<std[e49fa185a119b89b]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[17865207963548b5]::fmt::Display>::fmt
   1:     0x7f6b52810648 - core[17865207963548b5]::fmt::write
   2:     0x7f6b521a67c6 - <std[e49fa185a119b89b]::sys::stdio::unix::Stderr as std[e49fa185a119b89b]::io::Write>::write_fmt
   3:     0x7f6b52166938 - std[e49fa185a119b89b]::panicking::default_hook::{closure#0}
   4:     0x7f6b52184043 - std[e49fa185a119b89b]::panicking::default_hook
   5:     0x7f6b511741d7 - std[e49fa185a119b89b]::panicking::update_hook::<alloc[756b9f94e2773738]::boxed::Box<rustc_driver_impl[e1c4671be5271ce8]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f6b52184322 - std[e49fa185a119b89b]::panicking::panic_with_hook
   7:     0x7f6b52166a2a - std[e49fa185a119b89b]::panicking::panic_handler::{closure#0}
   8:     0x7f6b5215dab9 - std[e49fa185a119b89b]::sys::backtrace::__rust_end_short_backtrace::<std[e49fa185a119b89b]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f6b521685ad - __rustc[df3bb69314ad135f]::rust_begin_unwind
  10:     0x7f6b4f46df0c - core[17865207963548b5]::panicking::panic_fmt
  11:     0x7f6b53db47a5 - <rustc_expand[ad9a400ec1ef25e2]::expand::MacroExpander>::fully_expand_fragment
  12:     0x7f6b53d5f998 - <rustc_expand[ad9a400ec1ef25e2]::expand::MacroExpander>::expand_crate
  13:     0x7f6b52ff45b2 - rustc_interface[50af632e35c6bce3]::passes::configure_and_expand
  14:     0x7f6b53965e98 - rustc_interface[50af632e35c6bce3]::passes::resolver_for_lowering_raw
  15:     0x7f6b53965c0d - rustc_query_impl[462c6a5584cea8d4]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[462c6a5584cea8d4]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7055997c00c0bb98]::query::erase::Erased<[u8; 16usize]>>
  16:     0x7f6b53965be7 - <rustc_query_impl[462c6a5584cea8d4]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[17865207963548b5]::ops::function::FnOnce<(rustc_middle[7055997c00c0bb98]::ty::context::TyCtxt, ())>>::call_once
  17:     0x7f6b53971b1f - rustc_query_system[5be0c069f6d5c539]::query::plumbing::try_execute_query::<rustc_query_impl[462c6a5584cea8d4]::DynamicConfig<rustc_query_system[5be0c069f6d5c539]::query::caches::SingleCache<rustc_middle[7055997c00c0bb98]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[462c6a5584cea8d4]::plumbing::QueryCtxt, false>
  18:     0x7f6b5397167c - rustc_query_impl[462c6a5584cea8d4]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  19:     0x7f6b53b2ccfb - <rustc_interface[50af632e35c6bce3]::passes::create_and_enter_global_ctxt<core[17865207963548b5]::option::Option<rustc_interface[50af632e35c6bce3]::queries::Linker>, rustc_driver_impl[e1c4671be5271ce8]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[17865207963548b5]::ops::function::FnOnce<(&rustc_session[307f8e7a4263bd4]::session::Session, rustc_middle[7055997c00c0bb98]::ty::context::CurrentGcx, alloc[756b9f94e2773738]::sync::Arc<rustc_data_structures[30161969bbcb553f]::jobserver::Proxy>, &std[e49fa185a119b89b]::sync::once_lock::OnceLock<rustc_middle[7055997c00c0bb98]::ty::context::GlobalCtxt>, &rustc_data_structures[30161969bbcb553f]::sync::worker_local::WorkerLocal<rustc_middle[7055997c00c0bb98]::arena::Arena>, &rustc_data_structures[30161969bbcb553f]::sync::worker_local::WorkerLocal<rustc_hir[5d00f225b65c0257]::Arena>, rustc_driver_impl[e1c4671be5271ce8]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  20:     0x7f6b539c19da - rustc_interface[50af632e35c6bce3]::interface::run_compiler::<(), rustc_driver_impl[e1c4671be5271ce8]::run_compiler::{closure#0}>::{closure#1}
  21:     0x7f6b53931d8e - std[e49fa185a119b89b]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[50af632e35c6bce3]::util::run_in_thread_with_globals<rustc_interface[50af632e35c6bce3]::util::run_in_thread_pool_with_globals<rustc_interface[50af632e35c6bce3]::interface::run_compiler<(), rustc_driver_impl[e1c4671be5271ce8]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  22:     0x7f6b53931b60 - <std[e49fa185a119b89b]::thread::lifecycle::spawn_unchecked<rustc_interface[50af632e35c6bce3]::util::run_in_thread_with_globals<rustc_interface[50af632e35c6bce3]::util::run_in_thread_pool_with_globals<rustc_interface[50af632e35c6bce3]::interface::run_compiler<(), rustc_driver_impl[e1c4671be5271ce8]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[17865207963548b5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  23:     0x7f6b539374f8 - <std[e49fa185a119b89b]::sys::thread::unix::Thread>::new::thread_start
  24:     0x7f6b4d2969cb - <unknown>
  25:     0x7f6b4d31aa0c - <unknown>
  26:                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.94.0-nightly (3f4dc1e02 2025-12-14) 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions