Skip to content

[ICE]: item_name: no name for DefPath #152887

@cushionbadak

Description

@cushionbadak

Code

#![feature(return_type_notation)]
pub trait Foo {
    async fn bar();
}
trait Bar {}

impl<T: Foo<bar(..): Send>> Foo for T where T: Bar {
}
fn needs_foo(_: impl Foo) {}

trait Mirror {
    type Mirror;
}
impl<T> Mirror for T {
    type Mirror = T;
}

fn hello<T>() where <T as Mirror>::Mirror: Foo {
    needs_foo(());
}

fn main() {}

Mutant of tests/ui/traits/next-solver/diagnostics/where-clause-doesnt-apply.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 --edition=2024
It ICEs at no-edition too, but put it to reduce error message length.

error[E0046]: not all trait items implemented, missing: `bar`
 --> iter9_23c3d7db5173f2ab.rs:7:1
  |
3 |     async fn bar();
  |     --------------- `bar` from trait
...
7 | impl<T: Foo<bar(..): Send>> Foo for T where T: Bar {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `bar` in implementation

error[E0277]: the trait bound `(): Foo` is not satisfied
  --> iter9_23c3d7db5173f2ab.rs:19:15
   |
19 |     needs_foo(());
   |     --------- ^^ the trait `Bar` is not implemented for `()`
   |     |
   |     required by a bound introduced by this call
   |
help: this trait has no implementations, consider adding one
  --> iter9_23c3d7db5173f2ab.rs:5:1
   |
 5 | trait Bar {}
   | ^^^^^^^^^
note: required for `()` to implement `Foo`
  --> iter9_23c3d7db5173f2ab.rs:7:29
   |
 7 | impl<T: Foo<bar(..): Send>> Foo for T where T: Bar {
   |                             ^^^     ^          --- unsatisfied trait bound introduced here
   = note: 1 redundant requirement hidden
   = note: required for `()` to implement `Foo`
note: required by a bound in `needs_foo`
  --> iter9_23c3d7db5173f2ab.rs:9:22
   |
 9 | fn needs_foo(_: impl Foo) {}
   |                      ^^^ required by this bound in `needs_foo`

error: internal compiler error: /rustc-dev/7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312/compiler/rustc_middle/src/ty/mod.rs:1556:13: item_name: no name for DefPath { data: [DisambiguatedDefPathData { data: TypeNs("Foo"), disambiguator: 0 }, DisambiguatedDefPathData { data: AnonAssocTy("bar"), disambiguator: 0 }], krate: crate0 }


thread 'rustc' (15452564) panicked at /rustc-dev/7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312/compiler/rustc_middle/src/ty/mod.rs:1556:13:
Box<dyn Any>
Backtrace

thread 'rustc' (15452564) panicked at /rustc-dev/7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312/compiler/rustc_middle/src/ty/mod.rs:1556:13:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   5: rustc_middle::util::bug::bug_fmt
   6: <rustc_middle::ty::context::TyCtxt>::item_name::<rustc_span::def_id::DefId>::{closure#0}
   7: rustc_trait_selection::error_reporting::traits::suggestions::point_at_assoc_type_restriction::<rustc_span::ErrorGuaranteed>
   8: <rustc_trait_selection::error_reporting::TypeErrCtxt>::note_obligation_cause_code::<rustc_span::ErrorGuaranteed, rustc_middle::ty::predicate::Predicate>
   9: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_overflow_error::<<rustc_trait_selection::error_reporting::TypeErrCtxt>::report_overflow_obligation<rustc_middle::ty::predicate::Predicate>::{closure#0}>
  10: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_overflow_obligation::<rustc_middle::ty::predicate::Predicate>
  11: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_overflow_obligation_cycle
  12: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_fulfillment_errors
  13: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  14: <rustc_hir_typeck::fn_ctxt::FnCtxt>::confirm_builtin_call
  15: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
  16: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  17: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
  18: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  19: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_or_body_tail
  20: rustc_hir_typeck::check::check_fn
  21: rustc_hir_typeck::typeck_with_inspect::{closure#0}
  22: rustc_hir_typeck::typeck
  23: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_hir_id::OwnerId, rustc_middle::query::erase::ErasedData<[u8; 8]>, rustc_middle::dep_graph::graph::DepNodeIndex>, {rustc_query_impl::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
  24: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis::check_crate::{closure#2}>::{closure#0}
  25: rustc_hir_analysis::check_crate
  26: rustc_interface::passes::analysis
  27: 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>
  28: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
  29: 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.

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-20T07_47_13-46327.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 [typeck] type-checking `hello`
#1 [analysis] running analysis passes on crate `iter9_23c3d7db5173f2ab`
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0046, E0277.
For more information about an error, try `rustc --explain E0046`.

Regression

Regression in 2024-01-26
Command: cargo bisect-rustc --start=2024-01-01 --end=2026-02-18 --regress ice --preserve --script rustc -- noname.rs

Log
searched toolchains nightly-2024-01-01 through nightly-2026-02-18




********************************************************************************
Regression in nightly-2024-01-26
********************************************************************************


fetching https://static.rust-lang.org/dist/2024-01-25/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2024-01-25: 40 B / 40 B [==================================================================] 100.00 % 1.03 MB/s converted 2024-01-25 to 7ffc697ce10f19447c0ce338428ae4b9bc0c041c
fetching https://static.rust-lang.org/dist/2024-01-26/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2024-01-26: 40 B / 40 B [================================================================] 100.00 % 850.92 KB/s converted 2024-01-26 to 5bd5d214effd494f4bafb29b3a7a2f6c2070ca5c
looking for regression commit between 2024-01-25 and 2024-01-26
fetching (via remote github) commits from max(7ffc697ce10f19447c0ce338428ae4b9bc0c041c, 2024-01-23) to 5bd5d214effd494f4bafb29b3a7a2f6c2070ca5c
ending github query because we found starting sha: 7ffc697ce10f19447c0ce338428ae4b9bc0c041c
get_commits_between returning commits, len: 5
  commit[0] 2024-01-24: Auto merge of #120309 - fmease:rollup-kr7wqy6, r=fmease
  commit[1] 2024-01-25: Auto merge of #119627 - oli-obk:const_prop_lint_n̵o̵n̵sense, r=cjgillot
  commit[2] 2024-01-25: Auto merge of #119911 - NCGThompson:is-statically-known, r=oli-obk
  commit[3] 2024-01-25: Auto merge of #119955 - kamalesh0406:master, r=WaffleLapkin
  commit[4] 2024-01-25: Auto merge of #120335 - matthiaskrgr:rollup-2a0y3rd, r=matthiaskrgr
ERROR: no CI builds available between 7ffc697ce10f19447c0ce338428ae4b9bc0c041c and 5bd5d214effd494f4bafb29b3a7a2f6c2070ca5c within last 167 days

Notes

  • ICE location: compiler/rustc_middle/src/ty/mod.rs Line-1556

    /// Look up the name of a definition across crates. This does not look at HIR.
    ///
    /// This method will ICE if the corresponding item does not have a name. In these cases, use
    /// [`opt_item_name`] instead.
    ///
    /// [`opt_item_name`]: Self::opt_item_name
    pub fn item_name(self, id: impl IntoQueryParam<DefId>) -> Symbol {
    let id = id.into_query_param();
    self.opt_item_name(id).unwrap_or_else(|| {
    bug!("item_name: no name for {:?}", self.def_path(id));
    })
    }

  • Duplication Check

    • Query "item_name: no name" shows open issues 125099 and 127331, but they doesn't ICE for now.

@rustbot label +F-return_type_notation

Metadata

Metadata

Assignees

Labels

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