rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.57k stars 12.74k forks source link

ICE: `item_name: no name for DefPath` #116031

Closed matthiaskrgr closed 1 year ago

matthiaskrgr commented 1 year ago

Code

#![feature(type_alias_impl_trait)]

pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;

pub fn main() {}

Meta

rustc --version --verbose:

rustc 1.74.0-nightly (3223b0b5e 2023-09-20)
binary: rustc
commit-hash: 3223b0b5e8dadda3f76c3fd1a8d6c5addc09599e
commit-date: 2023-09-20
host: x86_64-unknown-linux-gnu
release: 1.74.0-nightly
LLVM version: 17.0.0

Error output

 --> 76763E5DC6AE6ABA23B770362FAE63C109414F5F9F4688E091EC3407A9B9CB1E.rs:3:40
  |
3 | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
  |                                        ^^^ undeclared lifetime
  |
  = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'db` lifetime
  |
3 | pub type Tait = impl for<'db> Iterator<Item = (&'db Key, impl Iterator)>;
  |                      ++++++++
help: consider introducing lifetime `'db` here
  |
3 | pub type Tait<'db> = impl Iterator<Item = (&'db Key, impl Iterator)>;
  |              +++++

error[E0412]: cannot find type `Key` in this scope
 --> 76763E5DC6AE6ABA23B770362FAE63C109414F5F9F4688E091EC3407A9B9CB1E.rs:3:44
  |
3 | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
  |                                            ^^^ not found in this scope
  |
help: consider importing this struct
  |
3 + use std::thread::local_impl::Key;
  |

error: unconstrained opaque type
 --> 76763E5DC6AE6ABA23B770362FAE63C109414F5F9F4688E091EC3407A9B9CB1E.rs:3:17
  |
3 | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `Tait` must be used in combination with a concrete type within the same module
Backtrace

```error: internal compiler error: compiler/rustc_middle/src/ty/mod.rs:2230:13: item_name: no name for DefPath { data: [DisambiguatedDefPathData { data: TypeNs("Tait"), disambiguator: 0 }, DisambiguatedDefPathData { data: ImplTrait, disambiguator: 0 }], krate: crate0 } thread 'rustc' panicked at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/compiler/rustc_errors/src/lib.rs:1651:9: Box stack backtrace: 0: 0x7f459af6402c - std::backtrace_rs::backtrace::libunwind::trace::h29c8374995c7d415 at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7f459af6402c - std::backtrace_rs::backtrace::trace_unsynchronized::h16cdf57e7d1bb070 at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7f459af6402c - std::sys_common::backtrace::_print_fmt::hbfb4f22585dcb2fd at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/std/src/sys_common/backtrace.rs:67:5 3: 0x7f459af6402c - ::fmt::hb0e43dc4856f6e03 at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7f459afc9e1c - core::fmt::rt::Argument::fmt::h82e137948f0d7ee4 at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/core/src/fmt/rt.rs:138:9 5: 0x7f459afc9e1c - core::fmt::write::h8b9ac4f4c7374e69 at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/core/src/fmt/mod.rs:1114:21 6: 0x7f459af56dae - std::io::Write::write_fmt::h9ce93f75df8e70bc at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/std/src/io/mod.rs:1714:15 7: 0x7f459af63e14 - std::sys_common::backtrace::_print::h954477bb2c14503b at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/std/src/sys_common/backtrace.rs:47:5 8: 0x7f459af63e14 - std::sys_common::backtrace::print::h38fd536905d677e7 at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7f459af66d33 - std::panicking::default_hook::{{closure}}::h0d512547687cad13 at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/std/src/panicking.rs:272:22 10: 0x7f459af66a54 - std::panicking::default_hook::h3c758d5c634aa6e1 at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/std/src/panicking.rs:292:9 11: 0x7f459e141d6f - std[423b84e37edbea9d]::panicking::update_hook::>::{closure#0} 12: 0x7f459af67561 - as core::ops::function::Fn>::call::hc1529ee1ff5c0ed4 at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/alloc/src/boxed.rs:2021:9 13: 0x7f459af67561 - std::panicking::rust_panic_with_hook::ha8fa8090a7e1cf35 at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/std/src/panicking.rs:735:13 14: 0x7f459e72c824 - std[423b84e37edbea9d]::panicking::begin_panic::::{closure#0} 15: 0x7f459e727906 - std[423b84e37edbea9d]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 16: 0x7f459e638ea6 - std[423b84e37edbea9d]::panicking::begin_panic:: 17: 0x7f459e68bc44 - ::bug:: 18: 0x7f459e68bb06 - ::bug:: 19: 0x7f459e64a024 - rustc_middle[7532cecbef1af146]::util::bug::opt_span_bug_fmt::::{closure#0} 20: 0x7f459e64945a - rustc_middle[7532cecbef1af146]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} 21: 0x7f459e649428 - rustc_middle[7532cecbef1af146]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> 22: 0x7f459c7cb9a0 - rustc_middle[7532cecbef1af146]::util::bug::bug_fmt 23: 0x7f459c65c3b6 - ::item_name 24: 0x7f459e244c09 - rustc_hir_analysis[417a0e0ce74bdc30]::collect::type_of::opaque::find_opaque_ty_constraints_for_tait 25: 0x7f459d775e11 - rustc_query_impl[4050e2da7ab96027]::plumbing::__rust_begin_short_backtrace::> 26: 0x7f459d775df1 - >::call_once 27: 0x7f459c2573f0 - rustc_query_system[f4eb094e69159de6]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[4050e2da7ab96027]::plumbing::QueryCtxt, false> 28: 0x7f459da9fce2 - rustc_query_impl[4050e2da7ab96027]::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace 29: 0x7f459cbd0a7f - rustc_hir_analysis[417a0e0ce74bdc30]::collect::type_of::type_of 30: 0x7f459c54079c - rustc_query_impl[4050e2da7ab96027]::plumbing::__rust_begin_short_backtrace::> 31: 0x7f459c540760 - >::call_once 32: 0x7f459c2573f0 - rustc_query_system[f4eb094e69159de6]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[4050e2da7ab96027]::plumbing::QueryCtxt, false> 33: 0x7f459da9f941 - rustc_query_impl[4050e2da7ab96027]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace 34: 0x7f459d113200 - rustc_middle[7532cecbef1af146]::query::plumbing::query_get_at::>> 35: 0x7f459d10d21a - rustc_hir_analysis[417a0e0ce74bdc30]::check::check::check_mod_item_types 36: 0x7f459cf3a46c - rustc_query_impl[4050e2da7ab96027]::plumbing::__rust_begin_short_backtrace::> 37: 0x7f459cf3a44e - >::call_once 38: 0x7f459d141058 - rustc_query_system[f4eb094e69159de6]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[4050e2da7ab96027]::plumbing::QueryCtxt, false> 39: 0x7f459daaaac4 - rustc_query_impl[4050e2da7ab96027]::query_impl::check_mod_item_types::get_query_non_incr::__rust_end_short_backtrace 40: 0x7f459d589877 - ::for_each_module:: 41: 0x7f459d587ff5 - rustc_hir_analysis[417a0e0ce74bdc30]::check_crate 42: 0x7f459d5816c2 - rustc_interface[8cb810cfd898a703]::passes::analysis 43: 0x7f459d592e3a - rustc_query_impl[4050e2da7ab96027]::plumbing::__rust_begin_short_backtrace::> 44: 0x7f459d592e29 - >::call_once 45: 0x7f459d8750e4 - rustc_query_system[f4eb094e69159de6]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[4050e2da7ab96027]::plumbing::QueryCtxt, false> 46: 0x7f459d874e59 - rustc_query_impl[4050e2da7ab96027]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 47: 0x7f459d62ab92 - ::enter::> 48: 0x7f459d629bb1 - rustc_span[52113c30dfc0425a]::set_source_map::, rustc_interface[8cb810cfd898a703]::interface::run_compiler, rustc_driver_impl[5065b449a99b292a]::run_compiler::{closure#1}>::{closure#0}::{closure#0}> 49: 0x7f459d62888e - std[423b84e37edbea9d]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[5065b449a99b292a]::run_compiler::{closure#1}>::{closure#0}, core[4ff1a1b12c81ae0a]::result::Result<(), rustc_span[52113c30dfc0425a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4ff1a1b12c81ae0a]::result::Result<(), rustc_span[52113c30dfc0425a]::ErrorGuaranteed>> 50: 0x7f459d9ac34e - <::spawn_unchecked_, rustc_driver_impl[5065b449a99b292a]::run_compiler::{closure#1}>::{closure#0}, core[4ff1a1b12c81ae0a]::result::Result<(), rustc_span[52113c30dfc0425a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4ff1a1b12c81ae0a]::result::Result<(), rustc_span[52113c30dfc0425a]::ErrorGuaranteed>>::{closure#1} as core[4ff1a1b12c81ae0a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 51: 0x7f459af71ec5 - as core::ops::function::FnOnce>::call_once::h21dd47fc485ddadd at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/alloc/src/boxed.rs:2007:9 52: 0x7f459af71ec5 - as core::ops::function::FnOnce>::call_once::h676a2c85317f6542 at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/alloc/src/boxed.rs:2007:9 53: 0x7f459af71ec5 - std::sys::unix::thread::Thread::new::thread_start::h1169492f432a65d4 at /rustc/bdb0fa3ee5ffb4cc1a1b53cbe8344a2b83b1ae2a/library/std/src/sys/unix/thread.rs:108:17 54: 0x7f459aa8c9eb - 55: 0x7f459ab10dfc - 56: 0x0 - 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 attach the file at `/home/matthias/vcs/github/glacier2/TO_REPORT/rustc-ice-2023-09-21T12:15:07.571359303Z-841491.txt` to your bug report query stack during panic: #0 [type_of_opaque] computing type of opaque `Tait::{opaque#0}::{opaque#0}` #1 [type_of] computing type of `Tait::{opaque#0}::{opaque#0}` #2 [check_mod_item_types] checking item types in top-level module #3 [analysis] running analysis passes on this crate end of query stack error: aborting due to 4 previous errors Some errors have detailed explanations: E0261, E0412. For more information about an error, try `rustc --explain E0261`. ```

matthiaskrgr commented 1 year ago

Regression in nightly-2023-09-20