Closed
Description
This happens on stable 1.48.0, beta 1.49.0-beta2 as well as the current nightly.
trait MP {
type T<'a>;
}
struct S(String);
impl MP for S {
type T<'a> = &'a str;
}
trait SR: MP {
fn sr<IM>(&self) -> i32
where
for<'a> IM: T<T: U<<Self as MP>::T<'a>>>;
}
trait T {
type T;
}
trait U<X> {}
error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:78:18: bound region is not anonymous
This error occurs also when the associated_type_bounds
and generic_associated_types
features are enabled on nighly, another playground.
Backtrace
error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:78:18: bound region is not anonymous
thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
stack backtrace:
0: std::panicking::begin_panic
1: rustc_errors::HandlerInner::bug
2: rustc_errors::Handler::bug
3: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
4: rustc_middle::ty::context::tls::with_opt::{{closure}}
5: rustc_middle::ty::context::tls::with_opt
6: rustc_middle::util::bug::opt_span_bug_fmt
7: rustc_middle::util::bug::bug_fmt
8: rustc_middle::ty::sty::BoundRegion::assert_bound_var
9: alloc::collections::btree::map::Entry<K,V>::or_insert_with
10: rustc_middle::ty::fold::<impl rustc_middle::ty::context::TyCtxt>::replace_escaping_bound_vars::{{closure}}
11: <rustc_middle::ty::fold::BoundVarReplacer as rustc_middle::ty::fold::TypeFolder>::fold_region
12: rustc_middle::ty::fold::TypeFoldable::fold_with
13: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
14: <rustc_middle::ty::fold::BoundVarReplacer as rustc_middle::ty::fold::TypeFolder>::fold_ty
15: rustc_middle::ty::fold::TypeFoldable::fold_with
16: rustc_middle::ty::fold::TypeFoldable::fold_with
17: rustc_middle::ty::fold::TypeFoldable::fold_with
18: rustc_middle::ty::structural_impls::fold_list
19: rustc_middle::ty::fold::<impl rustc_middle::ty::context::TyCtxt>::replace_escaping_bound_vars
20: <rustc_middle::infer::canonical::Canonical<V> as rustc_infer::infer::canonical::substitute::CanonicalExt<V>>::substitute
21: rustc_infer::infer::InferCtxtBuilder::enter_with_canonical
22: rustc_traits::evaluate_obligation::evaluate_obligation
23: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::evaluate_obligation>::compute
24: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
25: rustc_data_structures::stack::ensure_sufficient_stack
26: rustc_query_system::query::plumbing::get_query_impl
27: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
28: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
29: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::predicate_must_hold_modulo_regions
30: rustc_typeck::check::wfcheck::receiver_is_implemented
31: rustc_typeck::check::wfcheck::receiver_is_valid
32: rustc_typeck::check::wfcheck::check_method_receiver
33: rustc_infer::infer::InferCtxtBuilder::enter
34: rustc_typeck::check::wfcheck::check_associated_item
35: rustc_typeck::check::wfcheck::check_trait_item
36: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_trait_item_well_formed>::compute
37: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
38: rustc_data_structures::stack::ensure_sufficient_stack
39: rustc_query_system::query::plumbing::get_query_impl
40: rustc_query_system::query::plumbing::ensure_query_impl
41: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
42: rustc_hir::hir::Crate::par_visit_all_item_likes
43: rustc_session::session::Session::track_errors
44: rustc_typeck::check_crate
45: rustc_interface::passes::analysis
46: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
47: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
48: rustc_data_structures::stack::ensure_sufficient_stack
49: rustc_query_system::query::plumbing::get_query_impl
50: rustc_interface::passes::QueryContext::enter
51: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
52: rustc_span::with_source_map
53: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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.48.0 (7eac88abb 2020-11-16) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `&Self: std::ops::Receiver`
#1 [check_trait_item_well_formed] checking that `SR::sr` is well-formed
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors
Metadata
Metadata
Assignees
Labels
Area: Generic associated types (GATs)Area: Associated items (types, constants & functions)Area: Trait systemCategory: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#![feature(associated_type_bounds)]``#![feature(generic_associated_types)]` a.k.a. GATsIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.Performance or correctness regression from one stable version to another.This issue requires a nightly compiler in some way.