Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE unexpected type in type_metadata: impl core::future::future::Future #58888

Closed
PvdBerg1998 opened this issue Mar 3, 2019 · 17 comments
Closed
Labels
A-async-await Area: Async & Await AsyncAwait-Polish Async-await issues that are part of the "polish" area C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@PvdBerg1998
Copy link

PvdBerg1998 commented Mar 3, 2019

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
@PvdBerg1998
Copy link
Author

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

@jonas-schievink
Copy link
Contributor

Can you post the source code, or an example that reproduces this? Is this also happening on older nightlies or did this recently appear?

@jonas-schievink jonas-schievink added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. A-async-await Area: Async & Await labels Mar 3, 2019
@PvdBerg1998
Copy link
Author

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.

@jonas-schievink
Copy link
Contributor

The stacktrace also mentions WASM, are you targeting that, and does it happen with other targets too?

@PvdBerg1998
Copy link
Author

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

@PvdBerg1998
Copy link
Author

It seems this only panics when the functions are implemented as methods, so when you remove the structure it does compile.

@jonas-schievink
Copy link
Contributor

jonas-schievink commented Mar 3, 2019

Great, thanks!

(we don't seem to track nightly-to-nightly regressions anymore)

@jonas-schievink jonas-schievink added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Mar 3, 2019
@PvdBerg1998
Copy link
Author

PvdBerg1998 commented Mar 3, 2019

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

@dvc94ch
Copy link
Contributor

dvc94ch commented Mar 3, 2019

Same problem on linux...

@Nemo157
Copy link
Member

Nemo157 commented Mar 3, 2019

There’s a good chance it’s related to #58077, I’ll try to take a look into it.

@Nemo157
Copy link
Member

Nemo157 commented Mar 3, 2019

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

@Nemo157
Copy link
Member

Nemo157 commented Mar 3, 2019

I have a fix, just need to find some wifi to open the PR.

@scampi
Copy link
Contributor

scampi commented Mar 4, 2019

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

@nikomatsakis
Copy link
Contributor

Marking as blocking for stabilization; @Nemo157 has a fix in #58906

@oysterpack
Copy link

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 (88f755f 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

> rustc +nightly --version --verbose

rustc 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

@Nemo157
Copy link
Member

Nemo157 commented Mar 8, 2019

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’t know the exact invocation for that).

@oysterpack
Copy link

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

pietroalbini added a commit to pietroalbini/rust that referenced this issue Mar 8, 2019
… r=Zoxc

Monomorphize generator field types for debuginfo

Fixes rust-lang#58888

r? @Zoxc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await Area: Async & Await AsyncAwait-Polish Async-await issues that are part of the "polish" area C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants