Latest nightly (x86_64-pc-windows-msvc) panics when I run cargo test on my codebase using async await.
error: internal compiler error: src\librustc_codegen_llvm\debuginfo\metadata.rs:661: debuginfo: unexpected type in type_metadata: impl core::future::future::Future
thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:620:9
stack backtrace:
0: std::sys_common::alloc::realloc_fallback
1: std::panicking::take_hook
2: std::panicking::take_hook
3: <rustc::ty::sty::Binder<rustc::ty::ProjectionPredicate<'tcx>> as rustc::ty::ToPredicate<'tcx>>::to_predicate
4: std::panicking::rust_panic_with_hook
5: <rustc_errors::emitter::ColorConfig as core::fmt::Debug>::fmt
6: rustc_errors::Handler::bug
7: rustc::util::bug::bug_fmt
8: rustc::ty::context::<impl rustc::infer::canonical::Canonical<'gcx, rustc::ty::context::UserType<'gcx>>>::is_identity
9: rustc::ty::context::<impl rustc::infer::canonical::Canonical<'gcx, rustc::ty::context::UserType<'gcx>>>::is_identity
10: rustc::ty::context::<impl rustc::infer::canonical::Canonical<'gcx, rustc::ty::context::UserType<'gcx>>>::is_identity
11: rustc::util::bug::bug_fmt
12: rustc::util::bug::bug_fmt
13: <rustc_codegen_llvm::back::wasm::WasmSections<'a> as core::iter::traits::iterator::Iterator>::next
14: rustc_codegen_llvm::debuginfo::<impl rustc_codegen_ssa::traits::debuginfo::DebugInfoBuilderMethods<'tcx> for rustc_codegen_llvm::builder::Builder<'a, 'll, 'tcx>>::declare_local
15: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::join_codegen_and_link
16: <rustc_codegen_llvm::llvm_::ffi::debuginfo::DISPFlags as core::fmt::Debug>::fmt
17: <unknown>
18: rustc_codegen_llvm::llvm_::diagnostic::Diagnostic::unpack
19: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::join_codegen_and_link
20: <rustc_codegen_llvm::base::ValueIter<'ll> as core::iter::traits::iterator::Iterator>::next
21: <rustc_codegen_llvm::llvm_::ffi::PassKind as core::fmt::Debug>::fmt
22: <rustc_codegen_llvm::base::ValueIter<'ll> as core::iter::traits::iterator::Iterator>::next
23: rustc_codegen_llvm::llvm_::diagnostic::Diagnostic::unpack
24: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
25: <env_logger::fmt::WriteStyle as core::default::Default>::default
26: rustc_driver::driver::phase_4_codegen
27: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
28: <env_logger::Logger as log::Log>::flush
29: rustc_driver::driver::compile_input
30: rustc_driver::run_compiler
31: <env_logger::Logger as log::Log>::flush
32: rustc_driver::run_compiler
33: <env_logger::Logger as log::Log>::flush
34: <rustc_driver::CompilationFailure as core::fmt::Debug>::fmt
35: _rust_maybe_catch_panic
36: <env_logger::Logger as log::Log>::flush
37: std::sys::windows::thread::Thread::new
38: BaseThreadInitThunk
39: RtlUserThreadStart
query stack during panic:
end of query stack
Can you post the source code, or an example that reproduces this? Is this also happening on older nightlies or did this recently appear?
Only the last nightly. I have no idea what code is causing this. It does not occur when I run cargo check, only cargo run or cargo test, that may be useful to know.
The stacktrace also mentions WASM, are you targeting that, and does it happen with other targets too?
I'm not targeting WASM. I played a bit with how much of my code I can remove until it starts compiling again. This is causing the same error: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=b1e77a15da5f42edcd4031dd6af8939f
It seems this only panics when the functions are implemented as methods, so when you remove the structure it does compile.
Great, thanks!
(we don't seem to track nightly-to-nightly regressions anymore)
The stacktrace in the minimal example is different:
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:71
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:59
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_codegen_llvm::debuginfo::metadata::type_metadata
15: rustc_codegen_llvm::debuginfo::<impl rustc_codegen_ssa::traits::debuginfo::DebugInfoBuilderMethods<'tcx> for rustc_codegen_llvm::builder::Builder<'a, 'll, 'tcx>>::declare_local
16: core::iter::traits::iterator::Iterator::fold::{{closure}}
17: <core::iter::adapters::Map<I, F> as core::iter::traits::iterator::Iterator>::fold
18: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
19: rustc_codegen_ssa::mir::codegen_mir
20: rustc_codegen_ssa::base::codegen_instance
21: rustc_codegen_ssa::mono_item::MonoItemExt::define
22: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
23: rustc::dep_graph::graph::DepGraph::with_task
24: rustc_codegen_llvm::base::compile_codegen_unit
25: rustc_codegen_ssa::base::codegen_crate
26: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
27: rustc::util::common::time
28: rustc_driver::driver::phase_4_codegen
29: <std::thread::local::LocalKey<T>>::with
30: rustc::ty::context::TyCtxt::create_and_enter
31: rustc_driver::driver::compile_input
32: <scoped_tls::ScopedKey<T>>::set
33: rustc_driver::run_compiler
34: <scoped_tls::ScopedKey<T>>::set
35: syntax::with_globals
36: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:87
37: <F as alloc::boxed::FnBox<A>>::call_box
38: std::sys::unix::thread::Thread::new::thread_start
at /rustc/0ea22717a1e01fa535534b85a5347a7e49fc79de/src/liballoc/boxed.rs:759
at src/libstd/sys_common/thread.rs:14
at src/libstd/sys/unix/thread.rs:80
39: start_thread
40: __clone
Same problem on linux...
There鈥檚 a good chance it鈥檚 related to https://github.com/rust-lang/rust/pull/58077, I鈥檒l try to take a look into it.
Reproducer with generators directly.
Compiling playground v0.0.1 (/playground)
error: internal compiler error: src/librustc_codegen_llvm/debuginfo/metadata.rs:661: debuginfo: unexpected type in type_metadata: impl std::iter::Iterator
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:620:9
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:71
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:59
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_codegen_llvm::debuginfo::metadata::type_metadata
15: rustc_codegen_llvm::debuginfo::<impl rustc_codegen_ssa::traits::debuginfo::DebugInfoBuilderMethods<'tcx> for rustc_codegen_llvm::builder::Builder<'a, 'll, 'tcx>>::declare_local
16: core::iter::traits::iterator::Iterator::fold::{{closure}}
17: <core::iter::adapters::Map<I, F> as core::iter::traits::iterator::Iterator>::fold
18: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
19: rustc_codegen_ssa::mir::codegen_mir
20: rustc_codegen_ssa::base::codegen_instance
21: rustc_codegen_ssa::mono_item::MonoItemExt::define
22: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
23: rustc::dep_graph::graph::DepGraph::with_task
24: rustc_codegen_llvm::base::compile_codegen_unit
25: rustc_codegen_ssa::base::codegen_crate
26: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
27: rustc::util::common::time
28: rustc_driver::driver::phase_4_codegen
29: <std::thread::local::LocalKey<T>>::with
30: rustc::ty::context::TyCtxt::create_and_enter
31: rustc_driver::driver::compile_input
32: <scoped_tls::ScopedKey<T>>::set
33: rustc_driver::run_compiler
34: <scoped_tls::ScopedKey<T>>::set
35: syntax::with_globals
36: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:87
37: <F as alloc::boxed::FnBox<A>>::call_box
38: std::sys::unix::thread::Thread::new::thread_start
at /rustc/0ea22717a1e01fa535534b85a5347a7e49fc79de/src/liballoc/boxed.rs:759
at src/libstd/sys_common/thread.rs:14
at src/libstd/sys/unix/thread.rs:80
39: start_thread
40: __clone
query stack during panic:
end of query stack
error: aborting due to previous error
I have a fix, just need to find some wifi to open the PR.
For tracking purpose, looks like futures-rs is also failing with this error:
error: internal compiler error: src/librustc_codegen_llvm/debuginfo/metadata.rs:661: debuginfo: unexpected type in type_metadata: impl core::future::future::Future
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:620:9
Marking as blocking for stabilization; @Nemo157 has a fix in #58906
I just ran into the same exact issue:
error: internal compiler error: src/librustc_codegen_llvm/debuginfo/metadata.rs:661: debuginfo: unexpected type in type_metadata: impl core::future::future::Future
note: rustc 1.35.0-nightly (88f755f8a 2019-03-07) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:620:9
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:71
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:59
at src/libstd/panicking.rs:197
3: std::panicking::default_hook
at src/libstd/panicking.rs:211
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:478
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_codegen_llvm::debuginfo::metadata::type_metadata
15: rustc_codegen_llvm::debuginfo::<impl rustc_codegen_ssa::traits::debuginfo::DebugInfoBuilderMethods<'tcx> for rustc_codegen_llvm::builder::Builder<'a, 'll, 'tcx>>::declare_local
16: core::iter::traits::iterator::Iterator::fold::{{closure}}
17: <core::iter::adapters::Map<I, F> as core::iter::traits::iterator::Iterator>::fold
18: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
19: rustc_codegen_ssa::mir::codegen_mir
20: rustc_codegen_ssa::base::codegen_instance
21: rustc_codegen_ssa::mono_item::MonoItemExt::define
22: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
23: rustc::dep_graph::graph::DepGraph::with_task
24: rustc_codegen_llvm::base::compile_codegen_unit
25: rustc_codegen_ssa::base::codegen_crate
26: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
27: rustc::util::common::time
28: rustc_driver::driver::phase_4_codegen
29: <std::thread::local::LocalKey<T>>::with
30: rustc::ty::context::TyCtxt::create_and_enter
31: rustc_driver::driver::compile_input
32: rustc_driver::run_compiler_with_pool
33: <scoped_tls::ScopedKey<T>>::set
34: rustc_driver::run_compiler
35: syntax::with_globals
36: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:87
37: <F as alloc::boxed::FnBox<A>>::call_box
38: std::sys::unix::thread::Thread::new::thread_start
at /rustc/88f755f8a84df1d9e6b17cf10c96ae8b93481b2e/src/liballoc/boxed.rs:759
at src/libstd/sys_common/thread.rs:14
at src/libstd/sys/unix/thread.rs:80
39: start_thread
40: __clone
query stack during panic:
end of query stack
error: aborting due to previous error
cargo +nightly c and cargo +nightly bench, but fails with the above error via cargo +nightly testrustc 1.35.0-nightly (88f755f8a 2019-03-07)
binary: rustc
commit-hash: 88f755f8a84df1d9e6b17cf10c96ae8b93481b2e
commit-date: 2019-03-07
host: x86_64-unknown-linux-gnu
release: 1.35.0-nightly
LLVM version: 8.0
As a workaround until the tree is reopened and the fix is merged you can use --release to disable debuginfo (or change the dev profile to not have debuginfo in the Cargo.toml, but I don鈥檛 know the exact invocation for that).
Thanks!!! That's an excellent suggestion as a temporary work around - and works like charm.
It's as simple as configuring the dev and test profiles in cargo.toml
[profile.test]
debug = false
[profile.dev]
debug = false
https://doc.rust-lang.org/cargo/reference/manifest.html#the-profile-sections
Most helpful comment
I have a fix, just need to find some wifi to open the PR.