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

Async/Await rustc assertion panic #62087

Proximyst opened this issue Jun 23, 2019 · 3 comments

Async/Await rustc assertion panic #62087

Proximyst opened this issue Jun 23, 2019 · 3 comments
A-async-await Area: Async & Await 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.


Copy link

When trying to pass on my server functionality to the API instead of the binary, rustc panics with assertion failed: target_offset >= offset found in src/librustc_codegen_llvm/

I tried this code:

There is no small piece of code for this, sadly.
The source is here:

I expected to see this happen: flawless execution, or at least just a good ol' rustc error with a trillion futures generics

Instead, this happened: rustc panicked about LLVM code gen


$ rustc --version --verbose
rustc 1.37.0-nightly (0e4a56b4b 2019-06-13)
binary: rustc
commit-hash: 0e4a56b4b04ea98bb16caada30cb2418dd06e250
commit-date: 2019-06-13
host: x86_64-unknown-linux-gnu
release: 1.37.0-nightly
LLVM version: 8.0

$ RUST_BACKTRACE=full cargo run            
   Compiling moscovium v0.1.0 (/hdd1/Work/minecraft/moscovium)
warning: Hard linking files in the incremental compilation cache failed. Copying files instead. Consider moving the cache directory to a file system which supports hard linking in session dir `/hdd1/Work/minecraft/moscovium/target/debug/incremental/moscovium-15d9p06c5csz7/s-fdfx9m9gza-s7b2sh-working`

warning: unused import: `event::Cancellable as _`
 --> impl/
5 | use api::{event::Cancellable as _, prelude::*};
  |           ^^^^^^^^^^^^^^^^^^^^^^^
  = note: #[warn(unused_imports)] on by default

thread 'rustc' panicked at 'assertion failed: target_offset >= offset', src/librustc_codegen_llvm/
stack backtrace:
   0:     0x7f589a54918b - backtrace::backtrace::libunwind::trace::h41595b2657878dbc
                               at /cargo/registry/src/
   1:     0x7f589a54918b - backtrace::backtrace::trace_unsynchronized::h4efe511900bf5e12
                               at /cargo/registry/src/
   2:     0x7f589a54918b - std::sys_common::backtrace::_print::h7275b63687b21f98
                               at src/libstd/sys_common/
   3:     0x7f589a54918b - std::sys_common::backtrace::print::h790c12384440cac4
                               at src/libstd/sys_common/
   4:     0x7f589a54918b - std::panicking::default_hook::{{closure}}::he6cba1bdf748f1c3
                               at src/libstd/
   5:     0x7f589a548e8c - std::panicking::default_hook::h1296d9a476e7a9c2
                               at src/libstd/
   6:     0x7f589829b3f1 - rustc::util::common::panic_hook::ha2e96a0b919e5a1a
   7:     0x7f589a5499e9 - std::panicking::rust_panic_with_hook::h8d2408723e9a2bd4
                               at src/libstd/
   8:     0x7f58902f44b5 - std::panicking::begin_panic::h74637358fcbcf49a
   9:     0x7f589043919c - rustc_codegen_llvm::type_of::struct_llfields::h61dc16133d19abaa
  10:     0x7f5890418895 - <rustc_target::abi::TyLayout<&rustc::ty::TyS> as rustc_codegen_llvm::type_of::LayoutLlvmExt>::llvm_type::hd0eea50cae39777c
  11:     0x7f5890438dd9 - rustc_codegen_llvm::type_of::struct_llfields::h61dc16133d19abaa
  12:     0x7f5890418895 - <rustc_target::abi::TyLayout<&rustc::ty::TyS> as rustc_codegen_llvm::type_of::LayoutLlvmExt>::llvm_type::hd0eea50cae39777c
  13:     0x7f58902da58f - <rustc_target::abi::call::FnType<&rustc::ty::TyS> as rustc_codegen_llvm::abi::FnTypeLlvmExt>::llvm_type::h0d0aa59294abb94c
  14:     0x7f5890327a26 - rustc_codegen_llvm::declare::<impl rustc_codegen_ssa::traits::declare::DeclareMethods for rustc_codegen_llvm::context::CodegenCx>::declare_fn::hfd002e9de8564d19
  15:     0x7f589032807f - rustc_codegen_llvm::mono_item::<impl rustc_codegen_ssa::traits::declare::PreDefineMethods for rustc_codegen_llvm::context::CodegenCx>::predefine_fn::h158b31f162921281
  16:     0x7f589034e5d6 - <rustc::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::predefine::hf5e95d5c0693b901
  17:     0x7f58902dba8b - rustc_codegen_llvm::base::compile_codegen_unit::module_codegen::h3dfd41b76a21d604
  18:     0x7f589031a28c - rustc::dep_graph::graph::DepGraph::with_task::h9223b093287413d7
  19:     0x7f58902db8b2 - rustc_codegen_llvm::base::compile_codegen_unit::h84cbcc9f84ef685b
  20:     0x7f58904203d3 - rustc_codegen_ssa::base::codegen_crate::h74b58a2ac9b23913
  21:     0x7f589041cc8a - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate::h50e9412946ee1e63
  22:     0x7f5899f7bd67 - rustc::util::common::time::haa32cafeeb3d54cb
  23:     0x7f5899f2713b - rustc_interface::passes::start_codegen::hcdb1e9299570ccd1
  24:     0x7f5899f0e317 - rustc::ty::context::tls::enter_global::h5d834d2634f7fc92
  25:     0x7f5899f27941 - rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}::h10a967fa77f2b087
  26:     0x7f5899f83b05 - rustc_interface::passes::create_global_ctxt::{{closure}}::h7a059b6cf199597d
  27:     0x7f5899f26496 - rustc_interface::passes::BoxedGlobalCtxt::enter::h4a247e90412a9579
  28:     0x7f5899f10740 - rustc_interface::queries::Query<T>::compute::h595d6a8dccab9742
  29:     0x7f5899ffa7e4 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::ongoing_codegen::h93f94310b1d268e6
  30:     0x7f589a83d840 - rustc_interface::interface::run_compiler_in_existing_thread_pool::h35eddbfcfbbe0eb4
  31:     0x7f589a8af5f6 - std::thread::local::LocalKey<T>::with::hea85159711765771
  32:     0x7f589a847fb5 - scoped_tls::ScopedKey<T>::set::he08d6211f459724f
  33:     0x7f589a87aad4 - syntax::with_globals::h2c63be024f0c1f38
  34:     0x7f589a89989d - std::sys_common::backtrace::__rust_begin_short_backtrace::hfc7fb053a9ed90ec
  35:     0x7f589a55a8da - __rust_maybe_catch_panic
                               at src/libpanic_unwind/
  36:     0x7f589a8256d9 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h0cd7d8fc1b0a39a3
  37:     0x7f589a52ceef - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::he71721d2d956d451
                               at /rustc/0e4a56b4b04ea98bb16caada30cb2418dd06e250/src/liballoc/
  38:     0x7f589a5595b0 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::he520045b8d28ce5c
                               at /rustc/0e4a56b4b04ea98bb16caada30cb2418dd06e250/src/liballoc/
  39:     0x7f589a5595b0 - std::sys_common::thread::start_thread::h2e98d1272dc6d74b
                               at src/libstd/sys_common/
  40:     0x7f589a5595b0 - std::sys::unix::thread::Thread::new::thread_start::h18485805666ccd3c
                               at src/libstd/sys/unix/
  41:     0x7f589a49d57f - start_thread
  42:     0x7f589a3bcf13 - __clone
  43:                0x0 - <unknown>
query stack during panic:
end of query stack

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report:

note: rustc 1.37.0-nightly (0e4a56b4b 2019-06-13) 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 `moscovium`.

To learn more, run the command again with --verbose.
@jonas-schievink jonas-schievink added A-async-await Area: Async & Await 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. labels Jun 23, 2019
Copy link

I've narrowed down the issue to this:

            match &packet {
                Packet::HSBHandshake(ref _handshake) => {
                    // handle here when implemented
                Packet::HSBLegacyStatusPing(ref _ping) => {
// the line under here causes the ICE;
// I don't know why, but that's all I've gotten so far
// Leaving it out (commenting it away) gets rid of the issue
                _ => unreachable!(
                    "only a handshake or a legacy packet should
                be possible here. any other packet should have returned an
                error of ProtocolError::UnknownPacket."

Copy link

So I further narrowed down the issue till it wrapped back around in ServerboundLegacyStatus (src/network/protocol/packet/handshake/serverbound/legacy). Here it wraps around to the MoscoviumStream's write_packet.

This call, no matter the contents of write_packet, creates an ICE.

Call to write_packet:


Copy link

It seems as if this is a duplicate of #61793 and will be fixed by #62011.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
A-async-await Area: Async & Await 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.
None yet

No branches or pull requests

2 participants