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: struct has no associated body with -Zthir-unsafeck=yes #85871

Closed
matthiaskrgr opened this issue May 31, 2021 · 1 comment · Fixed by #86138
Closed

ICE: struct has no associated body with -Zthir-unsafeck=yes #85871

matthiaskrgr opened this issue May 31, 2021 · 1 comment · Fixed by #86138
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

Code

code from glacier fixed 67405.rs

struct Bug {
    inner: [(); match || 1 {
        n => n(),
    }],
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.54.0-nightly (c1e8f3a58 2021-05-30)
binary: rustc
commit-hash: c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b
commit-date: 2021-05-30
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.1

Error output

error: internal compiler error: compiler/rustc_middle/src/hir/map/mod.rs:423:13: body_owned_by: struct Bug (hir_id=HirId { owner: DefId(0:3 ~ 67405[c442]::Bug), local_id: 0 }) has no associated body
 --> ./67405.rs:1:1
  |
1 | / struct Bug {
2 | |     inner: [(); match || 1 {
3 | |         n => n(),
4 | |     }],
5 | | }
  | |_^

thread 'rustc' panicked at 'Box<Any>', /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/compiler/rustc_errors/src/lib.rs:951:9
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.54.0-nightly (c1e8f3a58 2021-05-30) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z thir-unsafeck=yes

query stack during panic:
#0 [thir_body] building THIR for `Bug`
#1 [thir_check_unsafety] unsafety-checking `Bug`
end of query stack
error: aborting due to previous error

Backtrace

error: internal compiler error: compiler/rustc_middle/src/hir/map/mod.rs:423:13: body_owned_by: struct Bug (hir_id=HirId { owner: DefId(0:3 ~ 67405[c442]::Bug), local_id: 0 }) has no associated body
 --> ./67405.rs:1:1
  |
1 | / struct Bug {
2 | |     inner: [(); match || 1 {
3 | |         n => n(),
4 | |     }],
5 | | }
  | |_^

thread 'rustc' panicked at 'Box<Any>', /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/compiler/rustc_errors/src/lib.rs:951:9
stack backtrace:
   0:     0x7f109006ef80 - std::backtrace_rs::backtrace::libunwind::trace::h1a39bd9a98540471
                               at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f109006ef80 - std::backtrace_rs::backtrace::trace_unsynchronized::h21a1eeae7103ab3f
                               at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f109006ef80 - std::sys_common::backtrace::_print_fmt::hc9ffbae9ed6a9871
                               at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f109006ef80 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h17510753a34a3f09
                               at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f10900dc9ac - core::fmt::write::h1e5a1f350e43b10f
                               at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/core/src/fmt/mod.rs:1110:17
   5:     0x7f1090060805 - std::io::Write::write_fmt::h06ec27c6d028baf1
                               at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/io/mod.rs:1588:15
   6:     0x7f1090072ddb - std::sys_common::backtrace::_print::h1a02603349b1dc60
                               at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f1090072ddb - std::sys_common::backtrace::print::h0fc317d31c48cd9b
                               at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f1090072ddb - std::panicking::default_hook::{{closure}}::ha522601c22d7057b
                               at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/panicking.rs:208:50
   9:     0x7f10900728b1 - std::panicking::default_hook::hd50ab173af9a3ce8
                               at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/panicking.rs:225:9
  10:     0x7f10908439bd - rustc_driver::report_ice::h0bbc0ae77d597594
  11:     0x7f10900735e6 - std::panicking::rust_panic_with_hook::hb5a01416e02405ad
                               at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/panicking.rs:626:17
  12:     0x7f109171d51b - std::panicking::begin_panic::{{closure}}::hc5eb45c8a89da605
  13:     0x7f109171d436 - std::sys_common::backtrace::__rust_end_short_backtrace::h56af134c087f8aee
  14:     0x7f10916da43f - std::panicking::begin_panic::h4dde37cbe49c77b2
  15:     0x7f1091683d4d - std::panic::panic_any::hbb79d7216fdc8ce6
  16:     0x7f1091682e95 - rustc_errors::HandlerInner::span_bug::hb4b5011e06706f0f
  17:     0x7f1091683cf0 - rustc_errors::Handler::span_bug::h6b81dbf6bf10ea08
  18:     0x7f1091786901 - rustc_middle::ty::context::tls::with_opt::h5d93e51ac4f84952
  19:     0x7f1091789d40 - rustc_middle::util::bug::opt_span_bug_fmt::h73ef8867dd647d6e
  20:     0x7f1091789d0c - rustc_middle::util::bug::span_bug_fmt::h9683e8642769e3a3
  21:     0x7f10922fb1dd - rustc_middle::hir::map::Map::body_owned_by::h825b0a25ecdb4483
  22:     0x7f1091d83d60 - rustc_mir_build::thir::cx::thir_body::h8fa569ef978ff906
  23:     0x7f1091c24084 - rustc_query_system::query::plumbing::get_query_impl::h7cc106b73e3396e7
  24:     0x7f1091c7d808 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::thir_body::h46ed27445f5f3020
  25:     0x7f1091d73a46 - rustc_mir_build::check_unsafety::check_unsafety::h1c9e984bce687c62
  26:     0x7f1091d746d9 - rustc_mir_build::check_unsafety::thir_check_unsafety::h2e92784c5bbd6545
  27:     0x7f1091c21965 - rustc_query_system::query::plumbing::get_query_impl::h6d097d1e3348018d
  28:     0x7f1091c7ea1d - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::thir_check_unsafety::hd87546f1283dca94
  29:     0x7f1091d73b16 - rustc_mir_build::check_unsafety::check_unsafety::h1c9e984bce687c62
  30:     0x7f1091d746d9 - rustc_mir_build::check_unsafety::thir_check_unsafety::h2e92784c5bbd6545
  31:     0x7f1091c21965 - rustc_query_system::query::plumbing::get_query_impl::h6d097d1e3348018d
  32:     0x7f1091c7ea1d - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::thir_check_unsafety::hd87546f1283dca94
  33:     0x7f1091d45a74 - rustc_mir_build::build::mir_built::h56e529540ba9284f
  34:     0x7f1091c224b4 - rustc_query_system::query::plumbing::get_query_impl::h73bb8f77cd67afeb
  35:     0x7f1091c7d978 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_built::h70879b0013c6ce6a
  36:     0x7f1091f5f228 - rustc_mir::transform::check_unsafety::unsafety_check_result::h99b6f0ef5b715a73
  37:     0x7f1091f4f8a4 - core::ops::function::FnOnce::call_once::h15ca75fa8a6fa33c
  38:     0x7f1091c176ff - rustc_query_system::query::plumbing::get_query_impl::h41a86f74a2e14daf
  39:     0x7f1091c7e96d - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::unsafety_check_result::h20ecf6154f0dad18
  40:     0x7f1091f5d7f3 - <rustc_mir::transform::check_unsafety::UnsafetyChecker as rustc_middle::mir::visit::Visitor>::visit_rvalue::h7e12db47de6e237b
  41:     0x7f1091f5f5a2 - rustc_mir::transform::check_unsafety::unsafety_check_result::h99b6f0ef5b715a73
  42:     0x7f1091f4f8a4 - core::ops::function::FnOnce::call_once::h15ca75fa8a6fa33c
  43:     0x7f1091c176ff - rustc_query_system::query::plumbing::get_query_impl::h41a86f74a2e14daf
  44:     0x7f1091c7e96d - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::unsafety_check_result::h20ecf6154f0dad18
  45:     0x7f1091dec5b3 - rustc_mir::transform::mir_const::hb201e3f5174c238f
  46:     0x7f1091c224b4 - rustc_query_system::query::plumbing::get_query_impl::h73bb8f77cd67afeb
  47:     0x7f1091c7da28 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_const::hb56d6d8473ac3073
  48:     0x7f1091debcbe - rustc_mir::transform::mir_const_qualif::h030a3730373a3d88
  49:     0x7f1091db0992 - core::ops::function::FnOnce::call_once::hafa792986bac0c80
  50:     0x7f1091c3d7eb - rustc_query_system::query::plumbing::get_query_impl::hefe6cb4080d2bc78
  51:     0x7f1091c7d8ba - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_const_qualif::ha31834a0f82c3022
  52:     0x7f1091daf03b - rustc_middle::mir::query::<impl rustc_middle::ty::context::TyCtxt>::mir_const_qualif_opt_const_arg::hf0c56f1b7ad3bb15
  53:     0x7f1091dcb248 - rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider::hc342a5cc80315017
  54:     0x7f1091c55efd - rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::eval_to_allocation_raw>::compute::h50f34bc5c1b84fb8
  55:     0x7f1091c26c64 - rustc_query_system::query::plumbing::get_query_impl::h82efa1836f4eb10a
  56:     0x7f1091c7edf7 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_allocation_raw::h2b3ca26d4a0bfe39
  57:     0x7f1091dca1aa - rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider::h492a1f0908ef1033
  58:     0x7f1091c55f3d - rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::eval_to_const_value_raw>::compute::hf332c6ae6cc62cca
  59:     0x7f1091c2f6e5 - rustc_query_system::query::plumbing::get_query_impl::ha84d8dc8b8f75ed2
  60:     0x7f1091c7ef17 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw::h46d27616aa3d4e98
  61:     0x7f1091dca09e - rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider::h492a1f0908ef1033
  62:     0x7f1091c55f3d - rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::eval_to_const_value_raw>::compute::hf332c6ae6cc62cca
  63:     0x7f1091c2f6e5 - rustc_query_system::query::plumbing::get_query_impl::ha84d8dc8b8f75ed2
  64:     0x7f1091c7ef17 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw::h46d27616aa3d4e98
  65:     0x7f109225743c - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id::h5b31d85c4aaa4700
  66:     0x7f109226e35d - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve::h05ad8dfc76427d5b
  67:     0x7f109217746a - <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_const::ha28a1f0b5ceac03e
  68:     0x7f10921c98df - rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with::h3d1c86eeb9c4b425
  69:     0x7f1092176a57 - <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_ty::h049c3916fb026aa1
  70:     0x7f1091a9c40a - rustc_data_structures::stack::ensure_sufficient_stack::hefe9147ea437d887
  71:     0x7f1091afe29f - rustc_trait_selection::traits::project::normalize::h1e841ffb46b015bb
  72:     0x7f1091aa92a6 - rustc_typeck::check::inherited::Inherited::normalize_associated_types_in::h00760ce7401afff6
  73:     0x7f1092621b86 - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::h84786bf42b5f18ca
  74:     0x7f109258de39 - rustc_typeck::check::wfcheck::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::non_enum_variant::h20bcf38b44962457
  75:     0x7f10925d1bd4 - rustc_typeck::check::inherited::InheritedBuilder::enter::hc7b47ef61ca52619
  76:     0x7f1091a617d5 - rustc_typeck::check::wfcheck::check_item_well_formed::h984027aa615a7822
  77:     0x7f1091c21965 - rustc_query_system::query::plumbing::get_query_impl::h6d097d1e3348018d
  78:     0x7f1091c7ff2d - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_item_well_formed::h27d5df3cbfeb8f6e
  79:     0x7f1091a673cc - <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor as rustc_hir::intravisit::Visitor>::visit_item::h4f8bab9036ea26bc
  80:     0x7f1091b1ac7e - rustc_data_structures::sync::par_for_each_in::h00a8051912db38e6
  81:     0x7f10925c9599 - rustc_hir::hir::Crate::par_visit_all_item_likes::h9225f9a1d7b63519
  82:     0x7f10925afb46 - rustc_session::session::Session::track_errors::h3587c68e2a0045ce
  83:     0x7f1092636de8 - rustc_typeck::check_crate::h033d52ddf5a3c52c
  84:     0x7f10919464dc - rustc_interface::passes::analysis::h44573dd1f435360d
  85:     0x7f10926fbc14 - rustc_query_system::query::plumbing::get_query_impl::hb28d9338aaa73db6
  86:     0x7f1092795619 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis::h92a4884e0478500d
  87:     0x7f1092374aa7 - rustc_interface::passes::QueryContext::enter::hb9b4b642821635fe
  88:     0x7f10923506e3 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h16bd07ff16fa3d4a
  89:     0x7f109234cf0c - rustc_span::with_source_map::h6ee13da35fa72295
  90:     0x7f109234ff28 - scoped_tls::ScopedKey<T>::set::h9c6565b722913393
  91:     0x7f1092374e4b - std::sys_common::backtrace::__rust_begin_short_backtrace::hdcf17779193f6d57
  92:     0x7f109234bc15 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hf48084e1b458d4b2
  93:     0x7f109007fad7 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf00ff0dfc0b9e39f
                               at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/alloc/src/boxed.rs:1575:9
  94:     0x7f109007fad7 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h236979b1b61b3517
                               at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/alloc/src/boxed.rs:1575:9
  95:     0x7f109007fad7 - std::sys::unix::thread::Thread::new::thread_start::h8f357e546e4775fa
                               at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/sys/unix/thread.rs:71:17
  96:     0x7f108ff8d299 - start_thread
  97:     0x7f108fea2053 - clone
  98:                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.54.0-nightly (c1e8f3a58 2021-05-30) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z thir-unsafeck=yes

query stack during panic:
#0 [thir_body] building THIR for `Bug`
#1 [thir_check_unsafety] unsafety-checking `Bug`
#2 [thir_check_unsafety] unsafety-checking `Bug::inner::{constant#0}::{closure#0}`
#3 [mir_built] building MIR for `Bug::inner::{constant#0}::{closure#0}`
#4 [unsafety_check_result] unsafety-checking `Bug::inner::{constant#0}::{closure#0}`
#5 [unsafety_check_result] unsafety-checking `Bug::inner::{constant#0}`
#6 [mir_const] processing MIR for `Bug::inner::{constant#0}`
#7 [mir_const_qualif] const checking `Bug::inner::{constant#0}`
#8 [eval_to_allocation_raw] const-evaluating + checking `Bug::inner::{constant#0}`
#9 [eval_to_const_value_raw] simplifying constant for the type system `Bug::inner::{constant#0}`
#10 [eval_to_const_value_raw] simplifying constant for the type system `Bug::inner::{constant#0}`
#11 [check_item_well_formed] checking that `Bug` is well-formed
#12 [analysis] running analysis passes on this crate
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 May 31, 2021
@syvb
Copy link
Contributor

syvb commented Jun 2, 2021

Note that there is currently a test, src/test/ui/consts/issue-68542-closure-in-array-len.rs , that has the same issue and fails when run under the THIR checker.

fanninpm added a commit to fanninpm/glacier that referenced this issue Jun 4, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jun 5, 2021
@bors bors closed this as completed in f1e691d Jun 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