Skip to content

ICE: Induced by '_ bound on associated type in RPITIT. #108579

Closed
@jswrenn

Description

@jswrenn

Code

(Playground)

#![feature(associated_type_bounds, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]

trait Trait {
    type Type;

    fn method(&self) -> impl Trait<Type: '_>;
    // the problematic bound ------------^^
}

Meta

Version:

1.69.0-nightly (2023-02-27 7281249a19a9755e9d88)

Error output

thread 'rustc' panicked at 'Normalizing [Binder(ProjectionPredicate(AliasTy { substs: [Self, ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrNamed(DefId(0:6 ~ playground[5c2a]::Trait::method::'_), '_) })], def_id: DefId(0:9 ~ playground[5c2a]::Trait::method::{opaque#0}::{opaque#0}) }, Term::Ty(impl Sized + '_)), [Region(BrNamed(DefId(0:6 ~ playground[5c2a]::Trait::method::'_), '_))]), Binder(ProjectionPredicate(AliasTy { substs: [Self, ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:6 ~ playground[5c2a]::Trait::method::'_), '_) })], def_id: DefId(0:7 ~ playground[5c2a]::Trait::method::{opaque#0}) }, Term::Ty(impl Trait<Type = impl Sized + '_>)), [Region(BrNamed(DefId(0:6 ~ playground[5c2a]::Trait::method::'_), '_))]), Binder(TraitPredicate(<Self as Trait>, polarity:Positive), [])] without wrapping in a `Binder`', compiler/rustc_trait_selection/src/traits/project.rs:437:9
stack backtrace:
   0:     0x7fddb79cdbaa - std::backtrace_rs::backtrace::libunwind::trace::hed88b98b82d4f2e9
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fddb79cdbaa - std::backtrace_rs::backtrace::trace_unsynchronized::ha265951554c18f80
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fddb79cdbaa - std::sys_common::backtrace::_print_fmt::h905c58b80bf24d6a
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fddb79cdbaa - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h42fd3bc77561f5c7
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fddb7a312fe - core::fmt::write::hb1a89058387c66a8
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/core/src/fmt/mod.rs:1232:17
   5:     0x7fddb79c0c15 - std::io::Write::write_fmt::h807c51614e4697cf
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/std/src/io/mod.rs:1684:15
   6:     0x7fddb79cd975 - std::sys_common::backtrace::_print::h94c45e542d878e8b
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fddb79cd975 - std::sys_common::backtrace::print::hf09a0b93d8d5d616
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fddb79d06ef - std::panicking::default_hook::{{closure}}::h854554d33df993ef
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/std/src/panicking.rs:271:22
   9:     0x7fddb79d042b - std::panicking::default_hook::h47e0374d899bdb79
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/std/src/panicking.rs:290:9
  10:     0x7fddbac392f5 - rustc_driver_impl[1328d09be3dc1a8e]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fddb79d0f2d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hd6f08b1b7897cbbd
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/alloc/src/boxed.rs:2002:9
  12:     0x7fddb79d0f2d - std::panicking::rust_panic_with_hook::h73cfebaefb6d5c31
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/std/src/panicking.rs:696:13
  13:     0x7fddb79d0ca9 - std::panicking::begin_panic_handler::{{closure}}::h2e79312bef9db676
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/std/src/panicking.rs:583:13
  14:     0x7fddb79ce016 - std::sys_common::backtrace::__rust_end_short_backtrace::h7972a918610407b0
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/std/src/sys_common/backtrace.rs:137:18
  15:     0x7fddb79d09b2 - rust_begin_unwind
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/std/src/panicking.rs:579:5
  16:     0x7fddb7a2d663 - core::panicking::panic_fmt::h28cbdee921d72b75
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/core/src/panicking.rs:64:14
  17:     0x7fddb98c77bd - rustc_trait_selection[6204b92df2abe020]::traits::do_normalize_predicates
  18:     0x7fddb98c4db7 - rustc_trait_selection[6204b92df2abe020]::traits::normalize_param_env_or_error
  19:     0x7fddb98c2065 - rustc_ty_utils[15732cc8dbd096df]::ty::param_env
  20:     0x7fddb98bf939 - rustc_query_system[90808657c38d1bea]::query::plumbing::try_execute_query::<rustc_query_impl[b7eb43ed52c37c26]::queries::param_env, rustc_query_impl[b7eb43ed52c37c26]::plumbing::QueryCtxt>
  21:     0x7fddb99e8376 - rustc_hir_analysis[58bd12f7f7a259]::check::wfcheck::check_associated_item
  22:     0x7fddb99e474c - rustc_hir_analysis[58bd12f7f7a259]::check::wfcheck::check_well_formed
  23:     0x7fddb91e923d - rustc_query_system[90808657c38d1bea]::query::plumbing::try_execute_query::<rustc_query_impl[b7eb43ed52c37c26]::queries::check_well_formed, rustc_query_impl[b7eb43ed52c37c26]::plumbing::QueryCtxt>
  24:     0x7fddb91e8c1e - <rustc_query_impl[b7eb43ed52c37c26]::Queries as rustc_middle[1bc382fc214918e1]::ty::query::QueryEngine>::check_well_formed
  25:     0x7fddba173a08 - rustc_data_structures[177608677af0df82]::sync::par_for_each_in::<&[rustc_hir[37358d514e413a25]::hir::TraitItemId], <rustc_middle[1bc382fc214918e1]::hir::ModuleItems>::par_trait_items<rustc_hir_analysis[58bd12f7f7a259]::check::wfcheck::check_mod_type_wf::{closure#2}>::{closure#0}>
  26:     0x7fddba17391c - rustc_hir_analysis[58bd12f7f7a259]::check::wfcheck::check_mod_type_wf
  27:     0x7fddba2b1981 - rustc_query_system[90808657c38d1bea]::query::plumbing::try_execute_query::<rustc_query_impl[b7eb43ed52c37c26]::queries::check_mod_type_wf, rustc_query_impl[b7eb43ed52c37c26]::plumbing::QueryCtxt>
  28:     0x7fddba2b152a - <rustc_query_impl[b7eb43ed52c37c26]::Queries as rustc_middle[1bc382fc214918e1]::ty::query::QueryEngine>::check_mod_type_wf
  29:     0x7fddb9092248 - rustc_data_structures[177608677af0df82]::sync::par_for_each_in::<&[rustc_hir[37358d514e413a25]::hir_id::OwnerId], <rustc_middle[1bc382fc214918e1]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[58bd12f7f7a259]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
  30:     0x7fddb90920d0 - <rustc_session[b38dad6cf268045a]::session::Session>::track_errors::<rustc_hir_analysis[58bd12f7f7a259]::check_crate::{closure#5}, ()>
  31:     0x7fddb908f570 - rustc_hir_analysis[58bd12f7f7a259]::check_crate
  32:     0x7fddb9085472 - rustc_interface[e667fd6539aa89ef]::passes::analysis
  33:     0x7fddba48ff6d - rustc_query_system[90808657c38d1bea]::query::plumbing::try_execute_query::<rustc_query_impl[b7eb43ed52c37c26]::queries::analysis, rustc_query_impl[b7eb43ed52c37c26]::plumbing::QueryCtxt>
  34:     0x7fddba48fc6f - <rustc_query_impl[b7eb43ed52c37c26]::Queries as rustc_middle[1bc382fc214918e1]::ty::query::QueryEngine>::analysis
  35:     0x7fddba2b5f06 - <rustc_middle[1bc382fc214918e1]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[1328d09be3dc1a8e]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[dfaf1ef37f016df7]::result::Result<(), rustc_span[ca1c0a0508e86155]::ErrorGuaranteed>>
  36:     0x7fddb9e978d8 - rustc_span[ca1c0a0508e86155]::with_source_map::<core[dfaf1ef37f016df7]::result::Result<(), rustc_span[ca1c0a0508e86155]::ErrorGuaranteed>, rustc_interface[e667fd6539aa89ef]::interface::run_compiler<core[dfaf1ef37f016df7]::result::Result<(), rustc_span[ca1c0a0508e86155]::ErrorGuaranteed>, rustc_driver_impl[1328d09be3dc1a8e]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  37:     0x7fddb9e8efbc - std[d01210ab3b315fe2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e667fd6539aa89ef]::util::run_in_thread_pool_with_globals<rustc_interface[e667fd6539aa89ef]::interface::run_compiler<core[dfaf1ef37f016df7]::result::Result<(), rustc_span[ca1c0a0508e86155]::ErrorGuaranteed>, rustc_driver_impl[1328d09be3dc1a8e]::run_compiler::{closure#1}>::{closure#0}, core[dfaf1ef37f016df7]::result::Result<(), rustc_span[ca1c0a0508e86155]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[dfaf1ef37f016df7]::result::Result<(), rustc_span[ca1c0a0508e86155]::ErrorGuaranteed>>
  38:     0x7fddb9e8e9ea - <<std[d01210ab3b315fe2]::thread::Builder>::spawn_unchecked_<rustc_interface[e667fd6539aa89ef]::util::run_in_thread_pool_with_globals<rustc_interface[e667fd6539aa89ef]::interface::run_compiler<core[dfaf1ef37f016df7]::result::Result<(), rustc_span[ca1c0a0508e86155]::ErrorGuaranteed>, rustc_driver_impl[1328d09be3dc1a8e]::run_compiler::{closure#1}>::{closure#0}, core[dfaf1ef37f016df7]::result::Result<(), rustc_span[ca1c0a0508e86155]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[dfaf1ef37f016df7]::result::Result<(), rustc_span[ca1c0a0508e86155]::ErrorGuaranteed>>::{closure#1} as core[dfaf1ef37f016df7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:     0x7fddb79dad63 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h23732028e1dd2dcf
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/alloc/src/boxed.rs:1988:9
  40:     0x7fddb79dad63 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h10e7b0e430440157
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/alloc/src/boxed.rs:1988:9
  41:     0x7fddb79dad63 - std::sys::unix::thread::Thread::new::thread_start::hf1c234831da9bd27
                               at /rustc/7281249a19a9755e9d889ee251ec323629caadab/library/std/src/sys/unix/thread.rs:108:17
  42:     0x7fddb78a0609 - start_thread
  43:     0x7fddb77c3133 - clone
  44:                0x0 - <unknown>

error: 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.69.0-nightly (7281249a1 2023-02-27) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [param_env] computing normalized predicates of `Trait::method`
#1 [check_well_formed] checking that `Trait::method` 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

Metadata

Metadata

Labels

C-bugCategory: This is a bug.F-return_position_impl_trait_in_trait`#![feature(return_position_impl_trait_in_trait)]`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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions