Closed
Description
Code
Playground stable: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=56aa005452055e07bce498e36cbad72b
Playground nightly: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=7e80ca3b1ec7abe08f60c41aff91f060
Somewhat similar to #78450
Edit: Actually, it's identical except this is with two lifetimes.
Edit 2: And this one crashes stable, while the other does not.
#![feature(type_alias_impl_trait, member_constraints)]
pub trait Trait {
type A;
fn f() -> Self::A;
}
pub trait Tr2<'a, 'b> {}
pub struct A<T>(T);
pub trait Tr {
type B;
}
impl<'a, 'b, T: Tr<B = dyn Tr2<'a, 'b>>> Trait for A<T> {
type A = impl core::fmt::Debug;
fn f() -> Self::A {}
}
Also crashes without enabling features, and complains that
error: ambiguous lifetime bound in `impl Trait`
--> src/lib.rs:18:14
|
18 | type A = impl core::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^^ neither `'a` nor `'b` outlives the other
|
= help: add #![feature(member_constraints)] to the crate attributes to enable
However, constraining 'b: 'a
removes this error, but not the crash. Two lifetimes are required for the crash.
Meta
rustc --version --verbose
:
rustc 1.49.0-nightly (6bdae9edd 2020-10-29)
binary: rustc
commit-hash: 6bdae9edd0cc099daa6038bca469dc09b6fc078a
commit-date: 2020-10-29
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
Also crashes on Rust Playground with stable rustc 1.47.0 (18bf6b4f0 2020-10-07) running on x86_64-unknown-linux-gnu
Error output
Running `rustc --crate-name revar --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=e78049d190dc1b43 -C extra-filename=-e78049d190dc1b43 --out-dir /home/s/.cargo_target/debug/deps -C incremental=/home/s/.cargo_target/debug/incremental -L dependency=/home/s/.cargo_target/debug/deps -C link-arg=-fuse-ld=lld`
error: internal compiler error: compiler/rustc_mir/src/borrow_check/nll.rs:444:54: region is not an ReVar: ReEarlyBound(0, 'a)
thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
note: run with `RUST_BACKTRACE=1` environment variable to display a 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.49.0-nightly (6bdae9edd 2020-10-29) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental -C link-arg=-fuse-ld=lld --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [mir_borrowck] borrow-checking `<A<T> as Trait>::f`
#1 [type_of] computing type of `<A<T> as Trait>::A::{opaque#0}`
end of query stack
error: aborting due to previous error
error: could not compile `revar`
Caused by:
process didn't exit successfully: `rustc --crate-name revar --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=e78049d190dc1b43 -C extra-filename=-e78049d190dc1b43 --out-dir /home/s/.cargo_target/debug/deps -C incremental=/home/s/.cargo_target/debug/incremental -L dependency=/home/s/.cargo_target/debug/deps -C link-arg=-fuse-ld=lld` (exit code: 101)
Backtrace
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_mir::borrow_check::type_check::free_region_relations::UniversalRegionRelations as rustc_infer::infer::free_regions::FreeRegionRelations>::sub_free_regions
9: rustc_infer::infer::InferCtxt::commit_if_ok
10: <rustc_trait_selection::traits::query::type_op::custom::CustomTypeOp<F,G> as rustc_trait_selection::traits::query::type_op::TypeOp>::fully_perform
11: rustc_mir::borrow_check::type_check::TypeChecker::eq_opaque_type_and_type
12: rustc_mir::borrow_check::type_check::type_check
13: rustc_mir::borrow_check::nll::compute_regions
14: rustc_mir::borrow_check::do_mir_borrowck
15: rustc_infer::infer::InferCtxtBuilder::enter
16: rustc_mir::borrow_check::mir_borrowck
17: core::ops::function::FnOnce::call_once
18: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_borrowck>::compute
19: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
20: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
21: rustc_data_structures::stack::ensure_sufficient_stack
22: rustc_query_system::query::plumbing::get_query_impl
23: rustc_typeck::collect::type_of::find_opaque_ty_constraints::ConstraintLocator::check
24: rustc_hir::intravisit::walk_impl_item_ref
25: rustc_hir::intravisit::walk_item
26: rustc_typeck::collect::type_of::type_of
27: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::type_of>::compute
28: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
29: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
30: rustc_data_structures::stack::ensure_sufficient_stack
31: rustc_query_system::query::plumbing::get_query_impl
32: rustc_typeck::check::check::check_item_type
33: rustc_middle::hir::map::Map::visit_item_likes_in_module
34: rustc_typeck::check::check::check_mod_item_types
35: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_mod_item_types>::compute
36: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
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: rustc_session::utils::<impl rustc_session::session::Session>::time
42: rustc_typeck::check_crate
43: rustc_interface::passes::analysis
44: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
45: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
46: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
47: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
48: rustc_query_system::query::plumbing::get_query_impl
49: rustc_interface::passes::QueryContext::enter
50: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
51: rustc_span::with_source_map
52: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: 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.