Skip to content

ICE: -Zvalidate-mir: broken mir in libcore #73109

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

fn main() {
	let x = "a".to_string();
  }

Meta

rustc --version --verbose:
repo @ 0262de5

<version>

Error output

build/x86_64-unknown-linux-gnu/stage2/bin/rustc bad.rs -Zvalidate-mir

error: internal compiler error: broken MIR in DefId(2:2110 ~ core[13dc]::ops[0]::function[0]::FnOnce[0]::call_once[0]) (input to phase Const) at bb0[0]:
encountered non-callable type Self in `Call` terminator
   --> /home/matthias/vcs/github/rust/src/libcore/ops/function.rs:232:5
    |
232 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: broken MIR in DefId(2:2110 ~ core[13dc]::ops[0]::function[0]::FnOnce[0]::call_once[0]) (after AddMovesForPackedDrops in phase Const) at bb0[0]:
encountered non-callable type Self in `Call` terminator
   --> /home/matthias/vcs/github/rust/src/libcore/ops/function.rs:232:5
    |
232 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: broken MIR in DefId(2:2110 ~ core[13dc]::ops[0]::function[0]::FnOnce[0]::call_once[0]) (after NoLandingPads in phase Const) at bb0[0]:
encountered non-callable type Self in `Call` terminator
   --> /home/matthias/vcs/github/rust/src/libcore/ops/function.rs:232:5
    |
232 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: broken MIR in DefId(2:2110 ~ core[13dc]::ops[0]::function[0]::FnOnce[0]::call_once[0]) (after RemoveNoopLandingPads in phase Const) at bb0[0]:
encountered non-callable type Self in `Call` terminator
   --> /home/matthias/vcs/github/rust/src/libcore/ops/function.rs:232:5
    |
232 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: broken MIR in DefId(2:2110 ~ core[13dc]::ops[0]::function[0]::FnOnce[0]::call_once[0]) (after SimplifyCfg-make_shim in phase Const) at bb0[0]:
encountered non-callable type Self in `Call` terminator
   --> /home/matthias/vcs/github/rust/src/libcore/ops/function.rs:232:5
    |
232 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: broken MIR in DefId(2:2110 ~ core[13dc]::ops[0]::function[0]::FnOnce[0]::call_once[0]) (after AddCallGuards in phase Const) at bb0[0]:
encountered non-callable type Self in `Call` terminator
   --> /home/matthias/vcs/github/rust/src/libcore/ops/function.rs:232:5
    |
232 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

Backtrace

warning: unused variable: `x`
 --> ./src/test/ui/issues/issue-29053.rs:4:5
  |
4 | let x = "a".to_string();
  |     ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

error: internal compiler error: broken MIR in DefId(2:2110 ~ core[13dc]::ops[0]::function[0]::FnOnce[0]::call_once[0]) (input to phase Const) at bb0[0]:
encountered non-callable type Self in `Call` terminator
   --> /home/matthias/vcs/github/rust/src/libcore/ops/function.rs:232:5
    |
232 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: broken MIR in DefId(2:2110 ~ core[13dc]::ops[0]::function[0]::FnOnce[0]::call_once[0]) (after AddMovesForPackedDrops in phase Const) at bb0[0]:
encountered non-callable type Self in `Call` terminator
   --> /home/matthias/vcs/github/rust/src/libcore/ops/function.rs:232:5
    |
232 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: broken MIR in DefId(2:2110 ~ core[13dc]::ops[0]::function[0]::FnOnce[0]::call_once[0]) (after NoLandingPads in phase Const) at bb0[0]:
encountered non-callable type Self in `Call` terminator
   --> /home/matthias/vcs/github/rust/src/libcore/ops/function.rs:232:5
    |
232 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: broken MIR in DefId(2:2110 ~ core[13dc]::ops[0]::function[0]::FnOnce[0]::call_once[0]) (after RemoveNoopLandingPads in phase Const) at bb0[0]:
encountered non-callable type Self in `Call` terminator
   --> /home/matthias/vcs/github/rust/src/libcore/ops/function.rs:232:5
    |
232 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: broken MIR in DefId(2:2110 ~ core[13dc]::ops[0]::function[0]::FnOnce[0]::call_once[0]) (after SimplifyCfg-make_shim in phase Const) at bb0[0]:
encountered non-callable type Self in `Call` terminator
   --> /home/matthias/vcs/github/rust/src/libcore/ops/function.rs:232:5
    |
232 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: broken MIR in DefId(2:2110 ~ core[13dc]::ops[0]::function[0]::FnOnce[0]::call_once[0]) (after AddCallGuards in phase Const) at bb0[0]:
encountered non-callable type Self in `Call` terminator
   --> /home/matthias/vcs/github/rust/src/libcore/ops/function.rs:232:5
    |
232 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:366:17
stack backtrace:
   0:     0x7ff80b84a927 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h76512f7a256472fb
   1:     0x7ff80b8973ed - core::fmt::write::hc64edb3869fa1953
   2:     0x7ff80b838ed5 - std::io::Write::write_fmt::h22c2e31bf0666336
   3:     0x7ff80b826720 - std::panicking::default_hook::{{closure}}::h8f574173d5f96f34
   4:     0x7ff80b826434 - std::panicking::default_hook::h6d7c5c0ca6d5609a
   5:     0x7ff80d1e3063 - rustc_driver::report_ice::h431648ac89c0c7bf
   6:     0x7ff80b826e0c - std::panicking::rust_panic_with_hook::hf2dca5902ecb2b51
   7:     0x7ff81131e02e - std::panicking::begin_panic::hf5fc738ac6374f42
   8:     0x7ff81135661e - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::h3bc01279a971299c
   9:     0x7ff80d23ea56 - core::ptr::drop_in_place::h2641e7528eee45ff
  10:     0x7ff80d2475a6 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h324ce0426c1e8578
  11:     0x7ff80d26733d - core::ptr::drop_in_place::hec47fdddd89633e0
  12:     0x7ff80d2591b1 - rustc_span::with_source_map::ha1d5ff3f79f62133
  13:     0x7ff80d1e84b9 - rustc_interface::interface::run_compiler_in_existing_thread_pool::ha05b609632adf0fb
  14:     0x7ff80d1cda8e - scoped_tls::ScopedKey<T>::set::h3583f55ed4da470f
  15:     0x7ff80d1e99e6 - std::sys_common::backtrace::__rust_begin_short_backtrace::h8229f831f4f87563
  16:     0x7ff80d1c5dce - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc78b13e1eb35a770
  17:     0x7ff80b82f058 - std::sys::unix::thread::Thread::new::thread_start::heec70046c66b2eb2
  18:     0x7ff80b555422 - start_thread
  19:     0x7ff80b673bf3 - __GI___clone
  20:                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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.46.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z validate-mir

query stack during panic:
end of query stack

This issue has been assigned to @doctorn via this comment.

Metadata

Metadata

Assignees

Labels

A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-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