Closed
Description
Code
#![feature(type_alias_enum_variants)]
enum Outer<T> {
A(T)
}
enum Inner {
A(i32)
}
type OuterAlias = Outer<Inner>;
fn ice(x: OuterAlias) {
// Fine
match x {
OuterAlias::A(Inner::A(_)) => (),
}
// Not fine
match x {
OuterAlias::A(Inner::A(y)) => (),
}
}
fn main() {}
Error
$ RUST_BACKTRACE=1 cargo check
Checking enum-ice v0.1.0
warning: unused variable: `y`
--> src/main.rs:28:32
|
28 | OuterAlias::B(Inner::B(y)) => (),
| ^ help: consider using `_y` instead
|
= note: #[warn(unused_variables)] on by default
error: internal compiler error: src/librustc/mir/tcx.rs:139: cannot downcast non-ADT type: `Ty { ty: _ }`
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:589:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
1: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:70
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:58
at src/libstd/panicking.rs:200
3: std::panicking::default_hook
at src/libstd/panicking.rs:215
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:482
6: std::panicking::begin_panic
7: rustc_errors::Handler::bug
8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
9: rustc::ty::context::tls::with_opt::{{closure}}
10: rustc::ty::context::tls::with_context_opt
11: rustc::ty::context::tls::with_opt
12: rustc::util::bug::opt_span_bug_fmt
13: rustc::util::bug::bug_fmt
14: rustc::mir::tcx::PlaceTy::projection_ty_core
15: rustc_traits::type_op::AscribeUserTypeCx::relate_mir_and_user_ty
16: rustc::ty::context::GlobalCtxt::enter_local
17: rustc_traits::type_op::type_op_ascribe_user_type
18: rustc::ty::query::__query_compute::type_op_ascribe_user_type
19: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::type_op_ascribe_user_type<'tcx>>::compute
20: rustc::dep_graph::graph::DepGraph::with_task_impl
21: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with
22: <rustc::traits::query::type_op::ascribe_user_type::AscribeUserType<'tcx> as rustc::traits::query::type_op::QueryTypeOp<'gcx, 'tcx>>::perform_query
23: rustc::traits::query::type_op::QueryTypeOp::fully_perform_into
24: <rustc::ty::ParamEnvAnd<'tcx, Q> as rustc::traits::query::type_op::TypeOp<'gcx, 'tcx>>::fully_perform
25: rustc_mir::borrow_check::nll::type_check::TypeChecker::relate_type_and_user_type
26: <rustc_mir::borrow_check::nll::type_check::TypeVerifier<'a, 'b, 'gcx, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_local_decl
27: <rustc_mir::borrow_check::nll::type_check::TypeVerifier<'a, 'b, 'gcx, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_mir
28: rustc_mir::borrow_check::nll::type_check::type_check
29: rustc_mir::borrow_check::nll::compute_regions
30: rustc_mir::borrow_check::do_mir_borrowck
31: rustc::ty::context::GlobalCtxt::enter_local
32: rustc_mir::borrow_check::mir_borrowck
33: rustc::ty::query::__query_compute::mir_borrowck
34: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::mir_borrowck<'tcx>>::compute
35: rustc::dep_graph::graph::DepGraph::with_task_impl
36: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with
37: rustc::ty::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::par_body_owners
38: rustc::util::common::time
39: <std::thread::local::LocalKey<T>>::with
40: rustc::ty::context::TyCtxt::create_and_enter
41: rustc_driver::driver::compile_input
42: <scoped_tls::ScopedKey<T>>::set
43: rustc_driver::run_compiler
44: <scoped_tls::ScopedKey<T>>::set
query stack during panic:
#0 [type_op_ascribe_user_type] evaluating `type_op_ascribe_user_type` `Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing, def_id: None }, value: AscribeUserType { mir_ty: i32, variance: o, def_id: DefId(0/0:3 ~ enum_ice[5e33]::Outer[0]), user_substs: UserSubsts { substs: [^0], user_self_ty: Some(UserSelfTy { impl_def_id: DefId(0/0:3 ~ enum_ice[5e33]::Outer[0]), self_ty: Outer<Inner> }) }, projs: [Downcast(Outer, 1), Field(field[0], ()), Downcast(Inner, 1), Field(field[0], ())] } } }`
#1 [mir_borrowck] processing `ice`
end of query stack
error: aborting due to previous error
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.33.0-nightly (4c2be9c97 2019-01-22) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
error: Could not compile `enum-ice`.
To learn more, run the command again with --verbose.
cc #49683