Closed
Description
Code
The code fails to pass -Zvalidate-mir
fn main() {
for _ in &[0] {}
}
Meta
Repo is at c86039b
Error output
error: internal compiler error: broken MIR in Item(DefId(0:3 ~ main[317d]::main[0])) (input to phase Const) at bb13[0]:
encountered `Assign` statement with incompatible types:
left-hand side has type: !
right-hand side has type: ()
--> main.rs:2:2
|
2 | for _ in &[0] {}
| ^^^^^^^^^^^^^^^^
|
= note: delayed at src/librustc_mir/transform/validate.rs:140:36
error: internal compiler error: broken MIR in Item(DefId(0:3 ~ main[317d]::main[0])) (after CheckPackedRef in phase Const) at bb13[0]:
encountered `Assign` statement with incompatible types:
left-hand side has type: !
right-hand side has type: ()
--> main.rs:2:2
|
2 | for _ in &[0] {}
| ^^^^^^^^^^^^^^^^
|
= note: delayed at src/librustc_mir/transform/validate.rs:140:36
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:367:17
Backtrace
error: internal compiler error: broken MIR in Item(DefId(0:3 ~ main[317d]::main[0])) (input to phase Const) at bb13[0]:
encountered `Assign` statement with incompatible types:
left-hand side has type: !
right-hand side has type: ()
--> main.rs:2:2
|
2 | for _ in &[0] {}
| ^^^^^^^^^^^^^^^^
|
= note: delayed at src/librustc_mir/transform/validate.rs:140:36
error: internal compiler error: broken MIR in Item(DefId(0:3 ~ main[317d]::main[0])) (after CheckPackedRef in phase Const) at bb13[0]:
encountered `Assign` statement with incompatible types:
left-hand side has type: !
right-hand side has type: ()
--> main.rs:2:2
|
2 | for _ in &[0] {}
| ^^^^^^^^^^^^^^^^
|
= note: delayed at src/librustc_mir/transform/validate.rs:140:36
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:367:17
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /home/matthias/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /home/matthias/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1076
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1537
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:198
9: std::panicking::default_hook
at src/libstd/panicking.rs:217
10: <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call
at ./src/liballoc/boxed.rs:1092
11: rustc_driver::report_ice
at src/librustc_driver/lib.rs:1160
12: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:524
13: std::panicking::begin_panic
at ./src/libstd/panicking.rs:450
14: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
at src/librustc_errors/lib.rs:367
15: core::ptr::drop_in_place
at ./src/libcore/ptr/mod.rs:184
16: core::ptr::drop_in_place
at ./src/libcore/ptr/mod.rs:184
17: core::ptr::drop_in_place
at ./src/libcore/ptr/mod.rs:184
18: core::ptr::drop_in_place
at ./src/libcore/ptr/mod.rs:184
19: core::ptr::drop_in_place
at ./src/libcore/ptr/mod.rs:184
20: core::ptr::drop_in_place
at ./src/libcore/ptr/mod.rs:184
21: core::ptr::drop_in_place
at ./src/libcore/ptr/mod.rs:184
22: core::ptr::drop_in_place
at ./src/libcore/ptr/mod.rs:184
23: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
at ./src/liballoc/rc.rs:1159
24: core::ptr::drop_in_place
at ./src/libcore/ptr/mod.rs:184
25: core::ptr::drop_in_place
at ./src/libcore/ptr/mod.rs:184
26: core::mem::drop
at ./src/libcore/mem/mod.rs:877
27: rustc_interface::interface::run_compiler_in_existing_thread_pool::{{closure}}::{{closure}}
at ./src/librustc_interface/interface.rs:199
28: rustc_data_structures::profiling::TimingGuard::run
at ./src/librustc_data_structures/profiling.rs:555
29: rustc_interface::interface::run_compiler_in_existing_thread_pool::{{closure}}
at ./src/librustc_interface/interface.rs:199
30: rustc_span::with_source_map
at ./src/librustc_span/lib.rs:727
31: rustc_interface::interface::run_compiler_in_existing_thread_pool
at ./src/librustc_interface/interface.rs:189
32: rustc_interface::interface::run_compiler::{{closure}}
at ./src/librustc_interface/interface.rs:211
33: rustc_interface::util::spawn_thread_pool::{{closure}}::{{closure}}::{{closure}}
at ./src/librustc_interface/util.rs:149
34: scoped_tls::ScopedKey<T>::set
at /home/matthias/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
35: rustc_interface::util::spawn_thread_pool::{{closure}}::{{closure}}
at ./src/librustc_interface/util.rs:145
36: scoped_tls::ScopedKey<T>::set
at /home/matthias/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
37: rustc_ast::attr::with_globals::{{closure}}
at ./src/librustc_ast/attr/mod.rs:44
38: scoped_tls::ScopedKey<T>::set
at /home/matthias/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
39: rustc_ast::attr::with_globals
at ./src/librustc_ast/attr/mod.rs:44
40: rustc_interface::util::spawn_thread_pool::{{closure}}
at ./src/librustc_interface/util.rs:144
41: rustc_interface::util::scoped_thread::{{closure}}
at ./src/librustc_interface/util.rs:119
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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/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
Metadata
Metadata
Assignees
Labels
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlCategory: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.This issue requires a nightly compiler in some way.