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 "no errors encountered even though delay_span_bug issued" in nightly 2022-11-20 #105009

Closed
MilkFather opened this issue Nov 28, 2022 · 8 comments
Assignees
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) ❄️ P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@MilkFather
Copy link

MilkFather commented Nov 28, 2022

Code

Code is available at MilkFather/rustc-ice-221120.

Error output

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[590f]::ptr::drop_in_place), Some(hyper::proto::h1::dispatch::Server<hyper::service::util::ServiceFn<fn(http::request::Request<jsonrpsee::jsonrpsee_server::logger::Body>) -> impl std::future::Future<Output = std::result::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 std::future::Future<Output = std::result::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>>>`
  |
  = 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:1591:13
stack backtrace:
   0:        0x108d2d132 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h439ad59891a6d893
   1:        0x108d8bb8a - core::fmt::write::hc6febfea48992551
   2:        0x108d1f3ec - std::io::Write::write_fmt::h25befaf232726d5d
   3:        0x108d2cefa - std::sys_common::backtrace::print::he983e0dd711e6589
   4:        0x108d30226 - std::panicking::default_hook::{{closure}}::hbd746f32dacb7b9e
   5:        0x108d2ff77 - std::panicking::default_hook::h0bd2fa66d45f4333
   6:        0x1190db07d - rustc_driver[f66184a09ea1af9]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x108d30a0d - std::panicking::rust_panic_with_hook::hf33328f60da8c5e5
   8:        0x11dade5e7 - std[a80ca8a44b17762]::panicking::begin_panic::<rustc_errors[8d925088020ddfb8]::ExplicitBug>::{closure#0}
   9:        0x11dadc8a9 - std[a80ca8a44b17762]::sys_common::backtrace::__rust_end_short_backtrace::<std[a80ca8a44b17762]::panicking::begin_panic<rustc_errors[8d925088020ddfb8]::ExplicitBug>::{closure#0}, !>
  10:        0x11dee72e9 - std[a80ca8a44b17762]::panicking::begin_panic::<rustc_errors[8d925088020ddfb8]::ExplicitBug>
  11:        0x11dace3d9 - std[a80ca8a44b17762]::panic::panic_any::<rustc_errors[8d925088020ddfb8]::ExplicitBug>
  12:        0x11dad5285 - <rustc_errors[8d925088020ddfb8]::HandlerInner>::flush_delayed::<alloc[9e38621ce80a9baa]::vec::Vec<rustc_errors[8d925088020ddfb8]::diagnostic::Diagnostic>, &str>
  13:        0x11dad1069 - <rustc_errors[8d925088020ddfb8]::HandlerInner as core[590ff3257fc61341]::ops::drop::Drop>::drop
  14:        0x11905f58a - core[590ff3257fc61341]::ptr::drop_in_place::<rustc_session[ff40f0dc0b56536b]::parse::ParseSess>
  15:        0x119060cfb - core[590ff3257fc61341]::ptr::drop_in_place::<rustc_session[ff40f0dc0b56536b]::session::Session>
  16:        0x1190c78ae - core[590ff3257fc61341]::ptr::drop_in_place::<rustc_interface[f7516dff5d7731bd]::interface::Compiler>
  17:        0x1190b12f9 - rustc_span[6cad3b576cc36359]::with_source_map::<core[590ff3257fc61341]::result::Result<(), rustc_errors[8d925088020ddfb8]::ErrorGuaranteed>, rustc_interface[f7516dff5d7731bd]::interface::run_compiler<core[590ff3257fc61341]::result::Result<(), rustc_errors[8d925088020ddfb8]::ErrorGuaranteed>, rustc_driver[f66184a09ea1af9]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  18:        0x1190a86ec - <scoped_tls[1f60157cfa23d73b]::ScopedKey<rustc_span[6cad3b576cc36359]::SessionGlobals>>::set::<rustc_interface[f7516dff5d7731bd]::interface::run_compiler<core[590ff3257fc61341]::result::Result<(), rustc_errors[8d925088020ddfb8]::ErrorGuaranteed>, rustc_driver[f66184a09ea1af9]::run_compiler::{closure#1}>::{closure#0}, core[590ff3257fc61341]::result::Result<(), rustc_errors[8d925088020ddfb8]::ErrorGuaranteed>>
  19:        0x11907096a - std[a80ca8a44b17762]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f7516dff5d7731bd]::util::run_in_thread_pool_with_globals<rustc_interface[f7516dff5d7731bd]::interface::run_compiler<core[590ff3257fc61341]::result::Result<(), rustc_errors[8d925088020ddfb8]::ErrorGuaranteed>, rustc_driver[f66184a09ea1af9]::run_compiler::{closure#1}>::{closure#0}, core[590ff3257fc61341]::result::Result<(), rustc_errors[8d925088020ddfb8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[590ff3257fc61341]::result::Result<(), rustc_errors[8d925088020ddfb8]::ErrorGuaranteed>>
  20:        0x119052eab - <<std[a80ca8a44b17762]::thread::Builder>::spawn_unchecked_<rustc_interface[f7516dff5d7731bd]::util::run_in_thread_pool_with_globals<rustc_interface[f7516dff5d7731bd]::interface::run_compiler<core[590ff3257fc61341]::result::Result<(), rustc_errors[8d925088020ddfb8]::ErrorGuaranteed>, rustc_driver[f66184a09ea1af9]::run_compiler::{closure#1}>::{closure#0}, core[590ff3257fc61341]::result::Result<(), rustc_errors[8d925088020ddfb8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[590ff3257fc61341]::result::Result<(), rustc_errors[8d925088020ddfb8]::ErrorGuaranteed>>::{closure#1} as core[590ff3257fc61341]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  21:        0x108d39dc7 - std::sys::unix::thread::Thread::new::thread_start::h935368a05c7abfbe
  22:     0x7ff81df254e1 - __pthread_start

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 (c5d82ed7a 2022-11-19) running on x86_64-apple-darwin

note: compiler flags: --crate-type bin -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]

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

   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: std::panic::panic_any::<rustc_errors::ExplicitBug>
   2: <rustc_errors::HandlerInner>::flush_delayed::<alloc::vec::Vec<rustc_errors::diagnostic::Diagnostic>, &str>
   3: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
   4: core::ptr::drop_in_place::<rustc_session::parse::ParseSess>
   5: core::ptr::drop_in_place::<rustc_session::session::Session>
   6: core::ptr::drop_in_place::<rustc_interface::interface::Compiler>
   7: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
   8: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I ran a bisect before writing this issue, it says the regression came from nightly-2022-11-20, and everything worked fine in nightly-2022-11-19.

@MilkFather MilkFather added 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 Nov 28, 2022
danbev added a commit to danbev/opa-client that referenced this issue Nov 29, 2022
I look like there is a bug in rustc and this commit uses a version
before this bug was introduced.

Refs: rust-lang/rust#105009

Signed-off-by: Daniel Bevenius <daniel.bevenius@gmail.com>
@apiraino
Copy link
Contributor

apiraino commented Dec 7, 2022

A bisection comment in #103081 seems to point to 2f8d804 (#104411 cc @lcnr ).

Assigning P-critical, my understanding being that a number of production crates seems to tripping on this

@rustbot label P-critical

@rustbot rustbot added the P-critical Critical priority label Dec 7, 2022
@apiraino
Copy link
Contributor

apiraino commented Dec 7, 2022

Perhaps a small MVCE could be found at this comment (playground link)

@apiraino apiraino added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. I-prioritize Issue: Indicates that prioritization has been requested for this issue. and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Dec 7, 2022
@lcnr lcnr added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Dec 8, 2022
@lcnr
Copy link
Contributor

lcnr commented Dec 8, 2022

slightly minimized, would be good to get a self-contained testcase for this.

use proptest::{prelude::*, test_runner::TestError};
fn gen_all(_len: usize) -> impl Strategy<Value = ()> {
    Strategy::prop_map(0..=0, move |_| ())
}

fn foo(mut runner: proptest::test_runner::TestRunner) -> Result<(), TestError<()>> {
    runner
    .run(
        &::proptest::strategy::Strategy::prop_map(
            (1usize..=1).prop_flat_map(gen_all),
            |_| (),
        ),
     |()| Ok(()),
    )
}

pub fn main() {
    let x = foo as fn(_) -> _;
    println!("{x:p}");
}

@lcnr
Copy link
Contributor

lcnr commented Dec 8, 2022

@rustbot claim

@lcnr
Copy link
Contributor

lcnr commented Dec 8, 2022

This should be fixed by #105455, only tested #105009 (comment) though. Ended up getting a self-contained regression test myself which was a bit of a mess 😅 It's understandable why minimizing these issues was so difficult 😁

https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=919cade31c177475a4bd9ac7e9be2325

lcnr added a commit to lcnr/rust that referenced this issue Dec 8, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 9, 2022
…=jackh726

use the correct `Reveal` during validation

supersedes rust-lang#105454. Deals with rust-lang#105009 (comment), not closing rust-lang#105009 as the ICE may leak into beta

The issue was the following:
- we optimize the mir, using `Reveal::All`
- some optimization relies on the hidden type of an opaque type
- we then validate using `Reveal::UserFacing` again which is not able to observe the hidden type

r? `@jackh726`
@MilkFather
Copy link
Author

I confirm that the original ICE code I posted here now compiles since nightly-2022-10-09. That really helps.

RalfJung pushed a commit to RalfJung/miri that referenced this issue Dec 11, 2022
use the correct `Reveal` during validation

supersedes #105454. Deals with rust-lang/rust#105009 (comment), not closing #105009 as the ICE may leak into beta

The issue was the following:
- we optimize the mir, using `Reveal::All`
- some optimization relies on the hidden type of an opaque type
- we then validate using `Reveal::UserFacing` again which is not able to observe the hidden type

r? `@jackh726`
@teor2345
Copy link
Contributor

The unsized-vec and zebra failures from #105044 now compile with nightly-2022-12-10. (That's the only nightly version I checked.)

Thanks for this fix!

@lcnr
Copy link
Contributor

lcnr commented Dec 11, 2022

closing this issue as fixed in this case. Thank you for testing the fix ❤️

@lcnr lcnr closed this as completed Dec 11, 2022
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) ❄️ P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. 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

5 participants