Closed
Description
Another ICE that uses a nightly only feature, but still crashes on stable, beta and nightly without the #![feature(existential_type)]
flag.
trait Bug {
type Item: Bug;
const FUN: fn() -> Self::Item;
}
impl Bug for &() {
existential type Item: Bug;
const FUN: fn() -> Self::Item = || ();
}
According to godbolt, this sneaked in with 1.34. 1.33 and lower are not affected.
Backtrace:
Compiling playground v0.0.1 (/playground)
error[E0658]: existential types are unstable (see issue #34511)
--> src/lib.rs:10:5
|
10 | existential type Item: Bug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `(): Bug` is not satisfied
--> src/lib.rs:10:5
|
10 | existential type Item: Bug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bug` is not implemented for `()`
|
= help: the following implementations were found:
<&() as Bug>
= note: the return type of a function must have a statically known size
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:345:21
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::continue_panic_fmt
at src/libstd/panicking.rs:385
7: rust_begin_unwind
at src/libstd/panicking.rs:312
8: core::panicking::panic_fmt
at src/libcore/panicking.rs:85
9: core::panicking::panic
at src/libcore/panicking.rs:49
10: rustc_typeck::check::writeback::WritebackCx::visit_opaque_types
11: rustc_typeck::check::writeback::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::resolve_type_vars_in_body
12: rustc::ty::context::GlobalCtxt::enter_local
13: rustc_typeck::check::typeck_tables_of
14: rustc::ty::query::__query_compute::typeck_tables_of
15: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::typeck_tables_of<'tcx>>::compute
16: rustc::dep_graph::graph::DepGraph::with_task_impl
17: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
18: rustc_typeck::collect::find_existential_constraints::ConstraintLocator::check
19: <rustc_typeck::collect::find_existential_constraints::ConstraintLocator<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_impl_item
20: rustc::hir::intravisit::walk_item
21: rustc_typeck::collect::find_existential_constraints
22: rustc_typeck::collect::type_of
23: rustc::ty::query::__query_compute::type_of
24: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::type_of<'tcx>>::compute
25: rustc::dep_graph::graph::DepGraph::with_task_impl
26: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
27: <rustc_typeck::collect::CollectItemTypesVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_impl_item
28: rustc::hir::map::Map::visit_item_likes_in_module
29: rustc_typeck::collect::collect_mod_item_types
30: rustc::ty::query::__query_compute::collect_mod_item_types
31: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::collect_mod_item_types<'tcx>>::compute
32: rustc::dep_graph::graph::DepGraph::with_task_impl
33: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
34: rustc_typeck::collect::collect_item_types
35: rustc::util::common::time
36: rustc_typeck::check_crate
37: <std::thread::local::LocalKey<T>>::with
38: rustc::ty::context::TyCtxt::create_and_enter
39: rustc_driver::driver::compile_input
40: rustc_driver::run_compiler_with_pool
41: <scoped_tls::ScopedKey<T>>::set
42: rustc_driver::run_compiler
43: syntax::with_globals
44: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:87
45: <F as alloc::boxed::FnBox<A>>::call_box
46: std::sys::unix::thread::Thread::new::thread_start
at /rustc/fc50f328b0353b285421b8ff5d4100966387a997/src/liballoc/boxed.rs:759
at src/libstd/sys_common/thread.rs:14
at src/libstd/sys/unix/thread.rs:81
47: start_thread
48: __clone
query stack during panic:
#0 [typeck_tables_of] processing `<&() as Bug>::FUN`
#1 [type_of] processing `<&() as Bug>::Item`
#2 [collect_mod_item_types] collecting item types in top-level module
end of query stack
error: aborting due to 2 previous errors
Some errors occurred: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.
error: internal compiler error: unexpected panic
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.34.1 (fc50f328b 2019-04-24) running on x86_64-unknown-linux-gnu
note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type lib
note: some of the compiler flags provided by cargo are hidden
error: Could not compile `playground`.
To learn more, run the command again with --verbose.