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 with -Zunpretty=thir-tree (garbage code) #83048

Closed
matthiaskrgr opened this issue Mar 12, 2021 · 1 comment · Fixed by #83050
Closed

ice with -Zunpretty=thir-tree (garbage code) #83048

matthiaskrgr opened this issue Mar 12, 2021 · 1 comment · Fixed by #83050
Assignees
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Mar 12, 2021

Code

pub fn main() {break;}

This is one of the many (30+) examples where code that would normally produce a compiler error ICEs with -Zunpretty=thir-tree instead of making the compiler quit early. Garbage in, garbage out, I guess...?
(Usually rustc also prints the thir before panicking with a delay_span_bug but in this example it just crashes right away)

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (77b996e1c 2021-03-12)
binary: rustc
commit-hash: 77b996e1c628e8089f058244b011a2ee945a8984
commit-date: 2021-03-12
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0

Error output

error: internal compiler error: compiler/rustc_mir_build/src/thir/cx/expr.rs:585:29: invalid loop id for break: not inside loop scope

thread 'rustc' panicked at 'Box<Any>', /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/std/src/panic.rs:59:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.52.0-nightly (77b996e1c 2021-03-12) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unpretty=thir-tree

query stack during panic:
end of query stack
error: aborting due to previous error
Backtrace

error: internal compiler error: compiler/rustc_mir_build/src/thir/cx/expr.rs:585:29: invalid loop id for break: not inside loop scope

thread 'rustc' panicked at 'Box<Any>', /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/std/src/panic.rs:59:5
stack backtrace:
   0:     0x7f6d39c20930 - std::backtrace_rs::backtrace::libunwind::trace::hfe3b1cace85e87d8
                               at /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f6d39c20930 - std::backtrace_rs::backtrace::trace_unsynchronized::h542330af06479043
                               at /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f6d39c20930 - std::sys_common::backtrace::_print_fmt::h6b88726367858985
                               at /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f6d39c20930 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hcd76ce6b485adbea
                               at /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f6d39c8eb6f - core::fmt::write::h127419eb46f2ecc9
                               at /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/core/src/fmt/mod.rs:1092:17
   5:     0x7f6d39c14a42 - std::io::Write::write_fmt::h0facb64ef2e7f5d8
                               at /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/std/src/io/mod.rs:1567:15
   6:     0x7f6d39c24675 - std::sys_common::backtrace::_print::h7bf1633ea5421f7b
                               at /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f6d39c24675 - std::sys_common::backtrace::print::h5cc4d09049928ba5
                               at /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f6d39c24675 - std::panicking::default_hook::{{closure}}::h9e84dc005bfc9fc7
                               at /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/std/src/panicking.rs:208:50
   9:     0x7f6d39c241d3 - std::panicking::default_hook::h123278a03b1f796b
                               at /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/std/src/panicking.rs:225:9
  10:     0x7f6d3a40dd7b - rustc_driver::report_ice::h036d06dbb7c2c24c
  11:     0x7f6d39c24de0 - std::panicking::rust_panic_with_hook::h4040631aa6c7bc27
                               at /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/std/src/panicking.rs:595:17
  12:     0x7f6d3b6a3ede - std::panicking::begin_panic::{{closure}}::h0abb5253ab075164
  13:     0x7f6d3b6a3ca9 - std::sys_common::backtrace::__rust_end_short_backtrace::h9aa3e56bb7d07a9b
  14:     0x7f6d3b6a3e82 - std::panicking::begin_panic::ha670be3d93fe1b10
  15:     0x7f6d3b6977e0 - std::panic::panic_any::hfe379233f726f2b8
  16:     0x7f6d3b69a95a - rustc_errors::HandlerInner::bug::h301c6b8b1ce8b93d
  17:     0x7f6d3b69a433 - rustc_errors::Handler::bug::hf51c5d31a61af6b8
  18:     0x7f6d3b5eed3c - rustc_middle::ty::context::tls::with_opt::h3eebcae120721f0c
  19:     0x7f6d3b5f1c60 - rustc_middle::util::bug::opt_span_bug_fmt::hc7e27b731671e399
  20:     0x7f6d3b5f1bd6 - rustc_middle::util::bug::bug_fmt::h0c7e25699bfb20a5
  21:     0x7f6d3bc377e4 - rustc_mir_build::thir::cx::expr::<impl rustc_mir_build::thir::cx::Cx>::make_mirror_unadjusted::h5aa16712dc263b93
  22:     0x7f6d3bc33237 - rustc_mir_build::thir::cx::expr::<impl rustc_mir_build::thir::cx::Cx>::mirror_expr_inner::h22438b418b9affb2
  23:     0x7f6d3bc42a9a - rustc_data_structures::stack::ensure_sufficient_stack::hd9822442d2c45e9b
  24:     0x7f6d3bc3de2a - core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::he281555a93179b82
  25:     0x7f6d3bc3a718 - <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend::hcd56e6c45b33c13a
  26:     0x7f6d3bc2af03 - rustc_mir_build::thir::arena::Arena::alloc_from_iter::ha88992c4e6ec4acc
  27:     0x7f6d3bc3441e - rustc_mir_build::thir::cx::expr::<impl rustc_mir_build::thir::cx::Cx>::make_mirror_unadjusted::h5aa16712dc263b93
  28:     0x7f6d3bc33237 - rustc_mir_build::thir::cx::expr::<impl rustc_mir_build::thir::cx::Cx>::mirror_expr_inner::h22438b418b9affb2
  29:     0x7f6d3bc42a9a - rustc_data_structures::stack::ensure_sufficient_stack::hd9822442d2c45e9b
  30:     0x7f6d3bc32801 - rustc_mir_build::thir::cx::build_thir::hca8a76b024fe179a
  31:     0x7f6d3a413448 - rustc_driver::pretty::print_after_hir_lowering::h5bce238744c8dbc6
  32:     0x7f6d3a44e411 - rustc_interface::passes::QueryContext::enter::h97517f6cb7f2d9ae
  33:     0x7f6d3c19bbe0 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h8ab0a704bae2634f
  34:     0x7f6d3c196024 - rustc_span::with_source_map::h512fd197bcd2b7c3
  35:     0x7f6d3c19b113 - scoped_tls::ScopedKey<T>::set::hd407f010a973eb63
  36:     0x7f6d3c19c921 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3c42279179caa5db
  37:     0x7f6d3c1b7cf5 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hd56f564efc764ea1
  38:     0x7f6d39c34258 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd8ea7ada17dfa868
                               at /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/alloc/src/boxed.rs:1546:9
  39:     0x7f6d39c34258 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h91ce3a636c58b978
                               at /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/alloc/src/boxed.rs:1546:9
  40:     0x7f6d39c34258 - std::sys::unix::thread::Thread::new::thread_start::h2e193c2e23720fdf
                               at /rustc/77b996e1c628e8089f058244b011a2ee945a8984/library/std/src/sys/unix/thread.rs:71:17
  41:     0x7f6d39b3d299 - start_thread
  42:     0x7f6d39a52053 - clone
  43:                0x0 - <unknown>

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.52.0-nightly (77b996e1c 2021-03-12) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unpretty=thir-tree

query stack during panic:
end of query stack
error: aborting due to previous error

@matthiaskrgr matthiaskrgr 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 Mar 12, 2021
@matthiaskrgr matthiaskrgr changed the title ice with -Zunpretty=thir-tree (garbage code= ice with -Zunpretty=thir-tree (garbage code) Mar 12, 2021
@osa1
Copy link
Contributor

osa1 commented Mar 12, 2021

@rustbot claim

fanninpm added a commit to fanninpm/glacier that referenced this issue Mar 19, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Mar 19, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 23, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 23, 2021
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 24, 2021
@bors bors closed this as completed in b24902e Mar 24, 2021
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. glacier ICE tracked in rust-lang/glacier. 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

Successfully merging a pull request may close this issue.

3 participants