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

Storing generic_array::GenericArray in union triggers ICE #82335

Closed
jgarvin opened this issue Feb 20, 2021 · 2 comments
Closed

Storing generic_array::GenericArray in union triggers ICE #82335

jgarvin opened this issue Feb 20, 2021 · 2 comments
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

@jgarvin
Copy link

jgarvin commented Feb 20, 2021

Code

typenum="1.12.0"
generic-array="0.14.4"

Playground link

use generic_array::GenericArray;
use typenum::Unsigned;

union Foo<N: Unsigned> {
    data: GenericArray<u8, N>
}

Meta

This bug exists both on current nightly and stable. Nightly output:

rustc --version --verbose:

rustc 1.52.0-nightly

Error output

   Compiling playground v0.0.1 (/playground)
error: internal compiler error: compiler/rustc_traits/src/normalize_erasing_regions.rs:43:32: could not fully normalize `<N as generic_array::ArrayLength<u8>>::ArrayType`

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958: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.50.0 (cb75ad5db 2021-02-10) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [normalize_generic_arg_after_erasing_regions] normalizing `<N as generic_array::ArrayLength<u8>>::ArrayType`
#1 [needs_drop_raw] computing whether `generic_array::GenericArray<u8, N>` needs drop
end of query stack
error: aborting due to previous error
Backtrace
error: internal compiler error: compiler/rustc_traits/src/normalize_erasing_regions.rs:43:32: could not fully normalize `<N as generic_array::ArrayLength<u8>>::ArrayType`

thread 'rustc' panicked at 'Box<Any>', /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/std/src/panic.rs:59:5
stack backtrace:
   0:     0x7fb3e8b1cc70 - std::backtrace_rs::backtrace::libunwind::trace::hb4de9797f80b7b8c
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7fb3e8b1cc70 - std::backtrace_rs::backtrace::trace_unsynchronized::h59566d0bd20efff7
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fb3e8b1cc70 - std::sys_common::backtrace::_print_fmt::hcfa5ce6be50275d4
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fb3e8b1cc70 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd8c307a38b9bab04
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7fb3e8b8deec - core::fmt::write::h3868db8542c90941
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/core/src/fmt/mod.rs:1096:17
   5:     0x7fb3e8b0fba2 - std::io::Write::write_fmt::hab90295d5a0f197d
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/std/src/io/mod.rs:1568:15
   6:     0x7fb3e8b20b55 - std::sys_common::backtrace::_print::h19224910b8700cf1
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7fb3e8b20b55 - std::sys_common::backtrace::print::h25dedfa68c5fb84a
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7fb3e8b20b55 - std::panicking::default_hook::{{closure}}::h12c5765653a72a42
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/std/src/panicking.rs:208:50
   9:     0x7fb3e8b206b3 - std::panicking::default_hook::he65cee71c4209f0c
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/std/src/panicking.rs:225:9
  10:     0x7fb3e937b52b - rustc_driver::report_ice::h9bfcf5769c15fbf2
  11:     0x7fb3e8b21456 - std::panicking::rust_panic_with_hook::h01a674d863fe0d8a
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/std/src/panicking.rs:595:17
  12:     0x7fb3eab5337e - std::panicking::begin_panic::{{closure}}::h04d9d59beaf7438f
  13:     0x7fb3eab530b9 - std::sys_common::backtrace::__rust_end_short_backtrace::h91912ecacddbde4e
  14:     0x7fb3eab53322 - std::panicking::begin_panic::h3001af3848957078
  15:     0x7fb3eab46070 - std::panic::panic_any::h4f4426de976e6adf
  16:     0x7fb3eab4947a - rustc_errors::HandlerInner::bug::hdf11185f92e2a22a
  17:     0x7fb3eab48f53 - rustc_errors::Handler::bug::h2dfda4f443e5c9b7
  18:     0x7fb3ea848aaa - rustc_middle::ty::context::tls::with_opt::h931a04da690f236d
  19:     0x7fb3ec15fab0 - rustc_middle::util::bug::opt_span_bug_fmt::h550b33bd70d0f311
  20:     0x7fb3ea84af26 - rustc_middle::util::bug::bug_fmt::h36f36510cd9d6fb0
  21:     0x7fb3ead4b19f - rustc_infer::infer::InferCtxtBuilder::enter::hf940139bf6bfbc27
  22:     0x7fb3ead5420a - rustc_traits::normalize_erasing_regions::normalize_generic_arg_after_erasing_regions::h80e6571a4ee85ad8
  23:     0x7fb3ec1f50a8 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::ha53fe413c90dab6e
  24:     0x7fb3eb61722d - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h22198f06d62ce937
  25:     0x7fb3eb57c065 - rustc_data_structures::stack::ensure_sufficient_stack::h661218e91a1b54e9
  26:     0x7fb3eb56e65e - rustc_query_system::query::plumbing::force_query_with_job::h3c8146f2d1f28d43
  27:     0x7fb3eb553b58 - rustc_query_system::query::plumbing::get_query_impl::ha6c6abc347fafc39
  28:     0x7fb3eb59844b - <rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle::ty::fold::TypeFolder>::fold_ty::hddf16ed3359dbd34
  29:     0x7fb3ead33aa3 - rustc_ty_utils::needs_drop::needs_drop_raw::hf8e0eae2daf84614
  30:     0x7fb3e9ae1a16 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::needs_drop_raw>::compute::h82c0a5ac3f555896
  31:     0x7fb3e9b09c10 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::hf7df7e26f965f6be
  32:     0x7fb3e9af8efd - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::haae861225e7e67f6
  33:     0x7fb3e9afcf6c - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::h1207d5165f8894a7
  34:     0x7fb3e9b2c015 - rustc_data_structures::stack::ensure_sufficient_stack::h5929c556f360f9c2
  35:     0x7fb3e9ae79db - rustc_query_system::query::plumbing::force_query_with_job::ha8da147a11595916
  36:     0x7fb3e9ae25dc - rustc_query_system::query::plumbing::get_query_impl::h4b5993c042058290
  37:     0x7fb3e9af0e2f - rustc_query_system::query::plumbing::get_query::h3ab4a250ccb3bbf1
  38:     0x7fb3eafe525f - <rustc_passes::stability::Checker as rustc_hir::intravisit::Visitor>::visit_item::h2bf5d0cf54fef87b
  39:     0x7fb3eafb2162 - rustc_middle::hir::map::Map::visit_item_likes_in_module::h2a479328b3cfc618
  40:     0x7fb3ebbb74e2 - rustc_passes::stability::check_mod_unstable_api_usage::h384a7e0e614a05bd
  41:     0x7fb3eb6eb7fc - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_mod_unstable_api_usage>::compute::h538c349dade82501
  42:     0x7fb3eb6f6207 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::hb18acbc8e33ea959
  43:     0x7fb3eb6d7f0d - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::ha27bbe1fb2160242
  44:     0x7fb3eb705005 - rustc_data_structures::stack::ensure_sufficient_stack::h98d3bece40371b3e
  45:     0x7fb3eb6f3761 - rustc_query_system::query::plumbing::force_query_with_job::h3480dbaedc8e4d04
  46:     0x7fb3eb6f1a98 - rustc_query_system::query::plumbing::get_query_impl::hc861c865b8ac055a
  47:     0x7fb3eb6f2d47 - rustc_query_system::query::plumbing::ensure_query_impl::h6c30c930f4936591
  48:     0x7fb3eb6cedbc - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hf18fa3d3907c9ecd
  49:     0x7fb3eb6f6aac - rustc_session::utils::<impl rustc_session::session::Session>::time::h23248c12f89aea1d
  50:     0x7fb3eb708d91 - rustc_interface::passes::analysis::heddb9cef62da4ab1
  51:     0x7fb3eb6864c9 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute::hc584fab50c0e9742
  52:     0x7fb3e9337afa - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::he189719f47fb03a4
  53:     0x7fb3eb698964 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h90cdb9d4b5390542
  54:     0x7fb3eb6a7855 - rustc_data_structures::stack::ensure_sufficient_stack::hc03964f1cadb8cd3
  55:     0x7fb3eb6871f1 - rustc_query_system::query::plumbing::force_query_with_job::h085fb2f93a800461
  56:     0x7fb3eb686801 - rustc_query_system::query::plumbing::get_query_impl::hc18a830d288c39e4
  57:     0x7fb3eb69faaa - rustc_interface::passes::QueryContext::enter::hf896adfd99e9040f
  58:     0x7fb3eb6a68e4 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h2ac7000621882a7f
  59:     0x7fb3eb69f391 - rustc_span::with_source_map::h9c33ff8439fe9783
  60:     0x7fb3eb6a60b3 - scoped_tls::ScopedKey<T>::set::h0eb8893a0191dbc1
  61:     0x7fb3eb6a7ac8 - std::sys_common::backtrace::__rust_begin_short_backtrace::hccc56e59b0e3233c
  62:     0x7fb3eb68619a - core::ops::function::FnOnce::call_once{{vtable.shim}}::h09f6484b7e2514ef
  63:     0x7fb3e8b31dda - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h321523073ee11258
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/alloc/src/boxed.rs:1548:9
  64:     0x7fb3e8b31dda - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf0e85e12c83b99b3
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/alloc/src/boxed.rs:1548:9
  65:     0x7fb3e8b31dda - std::sys::unix::thread::Thread::new::thread_start::hba22c7961aa0e2f8
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1/library/std/src/sys/unix/thread.rs:71:17
  66:     0x7fb3e8a4d609 - start_thread
  67:     0x7fb3e8961293 - clone
  68:                0x0 - <unknown>

@jgarvin jgarvin 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 Feb 20, 2021
@JohnTitor JohnTitor added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Feb 23, 2021
@Johannesd3
Copy link

Johannesd3 commented May 8, 2021

I think this is a duplicate of #81199.

However, an MCVE would be:

trait Trait {
    type Assoc;
}

struct Struct<T: Trait> {
    data: T::Assoc,
}

union Union<T> {
    data: Struct<T>
}

another example:

union Union<I> {
    data: std::iter::Peekable<I>
}

@JohnTitor JohnTitor removed the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Jun 6, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jun 6, 2021
@Alexendoo
Copy link
Member

Fixed by #91462

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

No branches or pull requests

5 participants