Skip to content

ice: item_name: no name for DefPath { .. } #113405

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

rustc -Zlower-impl-trait-in-trait-to-assoc-ty file.rs

trait MyTrait<'a, 'b, T> {
    async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
}

impl<'a, 'b, T, U> MyTrait<T> for U {
    async fn foo(_: T) -> (&'a U, &'b T) {}
}

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (d9c13cd45 2023-07-05)
binary: rustc
commit-hash: d9c13cd4531649c2028a8384cb4d4e54f985380e
commit-date: 2023-07-05
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5

Error output

error[E0670]: `async fn` is not permitted in Rust 2015
 --> treereduce.out:2:5
  |
2 |     async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
  |     ^^^^^ to use `async fn`, switch to Rust 2018 or later
  |
  = help: pass `--edition 2021` to `rustc`
  = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in Rust 2015
 --> treereduce.out:6:5
  |
6 |     async fn foo(_: T) -> (&'a U, &'b T) {}
  |     ^^^^^ to use `async fn`, switch to Rust 2018 or later
  |
  = help: pass `--edition 2021` to `rustc`
  = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0726]: implicit elided lifetime not allowed here
 --> treereduce.out:5:20
  |
5 | impl<'a, 'b, T, U> MyTrait<T> for U {
  |                    ^^^^^^^^^^ expected lifetime parameters
  |
help: indicate the anonymous lifetimes
  |
5 | impl<'a, 'b, T, U> MyTrait<'_, '_, T> for U {
  |                            +++++++

error[E0412]: cannot find type `ConnImpl` in this scope
 --> treereduce.out:2:48
  |
2 |     async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
  |                                                ^^^^^^^^ not found in this scope

error[E0706]: functions in traits cannot be declared `async`
 --> treereduce.out:2:5
  |
2 |     async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
  |     -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |     |
  |     `async` because of this
  |
  = note: `async` trait functions are not currently supported
  = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
  = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
  = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable

error[E0706]: functions in traits cannot be declared `async`
 --> treereduce.out:6:5
  |
6 |     async fn foo(_: T) -> (&'a U, &'b T) {}
  |     -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |     |
  |     `async` because of this
  |
  = note: `async` trait functions are not currently supported
  = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
  = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
  = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable

error[E0601]: `main` function not found in crate `treereduce`
 --> treereduce.out:7:2
  |
7 | }
  |  ^ consider adding a `main` function to `treereduce.out`

error[E0186]: method `foo` has a `&self` declaration in the trait, but not in the impl
 --> treereduce.out:6:5
  |
2 |     async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
  |     ------------------------------------------------------------ `&self` used in trait
...
6 |     async fn foo(_: T) -> (&'a U, &'b T) {}
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&self` in impl
Backtrace

error: internal compiler error: compiler/rustc_middle/src/ty/mod.rs:2319:13: item_name: no name for DefPath { data: [DisambiguatedDefPathData { data: Impl, disambiguator: 0 }, DisambiguatedDefPathData { data: ImplTraitAssocTy, disambiguator: 0 }], krate: crate0 }

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/compiler/rustc_errors/src/lib.rs:1651:9
stack backtrace:
   0:     0x7f153f5f3a81 - std::backtrace_rs::backtrace::libunwind::trace::h3c8b1207af9f7dc4
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f153f5f3a81 - std::backtrace_rs::backtrace::trace_unsynchronized::h6cc4d1ef12765b77
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f153f5f3a81 - std::sys_common::backtrace::_print_fmt::h4b58ac6692087093
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f153f5f3a81 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4cfe701aadad59ba
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f153f659d8f - core::fmt::rt::Argument::fmt::h017682705ed0d628
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/core/src/fmt/rt.rs:138:9
   5:     0x7f153f659d8f - core::fmt::write::h69b96bfc1fe292d1
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f153f5e63c7 - std::io::Write::write_fmt::h320e7f56f42ea27f
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/io/mod.rs:1714:15
   7:     0x7f153f5f3895 - std::sys_common::backtrace::_print::h0061961dcfb0fc1f
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f153f5f3895 - std::sys_common::backtrace::print::h3caf3df7088e0a43
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f153f5f6673 - std::panicking::default_hook::{{closure}}::h77ae45a48b0419f4
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/panicking.rs:269:22
  10:     0x7f153f5f6404 - std::panicking::default_hook::h1750cbe688cc23cf
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/panicking.rs:288:9
  11:     0x7f153e472cab - rustc_driver_impl[c8224e60c583ce9e]::install_ice_hook::{closure#0}
  12:     0x7f153f5f6e9e - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h2f7c4b5be15d65f3
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/alloc/src/boxed.rs:2024:9
  13:     0x7f153f5f6e9e - std::panicking::rust_panic_with_hook::hb1e7052d584ca5b8
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/panicking.rs:709:13
  14:     0x7f153ea25591 - std[fa0d0b5c306c9702]::panicking::begin_panic::<rustc_errors[debfdcf65a618740]::ExplicitBug>::{closure#0}
  15:     0x7f153ea24c86 - std[fa0d0b5c306c9702]::sys_common::backtrace::__rust_end_short_backtrace::<std[fa0d0b5c306c9702]::panicking::begin_panic<rustc_errors[debfdcf65a618740]::ExplicitBug>::{closure#0}, !>
  16:     0x7f153ea24196 - std[fa0d0b5c306c9702]::panicking::begin_panic::<rustc_errors[debfdcf65a618740]::ExplicitBug>
  17:     0x7f153ea302e4 - <rustc_errors[debfdcf65a618740]::HandlerInner>::bug::<alloc[60c0f1c9ed75b84c]::string::String>
  18:     0x7f153ea30166 - <rustc_errors[debfdcf65a618740]::Handler>::bug::<alloc[60c0f1c9ed75b84c]::string::String>
  19:     0x7f153e96d93c - rustc_middle[a92143083d338f81]::util::bug::opt_span_bug_fmt::<rustc_span[c131c644fb7cb5fa]::span_encoding::Span>::{closure#0}
  20:     0x7f153e96d04a - rustc_middle[a92143083d338f81]::ty::context::tls::with_opt::<rustc_middle[a92143083d338f81]::util::bug::opt_span_bug_fmt<rustc_span[c131c644fb7cb5fa]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f153e96d01a - rustc_middle[a92143083d338f81]::ty::context::tls::with_context_opt::<rustc_middle[a92143083d338f81]::ty::context::tls::with_opt<rustc_middle[a92143083d338f81]::util::bug::opt_span_bug_fmt<rustc_span[c131c644fb7cb5fa]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f153c6e344d - rustc_middle[a92143083d338f81]::util::bug::bug_fmt
  23:     0x7f153c9622f6 - <rustc_middle[a92143083d338f81]::ty::context::TyCtxt>::item_name
  24:     0x7f153e7f87b0 - <rustc_infer[513a04dd9302731b]::infer::InferCtxt>::report_extra_impl_obligation
  25:     0x7f153e77a8ed - <rustc_infer[513a04dd9302731b]::infer::error_reporting::TypeErrCtxt>::report_concrete_failure
  26:     0x7f153e782de0 - <rustc_infer[513a04dd9302731b]::infer::error_reporting::TypeErrCtxt>::report_region_errors
  27:     0x7f153d2f14b7 - <rustc_trait_selection[41dd4520de8bf710]::traits::engine::ObligationCtxt>::resolve_regions_and_report_errors
  28:     0x7f153d3861ae - rustc_hir_analysis[58a31f7655e3c3]::check::compare_impl_item::compare_impl_ty
  29:     0x7f153d3781d0 - rustc_hir_analysis[58a31f7655e3c3]::check::check::check_mod_item_types
  30:     0x7f153d106bcc - rustc_query_impl[7a314159d938cad9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7a314159d938cad9]::query_impl::check_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a92143083d338f81]::query::erase::Erased<[u8; 0usize]>>
  31:     0x7f153d106bae - <rustc_query_impl[7a314159d938cad9]::query_impl::check_mod_item_types::dynamic_query::{closure#2} as core[39f2cadfad9b7192]::ops::function::FnOnce<(rustc_middle[a92143083d338f81]::ty::context::TyCtxt, rustc_span[c131c644fb7cb5fa]::def_id::LocalDefId)>>::call_once
  32:     0x7f153cb0065f - rustc_query_system[fcf123a786d6e0bc]::query::plumbing::try_execute_query::<rustc_query_impl[7a314159d938cad9]::DynamicConfig<rustc_query_system[fcf123a786d6e0bc]::query::caches::VecCache<rustc_span[c131c644fb7cb5fa]::def_id::LocalDefId, rustc_middle[a92143083d338f81]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[7a314159d938cad9]::plumbing::QueryCtxt, false>
  33:     0x7f153ddce9a4 - rustc_query_impl[7a314159d938cad9]::query_impl::check_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7f153d8b0ca7 - <rustc_middle[a92143083d338f81]::hir::map::Map>::for_each_module::<rustc_hir_analysis[58a31f7655e3c3]::check_crate::{closure#6}::{closure#0}>
  35:     0x7f153d8b00dd - <rustc_session[ba0171e1a42d92f9]::session::Session>::time::<(), rustc_hir_analysis[58a31f7655e3c3]::check_crate::{closure#6}>
  36:     0x7f153d8aed67 - rustc_hir_analysis[58a31f7655e3c3]::check_crate
  37:     0x7f153d8a5dda - rustc_interface[6ebb3a637cfebd5]::passes::analysis
  38:     0x7f153d93368a - rustc_query_impl[7a314159d938cad9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7a314159d938cad9]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a92143083d338f81]::query::erase::Erased<[u8; 1usize]>>
  39:     0x7f153d933679 - <rustc_query_impl[7a314159d938cad9]::query_impl::analysis::dynamic_query::{closure#2} as core[39f2cadfad9b7192]::ops::function::FnOnce<(rustc_middle[a92143083d338f81]::ty::context::TyCtxt, ())>>::call_once
  40:     0x7f153daad878 - rustc_query_system[fcf123a786d6e0bc]::query::plumbing::try_execute_query::<rustc_query_impl[7a314159d938cad9]::DynamicConfig<rustc_query_system[fcf123a786d6e0bc]::query::caches::SingleCache<rustc_middle[a92143083d338f81]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[7a314159d938cad9]::plumbing::QueryCtxt, false>
  41:     0x7f153daad649 - rustc_query_impl[7a314159d938cad9]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7f153d65d455 - <rustc_middle[a92143083d338f81]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[c8224e60c583ce9e]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>>
  43:     0x7f153d65ca82 - <rustc_interface[6ebb3a637cfebd5]::interface::Compiler>::enter::<rustc_driver_impl[c8224e60c583ce9e]::run_compiler::{closure#1}::{closure#2}, core[39f2cadfad9b7192]::result::Result<core[39f2cadfad9b7192]::option::Option<rustc_interface[6ebb3a637cfebd5]::queries::Linker>, rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>>
  44:     0x7f153d653795 - rustc_span[c131c644fb7cb5fa]::set_source_map::<core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>, rustc_interface[6ebb3a637cfebd5]::interface::run_compiler<core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>, rustc_driver_impl[c8224e60c583ce9e]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  45:     0x7f153d653206 - <scoped_tls[8bf4edb3452830f]::ScopedKey<rustc_span[c131c644fb7cb5fa]::SessionGlobals>>::set::<rustc_interface[6ebb3a637cfebd5]::interface::run_compiler<core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>, rustc_driver_impl[c8224e60c583ce9e]::run_compiler::{closure#1}>::{closure#0}, core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>>
  46:     0x7f153d6527cc - std[fa0d0b5c306c9702]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6ebb3a637cfebd5]::util::run_in_thread_pool_with_globals<rustc_interface[6ebb3a637cfebd5]::interface::run_compiler<core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>, rustc_driver_impl[c8224e60c583ce9e]::run_compiler::{closure#1}>::{closure#0}, core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>>
  47:     0x7f153d652595 - <<std[fa0d0b5c306c9702]::thread::Builder>::spawn_unchecked_<rustc_interface[6ebb3a637cfebd5]::util::run_in_thread_pool_with_globals<rustc_interface[6ebb3a637cfebd5]::interface::run_compiler<core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>, rustc_driver_impl[c8224e60c583ce9e]::run_compiler::{closure#1}>::{closure#0}, core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>>::{closure#1} as core[39f2cadfad9b7192]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  48:     0x7f153f601315 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h21ee91033946694b
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/alloc/src/boxed.rs:2010:9
  49:     0x7f153f601315 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hdf07228f28997b56
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/alloc/src/boxed.rs:2010:9
  50:     0x7f153f601315 - std::sys::unix::thread::Thread::new::thread_start::h79fe093c0599c14c
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/sys/unix/thread.rs:108:17
  51:     0x7f153b06444b - <unknown>
  52:     0x7f153b0e7e40 - <unknown>
  53:                0x0 - <unknown>

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: rustc 1.72.0-nightly (d9c13cd45 2023-07-05) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z lower-impl-trait-in-trait-to-assoc-ty

query stack during panic:
#0 [check_mod_item_types] checking item types in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 9 previous errors

Some errors have detailed explanations: E0186, E0412, E0601, E0670, E0706, E0726.
For more information about an error, try `rustc --explain E0186`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions