Skip to content

[ICE]: foreign item sig #152893

@cushionbadak

Description

@cushionbadak

Code

#![feature(extern_item_impls)]

struct Foo;

#[eii]
pub fn Foo(x: u64) {}

fn main() {}

A mutant of tests/ui/eii/default/local_crate_explicit.rs

Meta

rustc --version --verbose:

rustc 1.95.0-nightly (7f99507f5 2026-02-19)
binary: rustc
commit-hash: 7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312
commit-date: 2026-02-19
host: x86_64-apple-darwin
release: 1.95.0-nightly
LLVM version: 22.1.0

Error output

Command: rustc

error[E0428]: the name `Foo` is defined multiple times
 --> iter8_73cda55fdec9bb35.rs:6:1
  |
3 | struct Foo;
  | ----------- previous definition of the value `Foo` here
...
6 | pub fn Foo(x: u64) {}
  | ^^^^^^^^^^^^^^^^^^ `Foo` redefined here
  |
  = note: `Foo` must be defined only once in the value namespace of this module


thread 'rustc' (15613403) panicked at /rustc-dev/7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312/compiler/rustc_hir_analysis/src/check/compare_eii.rs:276:68:
foreign item sig
Backtrace

thread 'rustc' (15613403) panicked at /rustc-dev/7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312/compiler/rustc_hir_analysis/src/check/compare_eii.rs:276:68:
foreign item sig
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::option::expect_failed
   3: rustc_hir_analysis::check::compare_eii::compare_eii_function_types
   4: rustc_hir_analysis::check::wfcheck::check_item_fn
   5: rustc_hir_analysis::check::check::check_item_type
   6: rustc_hir_analysis::check::wfcheck::check_well_formed
      [... omitted 1 frame ...]
   7: rustc_hir_analysis::check::wfcheck::check_type_wf
      [... omitted 1 frame ...]
   8: rustc_hir_analysis::check_crate
   9: rustc_interface::passes::analysis
  10: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, {rustc_query_impl::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
  11: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
  12: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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: please attach the file at `/Volumes/T7/workspace/out-260219/scratch/rustc-ice-2026-02-20T08_45_54-97550.txt` to your bug report

note: rustc 1.95.0-nightly (7f99507f5 2026-02-19) running on x86_64-apple-darwin

query stack during panic:
#0 [check_well_formed] checking that `_::Foo` is well-formed
#1 [check_type_wf] checking that types are well-formed
#2 [analysis] running analysis passes on crate `iter8_73cda55fdec9bb35`
end of query stack
error: aborting due to 1 previous error

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

Notes

  • ICE location: compiler/rustc_hir_analysis/src/check/compare_eii.rs Line-276
    fn report_number_of_arguments_mismatch<'tcx>(
    tcx: TyCtxt<'tcx>,
    external_impl: LocalDefId,
    declaration: DefId,
    eii_name: Symbol,
    eii_attr_span: Span,
    declaration_number_args: usize,
    external_impl_number_args: usize,
    ) -> ErrorGuaranteed {
    let external_impl_name = tcx.item_name(external_impl.to_def_id());
    let declaration_span = declaration
    .as_local()
    .and_then(|def_id| {
    let declaration_sig = get_declaration_sig(tcx, def_id).expect("foreign item sig");

@rustbot label +F-extern_item_impls

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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