Open
Description
Code
trait MyTrait<T> {}
fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> {
todo!()
}
Meta
rustc --version --verbose
:
rustc 1.46.0 (04488afe3 2020-08-24)
rustc 1.47.0-beta.5 (9f0e6fa94 2020-09-29)
rustc 1.48.0-nightly (381b445ff 2020-09-29)
Error output
error: internal compiler error: compiler/rustc_infer/src/infer/region_constraints/mod.rs:576:17: cannot relate bound region: ReLateBound(DebruijnIndex(1), BrNamed(DefId(0:6 ~ playground[efd4]::bug::'a), 'a)) <= '_#1r
Backtrace
thread 'rustc' panicked at 'Box<Any>', /rustc/381b445ff5751f9f39ec672b623372dff09c276e/compiler/rustc_errors/src/lib.rs:891:9
stack backtrace:
0: std::panicking::begin_panic
1: rustc_errors::HandlerInner::span_bug
2: rustc_errors::Handler::span_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::span_bug_fmt
8: rustc_infer::infer::region_constraints::RegionConstraintCollector::make_subregion
9: rustc_infer::infer::region_constraints::RegionConstraintCollector::make_eqregion
10: <rustc_infer::infer::equate::Equate as rustc_middle::ty::relate::TypeRelation>::regions
11: rustc_middle::ty::relate::super_relate_tys
12: rustc_infer::infer::combine::<impl rustc_infer::infer::InferCtxt>::super_combine_tys
13: <rustc_infer::infer::equate::Equate as rustc_middle::ty::relate::TypeRelation>::tys
14: <rustc_middle::ty::subst::GenericArg as rustc_middle::ty::relate::Relate>::relate
15: <core::result::Result<T,E> as rustc_middle::ty::context::InternIteratorElement<T,R>>::intern_with
16: <rustc_middle::ty::sty::TraitRef as rustc_middle::ty::relate::Relate>::relate
17: rustc_infer::infer::InferCtxt::commit_if_ok
18: rustc_trait_selection::traits::select::SelectionContext::match_impl
19: rustc_infer::infer::InferCtxt::probe
20: rustc_middle::ty::trait_def::<impl rustc_middle::ty::context::TyCtxt>::for_each_relevant_impl
21: rustc_trait_selection::traits::select::candidate_assembly::<impl rustc_trait_selection::traits::select::SelectionContext>::assemble_candidates_from_impls
22: rustc_trait_selection::traits::select::candidate_assembly::<impl rustc_trait_selection::traits::select::SelectionContext>::assemble_candidates
23: rustc_trait_selection::traits::select::SelectionContext::candidate_from_obligation_no_cache
24: rustc_query_system::dep_graph::graph::DepGraph<K>::with_anon_task
25: rustc_trait_selection::traits::select::candidate_assembly::<impl rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation
26: rustc_trait_selection::traits::select::SelectionContext::select
27: rustc_typeck::check::coercion::Coerce::coerce
28: rustc_infer::infer::InferCtxt::commit_if_ok
29: rustc_typeck::check::coercion::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::try_coerce
30: rustc_typeck::check::coercion::CoerceMany<E>::coerce_inner
31: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
32: rustc_typeck::check::check::check_fn
33: rustc_typeck::check::closure::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_closure
34: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
35: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
36: rustc_typeck::check::fn_ctxt::FnCtxt::check_stmt
37: rustc_typeck::check::fn_ctxt::FnCtxt::check_block_with_expected
38: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
39: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
40: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_coercable_to_type
41: rustc_infer::infer::InferCtxtBuilder::enter
42: rustc_typeck::check::typeck
43: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
44: rustc_data_structures::stack::ensure_sufficient_stack
45: rustc_query_system::query::plumbing::get_query_impl
46: rustc_middle::ty::context::TyCtxt::typeck_opt_const_arg
47: rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider
48: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_allocation_raw>::compute
49: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
50: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
51: rustc_query_system::query::plumbing::get_query_impl
52: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
53: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_const_value_raw>::compute
54: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
55: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
56: rustc_query_system::query::plumbing::get_query_impl
57: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
58: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_const_value_raw>::compute
59: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
60: rustc_data_structures::stack::ensure_sufficient_stack
61: rustc_query_system::query::plumbing::get_query_impl
62: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id
63: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve
64: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_const
65: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
66: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_ty
67: rustc_middle::ty::fold::TypeFoldable::fold_with
68: rustc_middle::ty::structural_impls::fold_list
69: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
70: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_ty
71: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
72: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_ty
73: rustc_middle::ty::structural_impls::fold_list
74: rustc_trait_selection::traits::project::AssocTypeNormalizer::fold
75: rustc_trait_selection::traits::project::normalize
76: <rustc_infer::infer::InferCtxt as rustc_trait_selection::infer::InferCtxtExt>::partially_normalize_associated_types_in
77: rustc_typeck::check::inherited::Inherited::normalize_associated_types_in
78: rustc_infer::infer::InferCtxtBuilder::enter
79: rustc_typeck::check::wfcheck::check_item_well_formed
80: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_item_well_formed>::compute
81: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
82: rustc_data_structures::stack::ensure_sufficient_stack
83: rustc_query_system::query::plumbing::get_query_impl
84: rustc_query_system::query::plumbing::ensure_query_impl
85: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
86: rustc_hir::hir::Crate::par_visit_all_item_likes
87: rustc_session::session::Session::track_errors
88: rustc_typeck::check_crate
89: rustc_interface::passes::analysis
90: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
91: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
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-nightly (381b445ff 2020-09-29) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [typeck] type-checking `bug::{constant#0}`
#1 [eval_to_allocation_raw] const-evaluating + checking `bug::{constant#0}`
#2 [eval_to_const_value_raw] simplifying constant for the type system `bug::{constant#0}`
#3 [eval_to_const_value_raw] simplifying constant for the type system `bug::{constant#0}`
#4 [check_item_well_formed] checking that `bug` is well-formed
#5 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error
error: could not compile `playground`
Maybe related to #73375 , #75883 and #66152 ? Feel free to close if so :)
Metadata
Metadata
Assignees
Labels
Area: const generics (parameters and arguments)Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#![feature(const_generics)]`Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.This issue requires a nightly compiler in some way.