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 associated type: Type parameter out of range when substituting #104240

Closed
fmease opened this issue Nov 10, 2022 · 1 comment · Fixed by #105224
Closed

ICE with inherent associated type: Type parameter out of range when substituting #104240

fmease opened this issue Nov 10, 2022 · 1 comment · Fixed by #105224
Assignees
Labels
A-associated-items Area: Associated items (types, constants & functions) C-bug Category: This is a bug. F-inherent_associated_types `#![feature(inherent_associated_types)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@fmease
Copy link
Member

fmease commented Nov 10, 2022

Code

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

struct S<T>(T);

impl<T> S<T> {
    type P = T;
}

fn main() {
    type A = S<()>::P;
    let _: A = ();
}

Output

error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:726:9: type parameter `T/#0` (T/0) out of range when substituting, substs=[]

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/compiler/rustc_errors/src/lib.rs:1551:9
backtrace
stack backtrace:
   0:     0x7f3ff7282280 - std::backtrace_rs::backtrace::libunwind::trace::h90130e9f1ec9d9fc
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f3ff7282280 - std::backtrace_rs::backtrace::trace_unsynchronized::h40c4f6d986aff2e4
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3ff7282280 - std::sys_common::backtrace::_print_fmt::h3822369be0084f83
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f3ff7282280 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdae4626daadc9f71
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f3ff33c84fe - core::fmt::write::h05cdd281d08b9d01
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/core/src/fmt/mod.rs:1209:17
   5:     0x7f3ff7276365 - std::io::Write::write_fmt::h8e1559869183c8bb
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/io/mod.rs:1682:15
   6:     0x7f3ff7282045 - std::sys_common::backtrace::_print::h61ba1afc98d46ffd
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f3ff7282045 - std::sys_common::backtrace::print::he9728762d292043e
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f3ff728435f - std::panicking::default_hook::{{closure}}::h726bafb7da990095
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/panicking.rs:267:22
   9:     0x7f3ff728409a - std::panicking::default_hook::hdc60b442b1844a68
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/panicking.rs:286:9
  10:     0x7f3ff6503a14 - rustc_driver[b81881107b3cefb1]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f3ff7284b4d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h3db297037157cab4
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/alloc/src/boxed.rs:2032:9
  12:     0x7f3ff7284b4d - std::panicking::rust_panic_with_hook::hc98185590f941643
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/panicking.rs:692:13
  13:     0x7f3ff696abb1 - std[23e74d0f7912c00c]::panicking::begin_panic::<rustc_errors[43d68c63b698f7a8]::ExplicitBug>::{closure#0}
  14:     0x7f3ff6969c76 - std[23e74d0f7912c00c]::sys_common::backtrace::__rust_end_short_backtrace::<std[23e74d0f7912c00c]::panicking::begin_panic<rustc_errors[43d68c63b698f7a8]::ExplicitBug>::{closure#0}, !>
  15:     0x7f3ff69c59c6 - std[23e74d0f7912c00c]::panicking::begin_panic::<rustc_errors[43d68c63b698f7a8]::ExplicitBug>
  16:     0x7f3ff6967156 - std[23e74d0f7912c00c]::panic::panic_any::<rustc_errors[43d68c63b698f7a8]::ExplicitBug>
  17:     0x7f3ff6967044 - <rustc_errors[43d68c63b698f7a8]::HandlerInner>::bug::<&alloc[e7e939941d2090cd]::string::String>
  18:     0x7f3ff6966aa0 - <rustc_errors[43d68c63b698f7a8]::Handler>::bug::<&alloc[e7e939941d2090cd]::string::String>
  19:     0x7f3ff6a33dad - rustc_middle[749c6e76ccc44e50]::ty::context::tls::with_context_opt::<rustc_middle[749c6e76ccc44e50]::ty::context::tls::with_opt<rustc_middle[749c6e76ccc44e50]::util::bug::opt_span_bug_fmt<rustc_span[7a6d98bdad94076d]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  20:     0x7f3ff6a33f36 - rustc_middle[749c6e76ccc44e50]::util::bug::opt_span_bug_fmt::<rustc_span[7a6d98bdad94076d]::span_encoding::Span>
  21:     0x7f3ff484bc93 - rustc_middle[749c6e76ccc44e50]::util::bug::bug_fmt
  22:     0x7f3ff6a173b2 - <rustc_middle[749c6e76ccc44e50]::ty::subst::SubstFolder>::type_param_out_of_range
  23:     0x7f3ff52c2afd - <dyn rustc_hir_analysis[49cd1ee7bf54876a]::astconv::AstConv>::res_to_ty
  24:     0x7f3ff52b72b9 - <dyn rustc_hir_analysis[49cd1ee7bf54876a]::astconv::AstConv>::ast_ty_to_ty_inner::{closure#0}
  25:     0x7f3ff46a846a - <rustc_hir_typeck[db678d77eac03692]::gather_locals::GatherLocalsVisitor>::declare
  26:     0x7f3ff46a81c7 - <rustc_hir_typeck[db678d77eac03692]::gather_locals::GatherLocalsVisitor as rustc_hir[6eccaaf6354731e0]::intravisit::Visitor>::visit_expr
  27:     0x7f3ff4e58de2 - rustc_hir_typeck[db678d77eac03692]::check::check_fn
  28:     0x7f3ff4e445ff - rustc_hir_typeck[db678d77eac03692]::typeck
  29:     0x7f3ff4ac960d - rustc_query_system[29c74e3a9648926f]::query::plumbing::try_execute_query::<rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt, rustc_query_system[29c74e3a9648926f]::query::caches::DefaultCache<rustc_span[7a6d98bdad94076d]::def_id::LocalDefId, &rustc_middle[749c6e76ccc44e50]::ty::context::TypeckResults>>
  30:     0x7f3ff5d1ff38 - rustc_data_structures[a81ff103cbb29bfb]::sync::par_for_each_in::<&[rustc_span[7a6d98bdad94076d]::def_id::LocalDefId], <rustc_middle[749c6e76ccc44e50]::hir::map::Map>::par_body_owners<rustc_hir_typeck[db678d77eac03692]::typeck_item_bodies::{closure#0}>::{closure#0}>
  31:     0x7f3ff5d1fc13 - rustc_hir_typeck[db678d77eac03692]::typeck_item_bodies
  32:     0x7f3ff5c0912a - rustc_query_system[29c74e3a9648926f]::query::plumbing::try_execute_query::<rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt, rustc_query_system[29c74e3a9648926f]::query::caches::DefaultCache<(), ()>>
  33:     0x7f3ff5c08e27 - rustc_query_system[29c74e3a9648926f]::query::plumbing::get_query::<rustc_query_impl[80af96805dfbd2fb]::queries::typeck_item_bodies, rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt>
  34:     0x7f3ff49b95ca - <rustc_session[8022550fdac32630]::session::Session>::time::<(), rustc_hir_analysis[49cd1ee7bf54876a]::check_crate::{closure#7}>
  35:     0x7f3ff49b878b - rustc_hir_analysis[49cd1ee7bf54876a]::check_crate
  36:     0x7f3ff49b83bb - rustc_interface[74ce99d2ea85b1]::passes::analysis
  37:     0x7f3ff5d77644 - rustc_query_system[29c74e3a9648926f]::query::plumbing::try_execute_query::<rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt, rustc_query_system[29c74e3a9648926f]::query::caches::DefaultCache<(), core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>>
  38:     0x7f3ff5d77347 - rustc_query_system[29c74e3a9648926f]::query::plumbing::get_query::<rustc_query_impl[80af96805dfbd2fb]::queries::analysis, rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt>
  39:     0x7f3ff57fb03d - <rustc_interface[74ce99d2ea85b1]::passes::QueryContext>::enter::<rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>
  40:     0x7f3ff57f75ff - <rustc_interface[74ce99d2ea85b1]::interface::Compiler>::enter::<rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}::{closure#2}, core[c2065954f2d40e37]::result::Result<core[c2065954f2d40e37]::option::Option<rustc_interface[74ce99d2ea85b1]::queries::Linker>, rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>
  41:     0x7f3ff57f2672 - rustc_span[7a6d98bdad94076d]::with_source_map::<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_interface[74ce99d2ea85b1]::interface::run_compiler<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  42:     0x7f3ff57f2169 - <scoped_tls[866d789ca631dc2f]::ScopedKey<rustc_span[7a6d98bdad94076d]::SessionGlobals>>::set::<rustc_interface[74ce99d2ea85b1]::interface::run_compiler<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}>::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>
  43:     0x7f3ff57f1778 - std[23e74d0f7912c00c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[74ce99d2ea85b1]::util::run_in_thread_pool_with_globals<rustc_interface[74ce99d2ea85b1]::interface::run_compiler<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}>::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>
  44:     0x7f3ff57f149c - <<std[23e74d0f7912c00c]::thread::Builder>::spawn_unchecked_<rustc_interface[74ce99d2ea85b1]::util::run_in_thread_pool_with_globals<rustc_interface[74ce99d2ea85b1]::interface::run_compiler<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}>::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>::{closure#1} as core[c2065954f2d40e37]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x7f3ff728ba83 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he8eec53b13ee98a2
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/alloc/src/boxed.rs:2000:9
  46:     0x7f3ff728ba83 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h04d7374ad262fa8b
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/alloc/src/boxed.rs:2000:9
  47:     0x7f3ff728ba83 - std::sys::unix::thread::Thread::new::thread_start::h0bc6cb3772aee1f7
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys/unix/thread.rs:108:17
  48:     0x7f3ff310d78d - <unknown>
  49:     0x7f3ff318e8e4 - clone
  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 (85f4f41de 2022-11-08) 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

Code (Variation)

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

struct S<T>(T);

impl<T> S<T> {
    type P = T;
}

fn main() {
    let _: S<()>::P = ();
}

Output

thread '<unnamed>' panicked at 'index out of bounds: the len is 0 but the index is 0', compiler/rustc_middle/src/ty/generics.rs:207:14
// BACKTRACE OMITTED
error: internal compiler error: the following error was constructed but not emitted

error[E0308]: mismatched types
  --> ice.rs:11:23
   |
11 |     let _: S<()>::P = ();
   |                       ^^ expected type parameter `T`, found `()`
   |
   = note: expected type parameter `T`
                   found unit type `()`

thread '<unnamed>' panicked at 'error was constructed but not emitted', compiler/rustc_errors/src/diagnostic_builder.rs:676:21
// BACKTRACE OMITTED
thread panicked while panicking. aborting.
[1]    260501 IOT instruction (core dumped)  rustc ice.rs
full stderr (two panics / backtraces)
thread '<unnamed>' panicked at 'index out of bounds: the len is 0 but the index is 0', compiler/rustc_middle/src/ty/generics.rs:207:14
stack backtrace:
   0:     0x7fd657ed43e0 - std::backtrace_rs::backtrace::libunwind::trace::h90130e9f1ec9d9fc
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fd657ed43e0 - std::backtrace_rs::backtrace::trace_unsynchronized::h40c4f6d986aff2e4
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fd657ed43e0 - std::sys_common::backtrace::_print_fmt::h3822369be0084f83
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fd657ed43e0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdae4626daadc9f71
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fd657f364fe - core::fmt::write::h05cdd281d08b9d01
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/core/src/fmt/mod.rs:1209:17
   5:     0x7fd657ec4655 - std::io::Write::write_fmt::h8e1559869183c8bb
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/io/mod.rs:1682:15
   6:     0x7fd657ed41a5 - std::sys_common::backtrace::_print::h61ba1afc98d46ffd
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fd657ed41a5 - std::sys_common::backtrace::print::he9728762d292043e
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fd657ed6f7f - std::panicking::default_hook::{{closure}}::h726bafb7da990095
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/panicking.rs:267:22
   9:     0x7fd657ed6cba - std::panicking::default_hook::hdc60b442b1844a68
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/panicking.rs:286:9
  10:     0x7fd657ed778c - std::panicking::rust_panic_with_hook::hc98185590f941643
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/panicking.rs:688:13
  11:     0x7fd657ed7527 - std::panicking::begin_panic_handler::{{closure}}::hefb3c8ca46058321
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/panicking.rs:579:13
  12:     0x7fd657ed488c - std::sys_common::backtrace::__rust_end_short_backtrace::hb93f26550816602c
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys_common/backtrace.rs:137:18
  13:     0x7fd657ed7242 - rust_begin_unwind
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/panicking.rs:575:5
  14:     0x7fd657f32ee3 - core::panicking::panic_fmt::h22b222f579eb1262
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/core/src/panicking.rs:65:14
  15:     0x7fd657f330b2 - core::panicking::panic_bounds_check::he1eceb0acc7c7551
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/core/src/panicking.rs:151:5
  16:     0x7fd65618e8ed - <rustc_middle[749c6e76ccc44e50]::ty::generics::Generics>::param_at
  17:     0x7fd65670c4fc - <rustc_middle[749c6e76ccc44e50]::ty::generics::Generics>::type_param
  18:     0x7fd6571eee97 - <rustc_middle[749c6e76ccc44e50]::ty::context::TyCtxt>::note_and_explain_type_err
  19:     0x7fd655faa86f - <rustc_infer[7d53ebe6f38c5f10]::infer::error_reporting::TypeErrCtxt>::note_type_err
  20:     0x7fd65700a2c3 - <rustc_infer[7d53ebe6f38c5f10]::infer::error_reporting::TypeErrCtxt>::report_and_explain_type_error
  21:     0x7fd6553d5075 - <rustc_infer[7d53ebe6f38c5f10]::infer::error_reporting::TypeErrCtxt>::report_mismatched_types
  22:     0x7fd65542b5c5 - <rustc_hir_typeck[db678d77eac03692]::fn_ctxt::FnCtxt>::demand_coerce
  23:     0x7fd65540880d - <rustc_hir_typeck[db678d77eac03692]::fn_ctxt::FnCtxt>::check_decl
  24:     0x7fd6554058de - <rustc_hir_typeck[db678d77eac03692]::fn_ctxt::FnCtxt>::check_block_with_expected
  25:     0x7fd6553bccd0 - <rustc_hir_typeck[db678d77eac03692]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  26:     0x7fd6556613d6 - <rustc_hir_typeck[db678d77eac03692]::fn_ctxt::FnCtxt>::check_return_expr
  27:     0x7fd65565938c - rustc_hir_typeck[db678d77eac03692]::check::check_fn
  28:     0x7fd6556445ff - rustc_hir_typeck[db678d77eac03692]::typeck
  29:     0x7fd6552c960d - rustc_query_system[29c74e3a9648926f]::query::plumbing::try_execute_query::<rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt, rustc_query_system[29c74e3a9648926f]::query::caches::DefaultCache<rustc_span[7a6d98bdad94076d]::def_id::LocalDefId, &rustc_middle[749c6e76ccc44e50]::ty::context::TypeckResults>>
  30:     0x7fd65651ff38 - rustc_data_structures[a81ff103cbb29bfb]::sync::par_for_each_in::<&[rustc_span[7a6d98bdad94076d]::def_id::LocalDefId], <rustc_middle[749c6e76ccc44e50]::hir::map::Map>::par_body_owners<rustc_hir_typeck[db678d77eac03692]::typeck_item_bodies::{closure#0}>::{closure#0}>
  31:     0x7fd65651fc13 - rustc_hir_typeck[db678d77eac03692]::typeck_item_bodies
  32:     0x7fd65640912a - rustc_query_system[29c74e3a9648926f]::query::plumbing::try_execute_query::<rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt, rustc_query_system[29c74e3a9648926f]::query::caches::DefaultCache<(), ()>>
  33:     0x7fd656408e27 - rustc_query_system[29c74e3a9648926f]::query::plumbing::get_query::<rustc_query_impl[80af96805dfbd2fb]::queries::typeck_item_bodies, rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt>
  34:     0x7fd6551b95ca - <rustc_session[8022550fdac32630]::session::Session>::time::<(), rustc_hir_analysis[49cd1ee7bf54876a]::check_crate::{closure#7}>
  35:     0x7fd6551b878b - rustc_hir_analysis[49cd1ee7bf54876a]::check_crate
  36:     0x7fd6551b83bb - rustc_interface[74ce99d2ea85b1]::passes::analysis
  37:     0x7fd656577644 - rustc_query_system[29c74e3a9648926f]::query::plumbing::try_execute_query::<rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt, rustc_query_system[29c74e3a9648926f]::query::caches::DefaultCache<(), core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>>
  38:     0x7fd656577347 - rustc_query_system[29c74e3a9648926f]::query::plumbing::get_query::<rustc_query_impl[80af96805dfbd2fb]::queries::analysis, rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt>
  39:     0x7fd655ffb03d - <rustc_interface[74ce99d2ea85b1]::passes::QueryContext>::enter::<rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>
  40:     0x7fd655ff75ff - <rustc_interface[74ce99d2ea85b1]::interface::Compiler>::enter::<rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}::{closure#2}, core[c2065954f2d40e37]::result::Result<core[c2065954f2d40e37]::option::Option<rustc_interface[74ce99d2ea85b1]::queries::Linker>, rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>
  41:     0x7fd655ff2672 - rustc_span[7a6d98bdad94076d]::with_source_map::<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_interface[74ce99d2ea85b1]::interface::run_compiler<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  42:     0x7fd655ff2169 - <scoped_tls[866d789ca631dc2f]::ScopedKey<rustc_span[7a6d98bdad94076d]::SessionGlobals>>::set::<rustc_interface[74ce99d2ea85b1]::interface::run_compiler<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}>::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>
  43:     0x7fd655ff1778 - std[23e74d0f7912c00c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[74ce99d2ea85b1]::util::run_in_thread_pool_with_globals<rustc_interface[74ce99d2ea85b1]::interface::run_compiler<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}>::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>
  44:     0x7fd655ff149c - <<std[23e74d0f7912c00c]::thread::Builder>::spawn_unchecked_<rustc_interface[74ce99d2ea85b1]::util::run_in_thread_pool_with_globals<rustc_interface[74ce99d2ea85b1]::interface::run_compiler<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}>::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>::{closure#1} as core[c2065954f2d40e37]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x7fd657a8ba83 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he8eec53b13ee98a2
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/alloc/src/boxed.rs:2000:9
  46:     0x7fd657a8ba83 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h04d7374ad262fa8b
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/alloc/src/boxed.rs:2000:9
  47:     0x7fd657a8ba83 - std::sys::unix::thread::Thread::new::thread_start::h0bc6cb3772aee1f7
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys/unix/thread.rs:108:17
  48:     0x7fd653aa278d - <unknown>
  49:     0x7fd653b238e4 - clone
  50:                0x0 - <unknown>
error: internal compiler error: the following error was constructed but not emitted

error[E0308]: mismatched types
  --> ice.rs:11:23
   |
11 |     let _: S<()>::P = ();
   |                       ^^ expected type parameter `T`, found `()`
   |
   = note: expected type parameter `T`
                   found unit type `()`

thread '<unnamed>' panicked at 'error was constructed but not emitted', compiler/rustc_errors/src/diagnostic_builder.rs:676:21
stack backtrace:
   0:     0x7fd657ed43e0 - std::backtrace_rs::backtrace::libunwind::trace::h90130e9f1ec9d9fc
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fd657ed43e0 - std::backtrace_rs::backtrace::trace_unsynchronized::h40c4f6d986aff2e4
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fd657ed43e0 - std::sys_common::backtrace::_print_fmt::h3822369be0084f83
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fd657ed43e0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdae4626daadc9f71
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fd657f364fe - core::fmt::write::h05cdd281d08b9d01
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/core/src/fmt/mod.rs:1209:17
   5:     0x7fd657ec4655 - std::io::Write::write_fmt::h8e1559869183c8bb
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/io/mod.rs:1682:15
   6:     0x7fd657ed41a5 - std::sys_common::backtrace::_print::h61ba1afc98d46ffd
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fd657ed41a5 - std::sys_common::backtrace::print::he9728762d292043e
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fd657ed6f7f - std::panicking::default_hook::{{closure}}::h726bafb7da990095
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/panicking.rs:267:22
   9:     0x7fd657ed6cba - std::panicking::default_hook::hdc60b442b1844a68
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/panicking.rs:286:9
  10:     0x7fd657ed778c - std::panicking::rust_panic_with_hook::hc98185590f941643
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/panicking.rs:688:13
  11:     0x7fd657ed74e1 - std::panicking::begin_panic_handler::{{closure}}::hefb3c8ca46058321
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/panicking.rs:577:13
  12:     0x7fd657ed488c - std::sys_common::backtrace::__rust_end_short_backtrace::hb93f26550816602c
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys_common/backtrace.rs:137:18
  13:     0x7fd657ed7242 - rust_begin_unwind
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/panicking.rs:575:5
  14:     0x7fd657f32ee3 - core::panicking::panic_fmt::h22b222f579eb1262
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/core/src/panicking.rs:65:14
  15:     0x7fd655814d0b - <rustc_errors[43d68c63b698f7a8]::diagnostic_builder::DiagnosticBuilderInner as core[c2065954f2d40e37]::ops::drop::Drop>::drop
  16:     0x7fd656ffdf9d - core[c2065954f2d40e37]::ptr::drop_in_place::<rustc_errors[43d68c63b698f7a8]::diagnostic_builder::DiagnosticBuilder<rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>
  17:     0x7fd65700a916 - <rustc_infer[7d53ebe6f38c5f10]::infer::error_reporting::TypeErrCtxt>::report_and_explain_type_error
  18:     0x7fd6553d5075 - <rustc_infer[7d53ebe6f38c5f10]::infer::error_reporting::TypeErrCtxt>::report_mismatched_types
  19:     0x7fd65542b5c5 - <rustc_hir_typeck[db678d77eac03692]::fn_ctxt::FnCtxt>::demand_coerce
  20:     0x7fd65540880d - <rustc_hir_typeck[db678d77eac03692]::fn_ctxt::FnCtxt>::check_decl
  21:     0x7fd6554058de - <rustc_hir_typeck[db678d77eac03692]::fn_ctxt::FnCtxt>::check_block_with_expected
  22:     0x7fd6553bccd0 - <rustc_hir_typeck[db678d77eac03692]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  23:     0x7fd6556613d6 - <rustc_hir_typeck[db678d77eac03692]::fn_ctxt::FnCtxt>::check_return_expr
  24:     0x7fd65565938c - rustc_hir_typeck[db678d77eac03692]::check::check_fn
  25:     0x7fd6556445ff - rustc_hir_typeck[db678d77eac03692]::typeck
  26:     0x7fd6552c960d - rustc_query_system[29c74e3a9648926f]::query::plumbing::try_execute_query::<rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt, rustc_query_system[29c74e3a9648926f]::query::caches::DefaultCache<rustc_span[7a6d98bdad94076d]::def_id::LocalDefId, &rustc_middle[749c6e76ccc44e50]::ty::context::TypeckResults>>
  27:     0x7fd65651ff38 - rustc_data_structures[a81ff103cbb29bfb]::sync::par_for_each_in::<&[rustc_span[7a6d98bdad94076d]::def_id::LocalDefId], <rustc_middle[749c6e76ccc44e50]::hir::map::Map>::par_body_owners<rustc_hir_typeck[db678d77eac03692]::typeck_item_bodies::{closure#0}>::{closure#0}>
  28:     0x7fd65651fc13 - rustc_hir_typeck[db678d77eac03692]::typeck_item_bodies
  29:     0x7fd65640912a - rustc_query_system[29c74e3a9648926f]::query::plumbing::try_execute_query::<rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt, rustc_query_system[29c74e3a9648926f]::query::caches::DefaultCache<(), ()>>
  30:     0x7fd656408e27 - rustc_query_system[29c74e3a9648926f]::query::plumbing::get_query::<rustc_query_impl[80af96805dfbd2fb]::queries::typeck_item_bodies, rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt>
  31:     0x7fd6551b95ca - <rustc_session[8022550fdac32630]::session::Session>::time::<(), rustc_hir_analysis[49cd1ee7bf54876a]::check_crate::{closure#7}>
  32:     0x7fd6551b878b - rustc_hir_analysis[49cd1ee7bf54876a]::check_crate
  33:     0x7fd6551b83bb - rustc_interface[74ce99d2ea85b1]::passes::analysis
  34:     0x7fd656577644 - rustc_query_system[29c74e3a9648926f]::query::plumbing::try_execute_query::<rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt, rustc_query_system[29c74e3a9648926f]::query::caches::DefaultCache<(), core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>>
  35:     0x7fd656577347 - rustc_query_system[29c74e3a9648926f]::query::plumbing::get_query::<rustc_query_impl[80af96805dfbd2fb]::queries::analysis, rustc_query_impl[80af96805dfbd2fb]::plumbing::QueryCtxt>
  36:     0x7fd655ffb03d - <rustc_interface[74ce99d2ea85b1]::passes::QueryContext>::enter::<rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>
  37:     0x7fd655ff75ff - <rustc_interface[74ce99d2ea85b1]::interface::Compiler>::enter::<rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}::{closure#2}, core[c2065954f2d40e37]::result::Result<core[c2065954f2d40e37]::option::Option<rustc_interface[74ce99d2ea85b1]::queries::Linker>, rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>
  38:     0x7fd655ff2672 - rustc_span[7a6d98bdad94076d]::with_source_map::<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_interface[74ce99d2ea85b1]::interface::run_compiler<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  39:     0x7fd655ff2169 - <scoped_tls[866d789ca631dc2f]::ScopedKey<rustc_span[7a6d98bdad94076d]::SessionGlobals>>::set::<rustc_interface[74ce99d2ea85b1]::interface::run_compiler<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}>::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>
  40:     0x7fd655ff1778 - std[23e74d0f7912c00c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[74ce99d2ea85b1]::util::run_in_thread_pool_with_globals<rustc_interface[74ce99d2ea85b1]::interface::run_compiler<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}>::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>
  41:     0x7fd655ff149c - <<std[23e74d0f7912c00c]::thread::Builder>::spawn_unchecked_<rustc_interface[74ce99d2ea85b1]::util::run_in_thread_pool_with_globals<rustc_interface[74ce99d2ea85b1]::interface::run_compiler<core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>, rustc_driver[b81881107b3cefb1]::run_compiler::{closure#1}>::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c2065954f2d40e37]::result::Result<(), rustc_errors[43d68c63b698f7a8]::ErrorGuaranteed>>::{closure#1} as core[c2065954f2d40e37]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7fd657a8ba83 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he8eec53b13ee98a2
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/alloc/src/boxed.rs:2000:9
  43:     0x7fd657a8ba83 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h04d7374ad262fa8b
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/alloc/src/boxed.rs:2000:9
  44:     0x7fd657a8ba83 - std::sys::unix::thread::Thread::new::thread_start::h0bc6cb3772aee1f7
                               at /rustc/85f4f41deb1557ca8ab228319d33003dd2f20f45/library/std/src/sys/unix/thread.rs:108:17
  45:     0x7fd653aa278d - <unknown>
  46:     0x7fd653b238e4 - clone
  47:                0x0 - <unknown>
thread panicked while panicking. aborting.
[1]    260501 IOT instruction (core dumped)  rustc ice.rs

Meta

rustc --version --verbose:

rustc 1.67.0-nightly (85f4f41de 2022-11-08)
binary: rustc
commit-hash: 85f4f41deb1557ca8ab228319d33003dd2f20f45
commit-date: 2022-11-08
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4

@rustbot label requires-nightly A-associated-items F-inherent_associated_types

@fmease fmease 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
@rustbot rustbot added A-associated-items Area: Associated items (types, constants & functions) F-inherent_associated_types `#![feature(inherent_associated_types)]` requires-nightly This issue requires a nightly compiler in some way. labels Nov 10, 2022
@fmease
Copy link
Member Author

fmease commented Nov 10, 2022

Context: The recent PR #103621 implemented the resolution of inherent associated types but it appears that parameter substitution was overlooked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions) C-bug Category: This is a bug. F-inherent_associated_types `#![feature(inherent_associated_types)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. 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.

3 participants