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

error: internal compiler error: no errors encountered even though delay_span_bug issued #107440

Open
Kofituo opened this issue Jan 29, 2023 · 10 comments
Labels
C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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

@Kofituo
Copy link

Kofituo commented Jan 29, 2023

As I was compiling Substrate, I faced this error:

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in DropGlue(DefId(2:2801 ~ core[b4b4]::ptr::drop_in_place), Some(hyper::proto::h1::dispatch::Server<hyper::service::util::ServiceFn<fn(http::request::Request<jsonrpsee::jsonrpsee_server::logger::Body>) -> impl futures::Future<Output = sc_service::Result<http::response::Response<jsonrpsee::jsonrpsee_server::logger::Body>, std::convert::Infallible>> {jsonrpsee::jsonrpsee_server::transport::http::reject_connection::{closure#0}::reject}, jsonrpsee::jsonrpsee_server::logger::Body>, jsonrpsee::jsonrpsee_server::logger::Body>)) (after phase change to runtime-optimized) at bb0[0]:
                                Field projection `(*_1).field[0]` specified type `std::pin::Pin<std::boxed::Box<std::option::Option<std::future::from_generator::GenFuture<[static generator@jsonrpsee::jsonrpsee_server::transport::http::reject_connection::{closure#0}::reject::{closure#0}]>>>>`, but actual type is `std::pin::Pin<std::boxed::Box<std::option::Option<<hyper::service::util::ServiceFn<fn(http::request::Request<jsonrpsee::jsonrpsee_server::logger::Body>) -> impl futures::Future<Output = sc_service::Result<http::response::Response<jsonrpsee::jsonrpsee_server::logger::Body>, std::convert::Infallible>> {jsonrpsee::jsonrpsee_server::transport::http::reject_connection::{closure#0}::reject}, jsonrpsee::jsonrpsee_server::logger::Body> as hyper::service::http::HttpService<jsonrpsee::jsonrpsee_server::logger::Body>>::Future>>>`
   --> /Users/kofiotuo/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:490:1
    |
490 | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:88:36

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1594:13
stack backtrace:
   0:        0x100fd3c44 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5ceaa9f104581d16
   1:        0x101024ff0 - core::fmt::write::h70c33f48cfd4e8aa
   2:        0x100fc71f4 - std::io::Write::write_fmt::h24e387c05c0fa515
   3:        0x100fd3a58 - std::sys_common::backtrace::print::ha3dd569c0e03b1e6
   4:        0x100fd64ec - std::panicking::default_hook::{{closure}}::h85ce766fb3b3c496
   5:        0x100fd6244 - std::panicking::default_hook::h7c44756c2f138c7c
   6:        0x1090ce784 - rustc_driver[34fe2e47ceb1eef]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x100fd6be4 - std::panicking::rust_panic_with_hook::h243fdb33bd154152
   8:        0x10cffe950 - std[f91ad3a11560037b]::panicking::begin_panic::<rustc_errors[159eca52afa358bf]::ExplicitBug>::{closure#0}
   9:        0x10cffcfd8 - std[f91ad3a11560037b]::sys_common::backtrace::__rust_end_short_backtrace::<std[f91ad3a11560037b]::panicking::begin_panic<rustc_errors[159eca52afa358bf]::ExplicitBug>::{closure#0}, !>
  10:        0x10d3698ec - std[f91ad3a11560037b]::panicking::begin_panic::<rustc_errors[159eca52afa358bf]::ExplicitBug>
  11:        0x10cff0bec - std[f91ad3a11560037b]::panic::panic_any::<rustc_errors[159eca52afa358bf]::ExplicitBug>
  12:        0x10cff66d0 - <rustc_errors[159eca52afa358bf]::HandlerInner>::flush_delayed::<alloc[81ea9162d64fa727]::vec::Vec<rustc_errors[159eca52afa358bf]::diagnostic::Diagnostic>, &str>
  13:        0x10cff31bc - <rustc_errors[159eca52afa358bf]::HandlerInner as core[b4b423dc40156325]::ops::drop::Drop>::drop
  14:        0x10906201c - core[b4b423dc40156325]::ptr::drop_in_place::<rustc_session[ee64fa510201ce22]::parse::ParseSess>
  15:        0x109063400 - core[b4b423dc40156325]::ptr::drop_in_place::<rustc_session[ee64fa510201ce22]::session::Session>
  16:        0x1090be188 - core[b4b423dc40156325]::ptr::drop_in_place::<rustc_interface[d6308f9366e490e8]::interface::Compiler>
  17:        0x1090aa118 - rustc_span[668ea99b1ecd1622]::with_source_map::<core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>, rustc_interface[d6308f9366e490e8]::interface::run_compiler<core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>, rustc_driver[34fe2e47ceb1eef]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  18:        0x1090a1f8c - <scoped_tls[44143ff9a1fdbbff]::ScopedKey<rustc_span[668ea99b1ecd1622]::SessionGlobals>>::set::<rustc_interface[d6308f9366e490e8]::interface::run_compiler<core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>, rustc_driver[34fe2e47ceb1eef]::run_compiler::{closure#1}>::{closure#0}, core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>>
  19:        0x109070f74 - std[f91ad3a11560037b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d6308f9366e490e8]::util::run_in_thread_pool_with_globals<rustc_interface[d6308f9366e490e8]::interface::run_compiler<core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>, rustc_driver[34fe2e47ceb1eef]::run_compiler::{closure#1}>::{closure#0}, core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>>
  20:        0x109056d40 - <<std[f91ad3a11560037b]::thread::Builder>::spawn_unchecked_<rustc_interface[d6308f9366e490e8]::util::run_in_thread_pool_with_globals<rustc_interface[d6308f9366e490e8]::interface::run_compiler<core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>, rustc_driver[34fe2e47ceb1eef]::run_compiler::{closure#1}>::{closure#0}, core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b4b423dc40156325]::result::Result<(), rustc_errors[159eca52afa358bf]::ErrorGuaranteed>>::{closure#1} as core[b4b423dc40156325]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  21:        0x100fdee60 - std::sys::unix::thread::Thread::new::thread_start::h94b0d6958f791f7f
  22:        0x1ab33206c - __pthread_deallocate

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.67.0-nightly (70f8737b2 2022-11-23) running on aarch64-apple-darwin

note: compiler flags: --crate-type bin -C opt-level=3 -C embed-bitcode=no

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `node-template`
@Noratrieb Noratrieb 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. labels Jan 29, 2023
@compiler-errors
Copy link
Member

Do you have some code to reproduce this ICE?

@bruceg
Copy link

bruceg commented Jan 31, 2023

I think I've hit the same bug compiling Vector with 1.67.0 stable. The logs are here. The branch is bruceg/update-rust-1-67, but that's a long way away from a minimum reproducer.

@jszwedko
Copy link

jszwedko commented Feb 3, 2023

I think I've hit the same bug compiling Vector with 1.67.0 stable. The logs are here. The branch is bruceg/update-rust-1-67, but that's a long way away from a minimum reproducer.

To add onto this, it looks like just compiling one of the smaller subcrates triggers it so would help narrow it down. On that branch you can build just lib/vector-buffers to trigger it. It only triggers when building with --release.

@jszwedko
Copy link

jszwedko commented Feb 3, 2023

I ran cargo-bisect and it seems to point to 2f8d804 as the commit that introduces the ICE.

@langston-barrett
Copy link

langston-barrett commented Mar 18, 2023

The bruceg/update-rust-1-67 branch doesn't seem to be available any longer, and I couldn't reproduce on HEAD with nightly.

@rustbot label +E-needs-mcve

@rustbot rustbot added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Mar 18, 2023
@jszwedko
Copy link

At least for vectordotdev/vector I can confirm that cargo 1.70.0-nightly (4a3c588b1 2023-03-14) builds without issue. Thanks for the prompt @langston-barrett !

@aureumleonis
Copy link

I seem to be seeing this as well

rustc 1.71.0 (8ede3aae2 2023-07-12) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=0 -C incremental=[REDACTED]

Unfortunately this is a huge project and the issue only appeared when I started making changes.

@nooberfsh
Copy link
Contributor

I encounter this bug as well

rustc 1.73.0 (cc66ad468 2023-10-03)

I have workaround this problem by cargo clean.

@CGQAQ
Copy link

CGQAQ commented Dec 1, 2023

I also encounter this bug

Stacktrace

error: internal compiler error: no errors encountered even though `delay_span_bug` issued
error: internal compiler error: broken MIR in Item(DefId(0:7908 ~ tantivy[b60e]::store::reader::{impl#3}::iter_raw::{closure#2})) (after phase change to runtime-optimized) at bb2[6]:
                                Alias(Opaque, AliasTy { args: [ReErased], def_id: DefId(0:18076 ~ tantivy[b60e]::store::reader::{impl#3}::block_checkpoints::{opaque#0}) }) does not have fields
 --> /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/iter/adapters/flatten.rs:52:9
  |
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:94:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
         3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
         4: rustc_mir_transform::pass_manager::run_passes
         5: rustc_mir_transform::optimized_mir
         6: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
         7: <rustc_query_impl::query_impl::optimized_mir::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once
         8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
         9: rustc_query_impl::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
        10: <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root
        11: rustc_metadata::rmeta::encoder::encode_metadata_impl
        12: rustc_data_structures::sync::parallel::disabled::join::<rustc_metadata::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}, (), ()>
        13: rustc_metadata::rmeta::encoder::encode_metadata
        14: rustc_metadata::fs::encode_and_write_metadata
        15: rustc_interface::passes::start_codegen
        16: <rustc_middle::ty::context::GlobalCtxt>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_span::ErrorGuaranteed>>
        17: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
        18: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        19: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2007:9
        21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2007:9
        22: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys/unix/thread.rs:108:17
        23: <unknown>
        24: <unknown>
 --> /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/iter/adapters/flatten.rs:52:9
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.74.0 (79e9716c9 2023-11-13) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: could not compile `tantivy` (lib)
warning: build failed, waiting for other jobs to finish...
Warning: run-commands command "cargo build --release" exited with non-zero status code

 

 >  NX   Running target build for project local_server failed

   Failed tasks:
   
   - local_server:build
   
   Hint: run the command with --verbose for more details.

Error: Process completed with exit code 1.

@szymek156
Copy link

I also encountered it.
Repo to reproduce is plotters - wasm demo

https://github.com/plotters-rs/plotters-wasm-demo

For someone not familiar with wasm, in order to compile it you need a wasm-pack:
https://github.com/plotters-rs/plotters-wasm-demo#developing-with-npm

Rust version:

note: rustc 1.74.0 (79e9716c9 2023-11-13) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type cdylib -C opt-level=3 -C lto

It goes fine, when compiling with previous version:

RUSTUP_TOOLCHAIN=1.73.0 wasm-pack build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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