Closed
Description
fn main() {
test();
}
fn test() -> impl TraitA {
test()
}
trait TraitA {}
Error message
error: internal compiler error: src\librustc_mir\util\elaborate_drops.rs:826: open drop from non-ADT `[type error]`
thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:925:9
Additionally, the compiler warns that the function cannot return.
Compiler version
binary: rustc
commit-hash: 0e8a4b441c5da21a2cb19448728ade5baa299c66
commit-date: 2019-10-16
host: x86_64-pc-windows-msvc
release: 1.40.0-nightly
LLVM version: 9.0
Backtrace
stack backtrace:
0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
1: core::fmt::write
2: <std::io::IoSliceMut as core::fmt::Debug>::fmt
3: std::panicking::take_hook
4: std::panicking::take_hook
5: rustc_driver::report_ice
6: std::panicking::rust_panic_with_hook
7: <rustc_errors::Level as core::fmt::Debug>::fmt
8: rustc_errors::HandlerInner::abort_if_errors_and_should_abort
9: rustc_errors::Handler::bug
10: rustc::util::bug::bug_fmt
11: rustc::ty::wf::object_region_bounds
12: rustc::ty::wf::object_region_bounds
13: rustc::ty::wf::object_region_bounds
14: rustc::util::bug::bug_fmt
15: rustc::util::bug::bug_fmt
16: rustc_mir::util::elaborate_drops::Unwind::is_cleanup
17: <rustc_mir::borrow_check::nll::constraints::graph::Reverse as rustc_mir::borrow_check::nll::constraints::graph::ConstraintGraphDirecton>::start_region
18: rustc::ty::print::pretty::<impl core::fmt::Display for rustc::ty::subst::GenericArg>::fmt
19: rustc::middle::weak_lang_items::<impl rustc::ty::context::TyCtxt>::is_weak_lang_item
20: rustc::dep_graph::graph::DepGraph::assert_ignored
21: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::try_print_query_stack
22: rustc::ty::<impl rustc::ty::context::TyCtxt>::instance_mir
23: rustc_mir::monomorphize::collector::collect_crate_mono_items
24: rustc_mir::monomorphize::collector::collect_crate_mono_items
25: <rustc_mir::interpret::snapshot::InterpSnapshot as core::cmp::PartialEq>::eq
26: <rustc_mir::interpret::intrinsics::type_name::AbsolutePathPrinter as core::fmt::Write>::write_str
27: rustc_mir::monomorphize::collector::collect_crate_mono_items
28: <rustc_mir::interpret::intrinsics::type_name::AbsolutePathPrinter as core::fmt::Write>::write_str
29: rustc_mir::monomorphize::partitioning::compute_codegen_unit_name
30: <rustc_codegen_llvm::ModuleLlvm as core::ops::drop::Drop>::drop
31: <rustc_codegen_llvm::back::lto::ThinBuffer as core::ops::drop::Drop>::drop
32: <rustc_codegen_llvm::debuginfo::metadata::MemberDescription as core::fmt::Debug>::fmt
33: <rustc_codegen_llvm::debuginfo::metadata::MemberDescription as core::fmt::Debug>::fmt
34: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
35: <rustc_interface::util::ReplaceBodyWithLoop as syntax::mut_visit::MutVisitor>::visit_mac
36: <env_logger::filter::inner::Filter as core::fmt::Debug>::fmt
37: rustc_interface::passes::BoxedResolver::complete
38: rustc_interface::interface::Compiler::output_file
39: rustc_interface::passes::BoxedResolver::to_expansion_result
40: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::ongoing_codegen
41: <syntax_pos::symbol::LocalInternedString as core::fmt::Display>::fmt
42: <rustc_driver::Compilation as core::fmt::Debug>::fmt
43: <syntax_pos::symbol::LocalInternedString as core::fmt::Display>::fmt
44: <syntax_pos::symbol::LocalInternedString as core::fmt::Display>::fmt
45: _rust_maybe_catch_panic
46: <syntax_pos::symbol::LocalInternedString as core::fmt::Display>::fmt
47: ZN244_$LT$std..error..$LT$impl$u20$core..convert..From$LT$alloc..string..String$GT$$u20$for$u20$alloc..boxed..Box$LT$dyn$u20$std..error..Error$u2b$core..marker..Send$u2b$core..marker..Sync$GT$$GT$..from..StringError$u20$as$u20$core..fmt..Display$GT$3fmt17
48: std::sys::windows::thread::Thread::new
49: BaseThreadInitThunk
50: RtlUserThreadStart
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Metadata
Metadata
Assignees
Labels
Area: Destructors (`Drop`, …)Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️High priorityRelevant 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.