Skip to content

ICE: no entry found for key in compiler/rustc_ast_lowering/src/expr.rs #148889

@cushionbadak

Description

@cushionbadak

Code

#![allow(incomplete_features)]
#![feature(fn_delegation)]

trait Trait {
    fn static_method2(x: i32, y: i32) -> i32 {
        x + y
    }
}

struct S;
impl Trait for S {}

pub fn main() {
    'foo: loop {
        reuse <S as Trait>::static_method2 { loop { break 'foo; } }
    }
}

A mutant of tests/ui/for-loop-while/issue-2216.rs

Meta

rustc --version --verbose:

rustc 1.93.0-nightly (01867557c 2025-11-12)
binary: rustc
commit-hash: 01867557cd7dbe256a031a7b8e28d05daecd75ab
commit-date: 2025-11-12
host: x86_64-apple-darwin
release: 1.93.0-nightly
LLVM version: 21.1.5

Error output

Command: rustc

thread 'rustc' (225443) panicked at compiler/rustc_ast_lowering/src/expr.rs:1592:68:
no entry found for key
Backtrace

thread 'rustc' (225443) panicked at compiler/rustc_ast_lowering/src/expr.rs:1592:68:
no entry found for key
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::option::expect_failed
   3: <rustc_ast_lowering::LoweringContext>::lower_loop_destination
   4: <rustc_ast_lowering::LoweringContext>::lower_jump_destination
   5: <rustc_ast_lowering::LoweringContext>::lower_expr_mut::{closure#0}
   6: <rustc_ast_lowering::LoweringContext>::lower_stmts
   7: <rustc_ast_lowering::LoweringContext>::lower_expr_mut::{closure#0}::{closure#2}
   8: <rustc_ast_lowering::LoweringContext>::lower_expr_mut::{closure#0}
   9: <rustc_ast_lowering::LoweringContext>::lower_delegation
  10: <rustc_ast_lowering::LoweringContext>::lower_item_kind
  11: <rustc_ast_lowering::item::ItemLowerer>::lower_node
  12: rustc_ast_lowering::lower_to_hir
      [... omitted 1 frame ...]
  13: <rustc_middle::hir::provide::{closure#1} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
      [... omitted 1 frame ...]
  14: <rustc_middle::ty::context::TyCtxt>::expect_hir_owner_node
  15: rustc_middle::hir::map::hir_crate_items
      [... omitted 1 frame ...]
  16: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  17: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
  18: 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 `/Users/jb/Library/CloudStorage/Dropbox/Desk/2503_rustc_ice/251109 ice 보고용/rustc-ice-2025-11-13T04_13_04-51730.txt` to your bug report

query stack during panic:
#0 [hir_crate] getting the crate HIR
#1 [opt_hir_owner_nodes] getting HIR owner items in ``
#2 [hir_crate_items] getting HIR crate items
#3 [analysis] running analysis passes on crate `02`
end of query stack

Notes

  • ICE location: compiler/rustc_ast_lowering/src/expr.rs Line-1592
    fn lower_loop_destination(&mut self, destination: Option<(NodeId, Label)>) -> hir::Destination {
    let target_id = match destination {
    Some((id, _)) => {
    if let Some(loop_id) = self.resolver.get_label_res(id) {
    let local_id = self.ident_and_label_to_local_id[&loop_id];
    let loop_hir_id = HirId { owner: self.current_hir_id_owner, local_id };
    Ok(loop_hir_id)
    } else {
    Err(hir::LoopIdError::UnresolvedLabel)
    }
    }

Duplication Check

@rustbot label +F-fn_delegation

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-fn_delegation`#![feature(fn_delegation)]`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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions