Skip to content

ICE: broken mir with -Zinline-mir issue-50865-private-impl-trait/auxiliary/lib.rs #78442

Closed

Description

Previously: #77668
Now:

Code

// revisions: default miropt
//[miropt]compile-flags: -Z inline-mir
// ~^ This flag is for #77668, it used to be ICE.

#![crate_type = "lib"]

pub fn bar<P>( // Error won't happen if "bar" is not generic
    _baz: P,
) {
    hide_foo()();
}

fn hide_foo() -> impl Fn() { // Error won't happen if "iterate" hasn't impl Trait or has generics
    foo
}

fn foo() { // Error won't happen if "foo" isn't used in "iterate" or has generics
}

Meta

rustc --version --verbose:

rustc 1.49.0-nightly (20b1e05a8 2020-10-27)
binary: rustc
commit-hash: 20b1e05a8d0e1773dc840a3286aa37916e87d84b
commit-date: 2020-10-27
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly

Error output

RUST_BACKTRACE=full /home/matthias/.rustup/toolchains/master/bin/rustc ./src/test/ui/issues/issue-50865-private-impl-trait/auxiliary/lib.rs -Zmir-opt-level=2

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ lib[8787]::bar), const_param_did: None }) (end of phase Optimization) at bb1[1]:
encountered non-callable type impl Fn<()> in `Call` terminator
  --> /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/ops/function.rs:70:5
   |
70 |     extern "rust-call" fn call(&self, args: Args) -> Self::Output;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: delayed at compiler/rustc_mir/src/transform/validate.rs:160:36

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:961:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

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.49.0-nightly (20b1e05a8 2020-10-27) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=2

query stack during panic:
end of query stack
Backtrace

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ lib[8787]::bar), const_param_did: None }) (end of phase Optimization) at bb1[1]:
encountered non-callable type impl Fn<()> in `Call` terminator
  --> /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/ops/function.rs:70:5
   |
70 |     extern "rust-call" fn call(&self, args: Args) -> Self::Output;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: delayed at compiler/rustc_mir/src/transform/validate.rs:160:36

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:961:13
stack backtrace:
   0:     0x7f33170bab70 - std::backtrace_rs::backtrace::libunwind::trace::h448c56741b6011d3
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:100:5
   1:     0x7f33170bab70 - std::backtrace_rs::backtrace::trace_unsynchronized::h881b9d30a8a89a0c
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f33170bab70 - std::sys_common::backtrace::_print_fmt::h720a2f61f75b9f58
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f33170bab70 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8d62bbfda6d5c836
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f331712aaac - core::fmt::write::h1857a60b204f1b6a
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/core/src/fmt/mod.rs:1076:17
   5:     0x7f33170ac7d2 - std::io::Write::write_fmt::h16a9fe7680ac245c
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/io/mod.rs:1516:15
   6:     0x7f33170bfb25 - std::sys_common::backtrace::_print::h9ba51a6db618de7d
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f33170bfb25 - std::sys_common::backtrace::print::h5f20e41c85e91716
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f33170bfb25 - std::panicking::default_hook::{{closure}}::h8d48653392f3b04c
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/panicking.rs:208:50
   9:     0x7f33170bf7c8 - std::panicking::default_hook::hb3948d1f74b6ff4c
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/panicking.rs:227:9
  10:     0x7f3317987818 - rustc_driver::report_ice::h1ddbc5609a6e1f37
  11:     0x7f33170c0426 - std::panicking::rust_panic_with_hook::h55d23fef0ad751bc
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/panicking.rs:597:17
  12:     0x7f33170bff47 - std::panicking::begin_panic_handler::{{closure}}::h56ae74c6dea6e141
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/panicking.rs:499:13
  13:     0x7f33170bb00c - std::sys_common::backtrace::__rust_end_short_backtrace::h3c4721f56689fae4
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f33170bfea9 - rust_begin_unwind
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/panicking.rs:495:5
  15:     0x7f33170bfe5b - std::panicking::begin_panic_fmt::h447a9fe10c3ac155
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/panicking.rs:437:5
  16:     0x7f331a997141 - rustc_errors::HandlerInner::flush_delayed::hcdae04493e012a6e
  17:     0x7f331a993b11 - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::h27a485c12bfd5a8a
  18:     0x7f3317993296 - core::ptr::drop_in_place::hac2c86d61f6a657d
  19:     0x7f3317998286 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h60c965ef9381f1d3
  20:     0x7f3317974c1d - core::ptr::drop_in_place::h11c56312c481deac
  21:     0x7f3317967f3f - rustc_span::with_source_map::h7455fffe3cd153a4
  22:     0x7f331799f851 - scoped_tls::ScopedKey<T>::set::h8ae8151712a551fd
  23:     0x7f33179a9f85 - std::sys_common::backtrace::__rust_begin_short_backtrace::h26de371bc27662fc
  24:     0x7f33179292de - core::ops::function::FnOnce::call_once{{vtable.shim}}::h674a38f3420d24cb
  25:     0x7f33170cf42a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9e7afb7a0a438236
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/alloc/src/boxed.rs:1312:9
  26:     0x7f33170cf42a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h70c646c4271337a1
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/alloc/src/boxed.rs:1312:9
  27:     0x7f33170cf42a - std::sys::unix::thread::Thread::new::thread_start::h35d2b8d36f210d02
                               at /rustc/20b1e05a8d0e1773dc840a3286aa37916e87d84b/library/std/src/sys/unix/thread.rs:89:17
  28:     0x7f3316fce3e9 - start_thread
  29:     0x7f3316eeb293 - __GI___clone
  30:                0x0 - <unknown>

error: internal compiler error: unexpected panic

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.49.0-nightly (20b1e05a8 2020-10-27) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=2

query stack during panic:
end of query stack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

A-mir-optArea: MIR optimizationsA-mir-opt-inliningArea: MIR inliningC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions