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: tried to get type of this RPITIT with no definition #113434

Closed
matthiaskrgr opened this issue Jul 7, 2023 · 0 comments · Fixed by #113741
Closed

ICE: tried to get type of this RPITIT with no definition #113434

matthiaskrgr opened this issue Jul 7, 2023 · 0 comments · Fixed by #113741
Assignees
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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

@matthiaskrgr
Copy link
Member

Code

#![feature(return_position_impl_trait_in_trait)]

struct Wrapper<G: Send>(T);

trait Foo {
    fn bar() -> Wrapper<impl Sized>;
}

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (7cc3da05f 2023-07-07)
binary: rustc
commit-hash: 7cc3da05f99fbc89782fc6cb7e207fa11aa6add5
commit-date: 2023-07-07
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5

Error output

error[E0412]: cannot find type `T` in this scope
 --> treereduce.out:3:25
  |
3 | struct Wrapper<G: Send>(T);
  |                -        ^
  |                |
  |                similarly named type parameter `G` defined here
  |
help: a type parameter with a similar name exists
  |
3 | struct Wrapper<G: Send>(G);
  |                         ~
help: you might be missing a type parameter
  |
3 | struct Wrapper<G: Send, T>(T);
  |                       +++

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

error: internal compiler error: compiler/rustc_hir_analysis/src/collect/type_of.rs:449:25: tried to get type of this RPITIT with no definition
 --> treereduce.out:6:25
  |
6 |     fn bar() -> Wrapper<impl Sized>;
  |                         ^^^^^^^^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/compiler/rustc_errors/src/lib.rs:995:33
stack backtrace:
   0:     0x7f0f73763a71 - std::backtrace_rs::backtrace::libunwind::trace::ha9eb60b7e9595e43
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f0f73763a71 - std::backtrace_rs::backtrace::trace_unsynchronized::h4b381e53365308cd
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f0f73763a71 - std::sys_common::backtrace::_print_fmt::h13219a32c4092344
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f0f73763a71 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h37c35e5b57c1a1e8
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f0f737c9d7f - core::fmt::rt::Argument::fmt::h24cb19a613845dee
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/core/src/fmt/rt.rs:138:9
   5:     0x7f0f737c9d7f - core::fmt::write::h62d070c7ceeab948
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f0f737564b7 - std::io::Write::write_fmt::h92df2d506a8d4373
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/std/src/io/mod.rs:1714:15
   7:     0x7f0f73763885 - std::sys_common::backtrace::_print::he4455f5d3168b7ed
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f0f73763885 - std::sys_common::backtrace::print::h017586ca1c39223e
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f0f73766663 - std::panicking::default_hook::{{closure}}::h3dc1335f6a07681e
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/std/src/panicking.rs:269:22
  10:     0x7f0f737663f4 - std::panicking::default_hook::hc2cfda04971b7526
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/std/src/panicking.rs:288:9
  11:     0x7f0f76a5763b - rustc_driver_impl[2c8644295fefa5d3]::install_ice_hook::{closure#0}
  12:     0x7f0f73766e8e - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h09569cbca6d2954c
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/alloc/src/boxed.rs:2007:9
  13:     0x7f0f73766e8e - std::panicking::rust_panic_with_hook::h711ce0c3c756b372
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/std/src/panicking.rs:709:13
  14:     0x7f0f76b9acd1 - std[b168e09260424fec]::panicking::begin_panic::<rustc_errors[7976e2d93b709148]::ExplicitBug>::{closure#0}
  15:     0x7f0f76b9a3a6 - std[b168e09260424fec]::sys_common::backtrace::__rust_end_short_backtrace::<std[b168e09260424fec]::panicking::begin_panic<rustc_errors[7976e2d93b709148]::ExplicitBug>::{closure#0}, !>
  16:     0x7f0f76b66796 - std[b168e09260424fec]::panicking::begin_panic::<rustc_errors[7976e2d93b709148]::ExplicitBug>
  17:     0x7f0f76ba2ece - <rustc_errors[7976e2d93b709148]::HandlerInner>::span_bug::<rustc_span[33767492b6b5a02]::span_encoding::Span, alloc[ab7c3a594cfea29c]::string::String>
  18:     0x7f0f76ba2d5d - <rustc_errors[7976e2d93b709148]::Handler>::span_bug::<rustc_span[33767492b6b5a02]::span_encoding::Span, alloc[ab7c3a594cfea29c]::string::String>
  19:     0x7f0f76bd1f0d - rustc_middle[552c7c9d188a2017]::util::bug::opt_span_bug_fmt::<rustc_span[33767492b6b5a02]::span_encoding::Span>::{closure#0}
  20:     0x7f0f76bd1f3a - rustc_middle[552c7c9d188a2017]::ty::context::tls::with_opt::<rustc_middle[552c7c9d188a2017]::util::bug::opt_span_bug_fmt<rustc_span[33767492b6b5a02]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f0f76bd0b1a - rustc_middle[552c7c9d188a2017]::ty::context::tls::with_context_opt::<rustc_middle[552c7c9d188a2017]::ty::context::tls::with_opt<rustc_middle[552c7c9d188a2017]::util::bug::opt_span_bug_fmt<rustc_span[33767492b6b5a02]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f0f76bd0984 - rustc_middle[552c7c9d188a2017]::util::bug::span_bug_fmt::<rustc_span[33767492b6b5a02]::span_encoding::Span>
  23:     0x7f0f75bc241b - rustc_hir_analysis[90b95fe540d9f783]::collect::type_of::type_of
  24:     0x7f0f74bb3a03 - rustc_query_impl[da0a9e5c9406df23]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[da0a9e5c9406df23]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[552c7c9d188a2017]::query::erase::Erased<[u8; 8usize]>>
  25:     0x7f0f74bb39c0 - <rustc_query_impl[da0a9e5c9406df23]::query_impl::type_of::dynamic_query::{closure#2} as core[60225dfec80b3f9a]::ops::function::FnOnce<(rustc_middle[552c7c9d188a2017]::ty::context::TyCtxt, rustc_span[33767492b6b5a02]::def_id::DefId)>>::call_once
  26:     0x7f0f74a78ec5 - rustc_query_system[5ae56448178afbd9]::query::plumbing::try_execute_query::<rustc_query_impl[da0a9e5c9406df23]::DynamicConfig<rustc_query_system[5ae56448178afbd9]::query::caches::DefaultCache<rustc_span[33767492b6b5a02]::def_id::DefId, rustc_middle[552c7c9d188a2017]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[da0a9e5c9406df23]::plumbing::QueryCtxt, false>
  27:     0x7f0f7639e893 - rustc_query_impl[da0a9e5c9406df23]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f0f74ce968a - rustc_middle[552c7c9d188a2017]::query::plumbing::query_get_at::<rustc_query_system[5ae56448178afbd9]::query::caches::DefaultCache<rustc_span[33767492b6b5a02]::def_id::DefId, rustc_middle[552c7c9d188a2017]::query::erase::Erased<[u8; 8usize]>>>
  29:     0x7f0f74cd9e14 - <rustc_trait_selection[14451b4dfb15a533]::traits::select::SelectionContext>::select
  30:     0x7f0f74caaf67 - <rustc_trait_selection[14451b4dfb15a533]::traits::fulfill::FulfillProcessor as rustc_data_structures[c1611a994bbf6062]::obligation_forest::ObligationProcessor>::process_obligation
  31:     0x7f0f74ca8174 - <rustc_data_structures[c1611a994bbf6062]::obligation_forest::ObligationForest<rustc_trait_selection[14451b4dfb15a533]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[14451b4dfb15a533]::traits::fulfill::FulfillProcessor>
  32:     0x7f0f757567f0 - <rustc_trait_selection[14451b4dfb15a533]::traits::engine::ObligationCtxt>::assumed_wf_types_and_report_errors
  33:     0x7f0f75750272 - rustc_hir_analysis[90b95fe540d9f783]::check::wfcheck::check_associated_item
  34:     0x7f0f7574b0ec - rustc_hir_analysis[90b95fe540d9f783]::check::wfcheck::check_well_formed
  35:     0x7f0f74a318fc - rustc_query_impl[da0a9e5c9406df23]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[da0a9e5c9406df23]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[552c7c9d188a2017]::query::erase::Erased<[u8; 0usize]>>
  36:     0x7f0f75282d86 - rustc_query_system[5ae56448178afbd9]::query::plumbing::try_execute_query::<rustc_query_impl[da0a9e5c9406df23]::DynamicConfig<rustc_query_system[5ae56448178afbd9]::query::caches::VecCache<rustc_hir[cca41b40a34d6c6b]::hir_id::OwnerId, rustc_middle[552c7c9d188a2017]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[da0a9e5c9406df23]::plumbing::QueryCtxt, false>
  37:     0x7f0f75282ad4 - rustc_query_impl[da0a9e5c9406df23]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f0f75d55d03 - std[b168e09260424fec]::panicking::try::<(), core[60225dfec80b3f9a]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[c1611a994bbf6062]::sync::par_for_each_in<&[rustc_hir[cca41b40a34d6c6b]::hir::ForeignItemId], <rustc_middle[552c7c9d188a2017]::hir::ModuleItems>::par_foreign_items<rustc_hir_analysis[90b95fe540d9f783]::check::wfcheck::check_mod_type_wf::{closure#3}>::{closure#0}>::{closure#0}::{closure#0}>>
  39:     0x7f0f75d55b57 - rustc_data_structures[c1611a994bbf6062]::sync::par_for_each_in::<&[rustc_hir[cca41b40a34d6c6b]::hir::TraitItemId], <rustc_middle[552c7c9d188a2017]::hir::ModuleItems>::par_trait_items<rustc_hir_analysis[90b95fe540d9f783]::check::wfcheck::check_mod_type_wf::{closure#2}>::{closure#0}>
  40:     0x7f0f75d55a66 - rustc_hir_analysis[90b95fe540d9f783]::check::wfcheck::check_mod_type_wf
  41:     0x7f0f7571c8ec - rustc_query_impl[da0a9e5c9406df23]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[da0a9e5c9406df23]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[552c7c9d188a2017]::query::erase::Erased<[u8; 0usize]>>
  42:     0x7f0f7571c8ce - <rustc_query_impl[da0a9e5c9406df23]::query_impl::check_mod_type_wf::dynamic_query::{closure#2} as core[60225dfec80b3f9a]::ops::function::FnOnce<(rustc_middle[552c7c9d188a2017]::ty::context::TyCtxt, rustc_span[33767492b6b5a02]::def_id::LocalDefId)>>::call_once
  43:     0x7f0f7517263f - rustc_query_system[5ae56448178afbd9]::query::plumbing::try_execute_query::<rustc_query_impl[da0a9e5c9406df23]::DynamicConfig<rustc_query_system[5ae56448178afbd9]::query::caches::VecCache<rustc_span[33767492b6b5a02]::def_id::LocalDefId, rustc_middle[552c7c9d188a2017]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[da0a9e5c9406df23]::plumbing::QueryCtxt, false>
  44:     0x7f0f76397a84 - rustc_query_impl[da0a9e5c9406df23]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7f0f75e78b85 - std[b168e09260424fec]::panicking::try::<(), core[60225dfec80b3f9a]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[c1611a994bbf6062]::sync::par_for_each_in<&[rustc_hir[cca41b40a34d6c6b]::hir_id::OwnerId], <rustc_middle[552c7c9d188a2017]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[90b95fe540d9f783]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>>
  46:     0x7f0f75e78aa7 - rustc_data_structures[c1611a994bbf6062]::sync::par_for_each_in::<&[rustc_hir[cca41b40a34d6c6b]::hir_id::OwnerId], <rustc_middle[552c7c9d188a2017]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[90b95fe540d9f783]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
  47:     0x7f0f75e78877 - <rustc_session[e531b74a05efb0ed]::session::Session>::track_errors::<rustc_hir_analysis[90b95fe540d9f783]::check_crate::{closure#5}, ()>
  48:     0x7f0f75e7671f - rustc_hir_analysis[90b95fe540d9f783]::check_crate
  49:     0x7f0f75e6d7ba - rustc_interface[32a8ee385a384e74]::passes::analysis
  50:     0x7f0f75f098ba - rustc_query_impl[da0a9e5c9406df23]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[da0a9e5c9406df23]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[552c7c9d188a2017]::query::erase::Erased<[u8; 1usize]>>
  51:     0x7f0f75f098a9 - <rustc_query_impl[da0a9e5c9406df23]::query_impl::analysis::dynamic_query::{closure#2} as core[60225dfec80b3f9a]::ops::function::FnOnce<(rustc_middle[552c7c9d188a2017]::ty::context::TyCtxt, ())>>::call_once
  52:     0x7f0f7608bc28 - rustc_query_system[5ae56448178afbd9]::query::plumbing::try_execute_query::<rustc_query_impl[da0a9e5c9406df23]::DynamicConfig<rustc_query_system[5ae56448178afbd9]::query::caches::SingleCache<rustc_middle[552c7c9d188a2017]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[da0a9e5c9406df23]::plumbing::QueryCtxt, false>
  53:     0x7f0f7608b9f9 - rustc_query_impl[da0a9e5c9406df23]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  54:     0x7f0f75c59325 - <rustc_middle[552c7c9d188a2017]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[2c8644295fefa5d3]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[60225dfec80b3f9a]::result::Result<(), rustc_span[33767492b6b5a02]::ErrorGuaranteed>>
  55:     0x7f0f75c58952 - <rustc_interface[32a8ee385a384e74]::interface::Compiler>::enter::<rustc_driver_impl[2c8644295fefa5d3]::run_compiler::{closure#1}::{closure#2}, core[60225dfec80b3f9a]::result::Result<core[60225dfec80b3f9a]::option::Option<rustc_interface[32a8ee385a384e74]::queries::Linker>, rustc_span[33767492b6b5a02]::ErrorGuaranteed>>
  56:     0x7f0f75c4f665 - rustc_span[33767492b6b5a02]::set_source_map::<core[60225dfec80b3f9a]::result::Result<(), rustc_span[33767492b6b5a02]::ErrorGuaranteed>, rustc_interface[32a8ee385a384e74]::interface::run_compiler<core[60225dfec80b3f9a]::result::Result<(), rustc_span[33767492b6b5a02]::ErrorGuaranteed>, rustc_driver_impl[2c8644295fefa5d3]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  57:     0x7f0f75c4f0d6 - <scoped_tls[f7286f318c19c9e0]::ScopedKey<rustc_span[33767492b6b5a02]::SessionGlobals>>::set::<rustc_interface[32a8ee385a384e74]::interface::run_compiler<core[60225dfec80b3f9a]::result::Result<(), rustc_span[33767492b6b5a02]::ErrorGuaranteed>, rustc_driver_impl[2c8644295fefa5d3]::run_compiler::{closure#1}>::{closure#0}, core[60225dfec80b3f9a]::result::Result<(), rustc_span[33767492b6b5a02]::ErrorGuaranteed>>
  58:     0x7f0f75c4e69c - std[b168e09260424fec]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[32a8ee385a384e74]::util::run_in_thread_pool_with_globals<rustc_interface[32a8ee385a384e74]::interface::run_compiler<core[60225dfec80b3f9a]::result::Result<(), rustc_span[33767492b6b5a02]::ErrorGuaranteed>, rustc_driver_impl[2c8644295fefa5d3]::run_compiler::{closure#1}>::{closure#0}, core[60225dfec80b3f9a]::result::Result<(), rustc_span[33767492b6b5a02]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[60225dfec80b3f9a]::result::Result<(), rustc_span[33767492b6b5a02]::ErrorGuaranteed>>
  59:     0x7f0f75c4e465 - <<std[b168e09260424fec]::thread::Builder>::spawn_unchecked_<rustc_interface[32a8ee385a384e74]::util::run_in_thread_pool_with_globals<rustc_interface[32a8ee385a384e74]::interface::run_compiler<core[60225dfec80b3f9a]::result::Result<(), rustc_span[33767492b6b5a02]::ErrorGuaranteed>, rustc_driver_impl[2c8644295fefa5d3]::run_compiler::{closure#1}>::{closure#0}, core[60225dfec80b3f9a]::result::Result<(), rustc_span[33767492b6b5a02]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[60225dfec80b3f9a]::result::Result<(), rustc_span[33767492b6b5a02]::ErrorGuaranteed>>::{closure#1} as core[60225dfec80b3f9a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  60:     0x7f0f73771305 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hbcd8640e4284e53b
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/alloc/src/boxed.rs:1993:9
  61:     0x7f0f73771305 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h56beffb9a0c5518d
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/alloc/src/boxed.rs:1993:9
  62:     0x7f0f73771305 - std::sys::unix::thread::Thread::new::thread_start::he7634fd99f9e4d01
                               at /rustc/7cc3da05f99fbc89782fc6cb7e207fa11aa6add5/library/std/src/sys/unix/thread.rs:108:17
  63:     0x7f0f7350444b - <unknown>
  64:     0x7f0f73587e40 - <unknown>
  65:                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 (7cc3da05f 2023-07-07) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [type_of] computing type of `Foo::bar::{opaque#0}`
#1 [check_well_formed] checking that `Foo::bar` is well-formed
#2 [check_mod_type_wf] checking that types are well-formed in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

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

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels Jul 7, 2023
@spastorino spastorino self-assigned this Jul 7, 2023
@spastorino spastorino added the requires-nightly This issue requires a nightly compiler in some way. label Jul 7, 2023
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jul 14, 2023
@bors bors closed this as completed in 126d809 Jul 31, 2023
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. glacier ICE tracked in rust-lang/glacier. 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
3 participants