Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE with inherent generic associated type: no type for node HirId #104260

Closed
plazmoid opened this issue Nov 10, 2022 · 1 comment · Fixed by #105358
Closed

ICE with inherent generic associated type: no type for node HirId #104260

plazmoid opened this issue Nov 10, 2022 · 1 comment · Fixed by #105358
Assignees
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-inherent_associated_types `#![feature(inherent_associated_types)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@plazmoid
Copy link

Code

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

struct Foo;

impl Foo {
    type Bar<T> = u8;
}

fn main() {
    let a: Foo::Bar<()>;
}

This similar snippet fails with the same panic message (removed generic from the inh type):

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

struct Foo;

impl Foo {
    type Bar = u8;
}

fn main() {
    let a: Foo::Bar<()>;
}

Meta

rustc --version --verbose:

rustc 1.67.0-nightly (e75aab045 2022-11-09)
binary: rustc
commit-hash: e75aab045fc476f176a58c408f6b06f0e275c6e1
commit-date: 2022-11-09
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4

Error output

error: internal compiler error: compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:538:17: no type for node HirId { owner: OwnerId { def_id: DefId(0:7 ~ bug[d697]::main) }, local_id: 5 }: type () (hir_id=HirId { owner: OwnerId { def_id: DefId(0:7 ~ bug[d697]::main) }, local_id: 5 }) in fcx 0x7f24d37ed710

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/compiler/rustc_errors/src/lib.rs:1551:9
Backtrace

stack backtrace:
   0:     0x7f24df0aa150 - std::backtrace_rs::backtrace::libunwind::trace::h475e6d14c20ac628
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f24df0aa150 - std::backtrace_rs::backtrace::trace_unsynchronized::h782386969d170809
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f24df0aa150 - std::sys_common::backtrace::_print_fmt::h2cff96f1339c9fb3
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f24df0aa150 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h65381e912452bd50
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f24db1c84fe - core::fmt::write::hddf5212808edda8e
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/core/src/fmt/mod.rs:1209:17
   5:     0x7f24df09e135 - std::io::Write::write_fmt::h86ff774c1fbcc56f
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/std/src/io/mod.rs:1682:15
   6:     0x7f24df0a9f15 - std::sys_common::backtrace::_print::hac5746116d4b1148
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f24df0a9f15 - std::sys_common::backtrace::print::h989584698b4383b5
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f24df0ac22f - std::panicking::default_hook::{{closure}}::hdf7100a7f19aaac7
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/std/src/panicking.rs:267:22
   9:     0x7f24df0abf6a - std::panicking::default_hook::hd54c9e09261f65ab
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/std/src/panicking.rs:286:9
  10:     0x7f24de35f011 - rustc_driver[41f9f2ea3541ee7a]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f24df0aca1d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hc144466fda390ad6
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/alloc/src/boxed.rs:2032:9
  12:     0x7f24df0aca1d - std::panicking::rust_panic_with_hook::h6cb13ee30fd78212
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/std/src/panicking.rs:692:13
  13:     0x7f24de791e21 - std[15847fe8052079fc]::panicking::begin_panic::<rustc_errors[2bcb93b13263f24b]::ExplicitBug>::{closure#0}
  14:     0x7f24de790ee6 - std[15847fe8052079fc]::sys_common::backtrace::__rust_end_short_backtrace::<std[15847fe8052079fc]::panicking::begin_panic<rustc_errors[2bcb93b13263f24b]::ExplicitBug>::{closure#0}, !>
  15:     0x7f24de7eba56 - std[15847fe8052079fc]::panicking::begin_panic::<rustc_errors[2bcb93b13263f24b]::ExplicitBug>
  16:     0x7f24de78e3e6 - std[15847fe8052079fc]::panic::panic_any::<rustc_errors[2bcb93b13263f24b]::ExplicitBug>
  17:     0x7f24de78e2d4 - <rustc_errors[2bcb93b13263f24b]::HandlerInner>::bug::<&alloc[ba7c9d59a3c148c6]::string::String>
  18:     0x7f24de78dcf0 - <rustc_errors[2bcb93b13263f24b]::Handler>::bug::<&alloc[ba7c9d59a3c148c6]::string::String>
  19:     0x7f24de85a43d - rustc_middle[2300a5795c47275a]::ty::context::tls::with_context_opt::<rustc_middle[2300a5795c47275a]::ty::context::tls::with_opt<rustc_middle[2300a5795c47275a]::util::bug::opt_span_bug_fmt<rustc_span[2e77502f23847349]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  20:     0x7f24de85a5c6 - rustc_middle[2300a5795c47275a]::util::bug::opt_span_bug_fmt::<rustc_span[2e77502f23847349]::span_encoding::Span>
  21:     0x7f24dc636e73 - rustc_middle[2300a5795c47275a]::util::bug::bug_fmt
  22:     0x7f24dc6b7692 - <rustc_hir_typeck[fa6a34a4df64972e]::writeback::WritebackCx as rustc_hir[227ea556e9d01207]::intravisit::Visitor>::visit_ty
  23:     0x7f24dc6b6b35 - <rustc_hir_typeck[fa6a34a4df64972e]::writeback::WritebackCx as rustc_hir[227ea556e9d01207]::intravisit::Visitor>::visit_ty
  24:     0x7f24dc6b7ebc - <rustc_hir_typeck[fa6a34a4df64972e]::writeback::WritebackCx as rustc_hir[227ea556e9d01207]::intravisit::Visitor>::visit_local
  25:     0x7f24dc6af6d1 - <rustc_hir_typeck[fa6a34a4df64972e]::writeback::WritebackCx as rustc_hir[227ea556e9d01207]::intravisit::Visitor>::visit_expr
  26:     0x7f24dcab1de7 - <rustc_hir_typeck[fa6a34a4df64972e]::fn_ctxt::FnCtxt>::resolve_type_vars_in_body
  27:     0x7f24dcaa3971 - <rustc_hir_typeck[fa6a34a4df64972e]::inherited::InheritedBuilder>::enter::<rustc_hir_typeck[fa6a34a4df64972e]::typeck_with_fallback<rustc_hir_typeck[fa6a34a4df64972e]::typeck::{closure#0}>::{closure#0}::{closure#1}, &rustc_middle[2300a5795c47275a]::ty::context::TypeckResults>
  28:     0x7f24dca9590d - rustc_hir_typeck[fa6a34a4df64972e]::typeck
  29:     0x7f24dca93b1f - rustc_query_system[1f6ede8186171781]::query::plumbing::try_execute_query::<rustc_query_impl[b28d4a501f55e093]::plumbing::QueryCtxt, rustc_query_system[1f6ede8186171781]::query::caches::DefaultCache<rustc_span[2e77502f23847349]::def_id::LocalDefId, &rustc_middle[2300a5795c47275a]::ty::context::TypeckResults>>
  30:     0x7f24ddb34878 - rustc_data_structures[7663b3d9993f23bc]::sync::par_for_each_in::<&[rustc_span[2e77502f23847349]::def_id::LocalDefId], <rustc_middle[2300a5795c47275a]::hir::map::Map>::par_body_owners<rustc_hir_typeck[fa6a34a4df64972e]::typeck_item_bodies::{closure#0}>::{closure#0}>
  31:     0x7f24ddb34553 - rustc_hir_typeck[fa6a34a4df64972e]::typeck_item_bodies
  32:     0x7f24dda2b8ba - rustc_query_system[1f6ede8186171781]::query::plumbing::try_execute_query::<rustc_query_impl[b28d4a501f55e093]::plumbing::QueryCtxt, rustc_query_system[1f6ede8186171781]::query::caches::DefaultCache<(), ()>>
  33:     0x7f24dda2b5b7 - rustc_query_system[1f6ede8186171781]::query::plumbing::get_query::<rustc_query_impl[b28d4a501f55e093]::queries::typeck_item_bodies, rustc_query_impl[b28d4a501f55e093]::plumbing::QueryCtxt>
  34:     0x7f24dc7a776a - <rustc_session[6a0929c18a48d200]::session::Session>::time::<(), rustc_hir_analysis[47fee765dc455125]::check_crate::{closure#7}>
  35:     0x7f24dc7a6ebb - rustc_hir_analysis[47fee765dc455125]::check_crate
  36:     0x7f24dc7a6aeb - rustc_interface[2d69c3ee45228f8a]::passes::analysis
  37:     0x7f24ddb8b724 - rustc_query_system[1f6ede8186171781]::query::plumbing::try_execute_query::<rustc_query_impl[b28d4a501f55e093]::plumbing::QueryCtxt, rustc_query_system[1f6ede8186171781]::query::caches::DefaultCache<(), core[7d0df67402c3c815]::result::Result<(), rustc_errors[2bcb93b13263f24b]::ErrorGuaranteed>>>
  38:     0x7f24ddb8b427 - rustc_query_system[1f6ede8186171781]::query::plumbing::get_query::<rustc_query_impl[b28d4a501f55e093]::queries::analysis, rustc_query_impl[b28d4a501f55e093]::plumbing::QueryCtxt>
  39:     0x7f24dd61c2be - <rustc_interface[2d69c3ee45228f8a]::passes::QueryContext>::enter::<rustc_driver[41f9f2ea3541ee7a]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[7d0df67402c3c815]::result::Result<(), rustc_errors[2bcb93b13263f24b]::ErrorGuaranteed>>
  40:     0x7f24dd61938f - <rustc_interface[2d69c3ee45228f8a]::interface::Compiler>::enter::<rustc_driver[41f9f2ea3541ee7a]::run_compiler::{closure#1}::{closure#2}, core[7d0df67402c3c815]::result::Result<core[7d0df67402c3c815]::option::Option<rustc_interface[2d69c3ee45228f8a]::queries::Linker>, rustc_errors[2bcb93b13263f24b]::ErrorGuaranteed>>
  41:     0x7f24dd6143c2 - rustc_span[2e77502f23847349]::with_source_map::<core[7d0df67402c3c815]::result::Result<(), rustc_errors[2bcb93b13263f24b]::ErrorGuaranteed>, rustc_interface[2d69c3ee45228f8a]::interface::run_compiler<core[7d0df67402c3c815]::result::Result<(), rustc_errors[2bcb93b13263f24b]::ErrorGuaranteed>, rustc_driver[41f9f2ea3541ee7a]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  42:     0x7f24dd613e9c - <scoped_tls[5e9cb458eb9b4943]::ScopedKey<rustc_span[2e77502f23847349]::SessionGlobals>>::set::<rustc_interface[2d69c3ee45228f8a]::interface::run_compiler<core[7d0df67402c3c815]::result::Result<(), rustc_errors[2bcb93b13263f24b]::ErrorGuaranteed>, rustc_driver[41f9f2ea3541ee7a]::run_compiler::{closure#1}>::{closure#0}, core[7d0df67402c3c815]::result::Result<(), rustc_errors[2bcb93b13263f24b]::ErrorGuaranteed>>
  43:     0x7f24dd613488 - std[15847fe8052079fc]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[2d69c3ee45228f8a]::util::run_in_thread_pool_with_globals<rustc_interface[2d69c3ee45228f8a]::interface::run_compiler<core[7d0df67402c3c815]::result::Result<(), rustc_errors[2bcb93b13263f24b]::ErrorGuaranteed>, rustc_driver[41f9f2ea3541ee7a]::run_compiler::{closure#1}>::{closure#0}, core[7d0df67402c3c815]::result::Result<(), rustc_errors[2bcb93b13263f24b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7d0df67402c3c815]::result::Result<(), rustc_errors[2bcb93b13263f24b]::ErrorGuaranteed>>
  44:     0x7f24dd6131ac - <<std[15847fe8052079fc]::thread::Builder>::spawn_unchecked_<rustc_interface[2d69c3ee45228f8a]::util::run_in_thread_pool_with_globals<rustc_interface[2d69c3ee45228f8a]::interface::run_compiler<core[7d0df67402c3c815]::result::Result<(), rustc_errors[2bcb93b13263f24b]::ErrorGuaranteed>, rustc_driver[41f9f2ea3541ee7a]::run_compiler::{closure#1}>::{closure#0}, core[7d0df67402c3c815]::result::Result<(), rustc_errors[2bcb93b13263f24b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7d0df67402c3c815]::result::Result<(), rustc_errors[2bcb93b13263f24b]::ErrorGuaranteed>>::{closure#1} as core[7d0df67402c3c815]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x7f24df0b3953 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9a068bdd0d9f070e
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/alloc/src/boxed.rs:2000:9
  46:     0x7f24df0b3953 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h86d7b043c0b02a10
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/alloc/src/boxed.rs:2000:9
  47:     0x7f24df0b3953 - std::sys::unix::thread::Thread::new::thread_start::hfaaa856b3ec2dce6
                               at /rustc/e75aab045fc476f176a58c408f6b06f0e275c6e1/library/std/src/sys/unix/thread.rs:108:17
  48:     0x7f24daf0a8fd - <unknown>
  49:     0x7f24daf8ca60 - <unknown>
  50:                0x0 - <unknown>

note: 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: rustc 1.67.0-nightly (e75aab045 2022-11-09) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

@plazmoid plazmoid added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 10, 2022
@compiler-errors compiler-errors added the F-inherent_associated_types `#![feature(inherent_associated_types)]` label Nov 10, 2022
@TaKO8Ki TaKO8Ki self-assigned this Nov 12, 2022
@fmease
Copy link
Member

fmease commented Dec 5, 2022

This issue has been fixed by #105224. Neither snippet leads to an ICE anymore. Check for yourself on the playground: First, second.

@matthiaskrgr matthiaskrgr added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Dec 5, 2022
TaKO8Ki added a commit to TaKO8Ki/rust that referenced this issue Dec 6, 2022
bors added a commit to rust-lang-ci/rust that referenced this issue Dec 7, 2022
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#105298 (llvm-wrapper: adapt for an LLVM API change)
 - rust-lang#105358 (Add a test for rust-lang#104260)
 - rust-lang#105380 (add const generics ping files things for me)
 - rust-lang#105382 (remove an excess `this`)
 - rust-lang#105388 (rustdoc: remove redundant CSS `.import-item .stab { font-size }`)
 - rust-lang#105390 (unstable-book: Add `ignore` to `abi_efiapi` example code)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors closed this as completed in 001bd51 Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-inherent_associated_types `#![feature(inherent_associated_types)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants