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

no errors encountered even though delay_span_bug issued #100219

Closed
drewcrawford opened this issue Aug 7, 2022 · 6 comments
Closed

no errors encountered even though delay_span_bug issued #100219

drewcrawford opened this issue Aug 7, 2022 · 6 comments
Labels
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

@drewcrawford
Copy link
Contributor

Code

pub trait B {
    type OFuture: Future<Output=O>;
    fn o(&self) -> Self::OFuture;
}
pub trait A {
    type Body: A;
    type BuiltinType:  B;
    fn b(&self) -> Option<&Self::BuiltinType>;
    fn a(&self) -> &Self::Body;
}
use core::future::Future;
pub struct O;

pub fn size<'s,V: A>(view: &'s V) -> impl Future<Output=O> + 's {
    if let Some(builtin) = view.b() {
        builtin.o()
    }
    else {
        size(view.a())
    }
}

Meta

rustc --version --verbose:

rustc 1.62.1 (e092d0b6b 2022-07-16)
binary: rustc
commit-hash: e092d0b6b43f2de967af0887873151bb1c0b18d3
commit-date: 2022-07-16
host: aarch64-apple-darwin
release: 1.62.1
LLVM version: 14.0.5

Error output

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

error: internal compiler error: broken MIR in DefId(0:16 ~ playground[e5a9]::size) (Terminator { source_info: SourceInfo { span: src/lib.rs:19:9: 19:23 (#0), scope: scope[0] }, kind: _0 = size::<<V as A>::Body>(move _7) -> [return: bb7, unwind: bb9] }): call dest mismatch (impl std::future::Future<Output = O> <- impl std::future::Future<Output = O>): NoSolution
  --> src/lib.rs:19:21
   |
19 |         size(view.a())
   |                     ^
   |
   = note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:1543:21

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1369:13
stack backtrace:
   0:     0x7f2addab5fbd - std::backtrace_rs::backtrace::libunwind::trace::h8e036432725b1c57
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f2addab5fbd - std::backtrace_rs::backtrace::trace_unsynchronized::h4f83092254c85869
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f2addab5fbd - std::sys_common::backtrace::_print_fmt::h9728b5e056a3ece3
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f2addab5fbd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h48bb4bd2928827d2
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f2addb11c4c - core::fmt::write::h909e69a2c24f44cc
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/fmt/mod.rs:1196:17
   5:     0x7f2addaa7731 - std::io::Write::write_fmt::h7f4b8ab8af89e9ef
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/io/mod.rs:1654:15
   6:     0x7f2addab8cd5 - std::sys_common::backtrace::_print::hff4838ebf14a2171
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f2addab8cd5 - std::sys_common::backtrace::print::h2499280374189ad9
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f2addab8cd5 - std::panicking::default_hook::{{closure}}::h8b270fc55eeb284e
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:295:22
   9:     0x7f2addab8949 - std::panicking::default_hook::h3217e229d6e9d13c
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:314:9
  10:     0x7f2ade27d571 - rustc_driver[b4654d3c4d4292dd]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f2addab94a6 - std::panicking::rust_panic_with_hook::h9acb8048b738d2e0
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:702:17
  12:     0x7f2adf3ef3e1 - std[8996aeeb2a45fe64]::panicking::begin_panic::<rustc_errors[4633ef6e4608f9c1]::ExplicitBug>::{closure#0}
  13:     0x7f2adf3ef346 - std[8996aeeb2a45fe64]::sys_common::backtrace::__rust_end_short_backtrace::<std[8996aeeb2a45fe64]::panicking::begin_panic<rustc_errors[4633ef6e4608f9c1]::ExplicitBug>::{closure#0}, !>
  14:     0x7f2adf3f2496 - std[8996aeeb2a45fe64]::panicking::begin_panic::<rustc_errors[4633ef6e4608f9c1]::ExplicitBug>
  15:     0x7f2adf3f67f6 - std[8996aeeb2a45fe64]::panic::panic_any::<rustc_errors[4633ef6e4608f9c1]::ExplicitBug>
  16:     0x7f2ae0bb00d1 - <rustc_errors[4633ef6e4608f9c1]::HandlerInner as core[dbea6f494faa966e]::ops::drop::Drop>::drop
  17:     0x7f2ae0310318 - core[dbea6f494faa966e]::ptr::drop_in_place::<rustc_session[a2f3190f51a45935]::parse::ParseSess>
  18:     0x7f2ae0312d53 - <alloc[9c8de9aaaf44fea]::rc::Rc<rustc_session[a2f3190f51a45935]::session::Session> as core[dbea6f494faa966e]::ops::drop::Drop>::drop
  19:     0x7f2ae030fb0d - core[dbea6f494faa966e]::ptr::drop_in_place::<rustc_interface[9f664daa3237129]::interface::Compiler>
  20:     0x7f2ae030f274 - rustc_span[1d0b4d44d1f53955]::with_source_map::<core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>, rustc_interface[9f664daa3237129]::interface::create_compiler_and_run<core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>, rustc_driver[b4654d3c4d4292dd]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x7f2ae02e7374 - rustc_interface[9f664daa3237129]::interface::create_compiler_and_run::<core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>, rustc_driver[b4654d3c4d4292dd]::run_compiler::{closure#1}>
  22:     0x7f2ae02e4c12 - <scoped_tls[ab1554bfb6e7ab15]::ScopedKey<rustc_span[1d0b4d44d1f53955]::SessionGlobals>>::set::<rustc_interface[9f664daa3237129]::interface::run_compiler<core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>, rustc_driver[b4654d3c4d4292dd]::run_compiler::{closure#1}>::{closure#0}, core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>>
  23:     0x7f2ae02fbdff - std[8996aeeb2a45fe64]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[9f664daa3237129]::util::run_in_thread_pool_with_globals<rustc_interface[9f664daa3237129]::interface::run_compiler<core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>, rustc_driver[b4654d3c4d4292dd]::run_compiler::{closure#1}>::{closure#0}, core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>>::{closure#0}, core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>>
  24:     0x7f2ae02fbf39 - <<std[8996aeeb2a45fe64]::thread::Builder>::spawn_unchecked_<rustc_interface[9f664daa3237129]::util::run_in_thread_pool_with_globals<rustc_interface[9f664daa3237129]::interface::run_compiler<core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>, rustc_driver[b4654d3c4d4292dd]::run_compiler::{closure#1}>::{closure#0}, core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>>::{closure#0}, core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>>::{closure#1} as core[dbea6f494faa966e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7f2addac33c3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h191d5c5ea3edb31d
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/alloc/src/boxed.rs:1872:9
  26:     0x7f2addac33c3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h42ef7cb2ae640a31
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/alloc/src/boxed.rs:1872:9
  27:     0x7f2addac33c3 - std::sys::unix::thread::Thread::new::thread_start::he47f7169665dab60
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys/unix/thread.rs:108:17
  28:     0x7f2add9f3609 - start_thread
  29:     0x7f2add90c133 - clone
  30:                0x0 - <unknown>

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

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

note: rustc 1.62.1 (e092d0b6b 2022-07-16) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

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

query stack during panic:
end of query stack
error: could not compile `playground`
Backtrace

<backtrace>

@drewcrawford drewcrawford 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 Aug 7, 2022
@compiler-errors
Copy link
Member

compiler-errors commented Aug 7, 2022

This no longer ICEs after #100092, but instead emits an error:

error: type parameter `V` is part of concrete type but not used in parameter list for the `impl Trait` type alias
  --> FILE:19:9
   |
19 |         size(view.a())
   |         ^^^^^^^^^^^^^^

The "root cause" bug in the provided code is due to the recursive call to size I think.

@compiler-errors
Copy link
Member

Closing since this no longer ICEs on nightly.

@astoycos
Copy link

Just saw this or something very similar with version: rustc 1.65.0-nightly (cf9ed0dd5 2022-09-15) running on x86_64-unknown-linux-gnu

See https:/redhat-et/bpfd/actions/runs/3069412722/jobs/4958034146#step:11:106

@Jake-Shadle
Copy link

We are experiencing the same failure as @astoycos within tower.

@juanky201271
Copy link

Me too, since yesterday I can't build my rust library with the nightly version, some idea....?

@compiler-errors
Copy link
Member

@Jake-Shadle @juanky201271 Please file separate bugs for this, "Broken MIR" type errors are a wide class and this is probably due to a different root cause.

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. 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

5 participants