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: non-Aggregate field with matching ABI but differing alignment #126966

Closed
matthiaskrgr opened this issue Jun 25, 2024 · 2 comments · Fixed by #131843
Closed

ICE: non-Aggregate field with matching ABI but differing alignment #126966

matthiaskrgr opened this issue Jun 25, 2024 · 2 comments · Fixed by #131843
Assignees
Labels
A-layout Area: Memory layout of types C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

mod assert {
    use std::mem::{Assume, BikeshedIntrinsicFrom};

    pub fn is_transmutable<Src, Dst>()
    where
        Dst: BikeshedIntrinsicFrom<Src>,
    {
    }
}

#[repr(u32)]
enum Ox00 {
    V = 0x00,
}
enum Ox01 {
    V = 0x01,
}
#[repr(C, packed(2))]
enum OxFF {
    V = 0xFF,
}

fn test() {
    #[derive]

    union Superset {
        a: Ox00,
        b: OxFF,
        b: Ox01,
    }

    assert::is_transmutable::<Superset, Subset>();
}

original:

#![crate_type = "lib"]
#![feature(allow)]
#![allow(dead_code, incomplete_features, non_camel_case_types)]

mod assert {
    use std::mem::{Assume, BikeshedIntrinsicFrom};

    pub fn is_transmutable<Src, Dst>()
    where
        Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }>
    {}
}

#[derive(Clone, Copy)] #[repr(u32)] enum Ox00 { V = 0x00 }
#[derive(Clone, Copy)] #[repr(u8)] enum Ox01 { V = 0x01 }
#[derive(Clone, Copy)] #[repr(C, packed(2))] enum OxFF { V = 0xFF }

fn test() {
    #[derive]
    union Subset {
        a: (),
        b: V1u8,
    }

    #[packed(C)]
    union Superset {
        a: Ox00,
        b: OxFF,
        b: Ox01,
    }

    assert::is_transmutable::<Superset, Subset>(); //~ ERROR cannot be safely transmuted
}

Version information

rustc 1.81.0-nightly (d929a42a6 2024-06-25)
binary: rustc
commit-hash: d929a42a664c026167800801b26d734db925314f
commit-date: 2024-06-25
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error: malformed `derive` attribute input
  --> /tmp/icemaker_global_tempdir.WonAMZI2vcAF/rustc_testrunner_tmpdir_reporting.xuyJdDymg62q/mvce.rs:24:5
   |
24 |     #[derive]
   |     ^^^^^^^^^ help: must be of the form: `#[derive(Trait1, Trait2, ...)]`

error[E0412]: cannot find type `Subset` in this scope
  --> /tmp/icemaker_global_tempdir.WonAMZI2vcAF/rustc_testrunner_tmpdir_reporting.xuyJdDymg62q/mvce.rs:32:41
   |
32 |     assert::is_transmutable::<Superset, Subset>();
   |                                         ^^^^^^ not found in this scope
   |
help: you might be missing a type parameter
   |
23 | fn test<Subset>() {
   |        ++++++++

warning: unused import: `Assume`
 --> /tmp/icemaker_global_tempdir.WonAMZI2vcAF/rustc_testrunner_tmpdir_reporting.xuyJdDymg62q/mvce.rs:2:20
  |
2 |     use std::mem::{Assume, BikeshedIntrinsicFrom};
  |                    ^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.WonAMZI2vcAF/rustc_testrunner_tmpdir_reporting.xuyJdDymg62q/mvce.rs:33:2
   |
33 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.WonAMZI2vcAF/rustc_testrunner_tmpdir_reporting.xuyJdDymg62q/mvce.rs`

error[E0517]: attribute should be applied to a struct or union
  --> /tmp/icemaker_global_tempdir.WonAMZI2vcAF/rustc_testrunner_tmpdir_reporting.xuyJdDymg62q/mvce.rs:18:11
   |
18 |   #[repr(C, packed(2))]
   |             ^^^^^^^^^
19 | / enum OxFF {
20 | |     V = 0xFF,
21 | | }
   | |_- not a struct or union

error[E0658]: use of unstable library feature 'transmutability'
 --> /tmp/icemaker_global_tempdir.WonAMZI2vcAF/rustc_testrunner_tmpdir_reporting.xuyJdDymg62q/mvce.rs:2:20
  |
2 |     use std::mem::{Assume, BikeshedIntrinsicFrom};
  |                    ^^^^^^
  |
  = note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
  = help: add `#![feature(transmutability)]` to the crate attributes to enable
  = note: this compiler was built on 2024-06-25; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'transmutability'
 --> /tmp/icemaker_global_tempdir.WonAMZI2vcAF/rustc_testrunner_tmpdir_reporting.xuyJdDymg62q/mvce.rs:2:28
  |
2 |     use std::mem::{Assume, BikeshedIntrinsicFrom};
  |                            ^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
  = help: add `#![feature(transmutability)]` to the crate attributes to enable
  = note: this compiler was built on 2024-06-25; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'transmutability'
 --> /tmp/icemaker_global_tempdir.WonAMZI2vcAF/rustc_testrunner_tmpdir_reporting.xuyJdDymg62q/mvce.rs:6:14
  |
6 |         Dst: BikeshedIntrinsicFrom<Src>,
  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
  = help: add `#![feature(transmutability)]` to the crate attributes to enable
  = note: this compiler was built on 2024-06-25; consider upgrading it if it is out of date

error[E0124]: field `b` is already declared
  --> /tmp/icemaker_global_tempdir.WonAMZI2vcAF/rustc_testrunner_tmpdir_reporting.xuyJdDymg62q/mvce.rs:29:9
   |
28 |         b: OxFF,
   |         ------- `b` first declared here
29 |         b: Ox01,
   |         ^^^^^^^ field already declared

error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
  --> /tmp/icemaker_global_tempdir.WonAMZI2vcAF/rustc_testrunner_tmpdir_reporting.xuyJdDymg62q/mvce.rs:27:9
   |
27 |         a: Ox00,
   |         ^^^^^^^
   |
   = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
   |
27 |         a: std::mem::ManuallyDrop<Ox00>,
   |            +++++++++++++++++++++++    +

thread 'rustc' panicked at /rustc/d929a42a664c026167800801b26d734db925314f/compiler/rustc_abi/src/layout.rs:289:29:
assertion `left == right` failed: non-Aggregate field with matching ABI but differing alignment
  left: Align(4 bytes)
 right: Align(2 bytes)
stack backtrace:
   0:     0x777bc94142e5 - std::backtrace_rs::backtrace::libunwind::trace::h3816f17667167091
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x777bc94142e5 - std::backtrace_rs::backtrace::trace_unsynchronized::h05c1a74390e79138
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x777bc94142e5 - std::sys::backtrace::_print_fmt::hf9f67f450e2340b3
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/std/src/sys/backtrace.rs:68:5
   3:     0x777bc94142e5 - <std::sys::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd0470f4740d6f066
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/std/src/sys/backtrace.rs:44:22
   4:     0x777bc9463ceb - core::fmt::rt::Argument::fmt::h70b8a6b09781c530
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/core/src/fmt/rt.rs:165:63
   5:     0x777bc9463ceb - core::fmt::write::hafea0839d2bbb3f2
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/core/src/fmt/mod.rs:1168:21
   6:     0x777bc9408f6f - std::io::Write::write_fmt::h781fa7911c53c2fa
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/std/src/io/mod.rs:1835:15
   7:     0x777bc94140be - std::sys::backtrace::_print::h864675b81ca0e917
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/std/src/sys/backtrace.rs:47:5
   8:     0x777bc94140be - std::sys::backtrace::print::h077604854516c949
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/std/src/sys/backtrace.rs:34:9
   9:     0x777bc9416a09 - std::panicking::default_hook::{{closure}}::h0655bbcac1b3559e
  10:     0x777bc94167ac - std::panicking::default_hook::ha9e013cc76e074dd
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/std/src/panicking.rs:292:9
  11:     0x777bc59eac90 - std[e6dd88f179d4d596]::panicking::update_hook::<alloc[7519215c1642967c]::boxed::Box<rustc_driver_impl[6d6094f07793e4a9]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x777bc94172df - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::haac7baf64299a07d
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/alloc/src/boxed.rs:2078:9
  13:     0x777bc94172df - std::panicking::rust_panic_with_hook::h9bfa469549e655b8
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/std/src/panicking.rs:804:13
  14:     0x777bc9416f07 - std::panicking::begin_panic_handler::{{closure}}::h4a967f6ef7ab4640
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/std/src/panicking.rs:670:13
  15:     0x777bc94147a9 - std::sys::backtrace::__rust_end_short_backtrace::h6bde84250dc9cd8b
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/std/src/sys/backtrace.rs:171:18
  16:     0x777bc9416be4 - rust_begin_unwind
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/std/src/panicking.rs:661:5
  17:     0x777bc94602a3 - core::panicking::panic_fmt::h036234c821d91466
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/core/src/panicking.rs:74:14
  18:     0x777bc946087f - core::panicking::assert_failed_inner::h6886c5ce8b27c112
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/core/src/panicking.rs:405:23
  19:     0x777bc6742f17 - core[672c7616ff9a88f5]::panicking::assert_failed::<rustc_abi[75a4f7491f97790a]::Align, rustc_abi[75a4f7491f97790a]::Align>
  20:     0x777bc775ea4e - rustc_ty_utils[91a81cae3f51d4c]::layout::layout_of_uncached
  21:     0x777bc774ce0b - rustc_ty_utils[91a81cae3f51d4c]::layout::layout_of
  22:     0x777bc774cd91 - rustc_query_impl[b034b92d40b1d47d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b034b92d40b1d47d]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e321b4b4f2134162]::query::erase::Erased<[u8; 16usize]>>
  23:     0x777bc774c0b6 - rustc_query_system[4a94863d7e85f976]::query::plumbing::try_execute_query::<rustc_query_impl[b034b92d40b1d47d]::DynamicConfig<rustc_query_system[4a94863d7e85f976]::query::caches::DefaultCache<rustc_middle[e321b4b4f2134162]::ty::ParamEnvAnd<rustc_middle[e321b4b4f2134162]::ty::Ty>, rustc_middle[e321b4b4f2134162]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[b034b92d40b1d47d]::plumbing::QueryCtxt, false>
  24:     0x777bc774bd45 - rustc_query_impl[b034b92d40b1d47d]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  25:     0x777bc671d5cc - rustc_middle[e321b4b4f2134162]::query::plumbing::query_get_at::<rustc_query_system[4a94863d7e85f976]::query::caches::DefaultCache<rustc_middle[e321b4b4f2134162]::ty::ParamEnvAnd<rustc_middle[e321b4b4f2134162]::ty::Ty>, rustc_middle[e321b4b4f2134162]::query::erase::Erased<[u8; 16usize]>>>
  26:     0x777bc6734531 - <rustc_transmute[483028c4aa667a77]::rustc::TransmuteTypeEnv>::is_transmutable
  27:     0x777bc79db58f - <rustc_trait_selection[acad18ec578eab22]::traits::select::SelectionContext>::confirm_candidate
  28:     0x777bc7472f11 - <rustc_trait_selection[acad18ec578eab22]::traits::select::SelectionContext>::evaluate_trait_predicate_recursively
  29:     0x777bc746ce97 - <rustc_trait_selection[acad18ec578eab22]::traits::select::SelectionContext>::evaluate_root_obligation
  30:     0x777bc746b215 - rustc_traits[8a90ea068024d15f]::evaluate_obligation::evaluate_obligation
  31:     0x777bc746aba9 - rustc_query_impl[b034b92d40b1d47d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b034b92d40b1d47d]::query_impl::evaluate_obligation::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e321b4b4f2134162]::query::erase::Erased<[u8; 2usize]>>
  32:     0x777bc746a10f - rustc_query_system[4a94863d7e85f976]::query::plumbing::try_execute_query::<rustc_query_impl[b034b92d40b1d47d]::DynamicConfig<rustc_query_system[4a94863d7e85f976]::query::caches::DefaultCache<rustc_type_ir[567596a8266d8233]::canonical::Canonical<rustc_middle[e321b4b4f2134162]::ty::context::TyCtxt, rustc_middle[e321b4b4f2134162]::ty::ParamEnvAnd<rustc_middle[e321b4b4f2134162]::ty::predicate::Predicate>>, rustc_middle[e321b4b4f2134162]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[b034b92d40b1d47d]::plumbing::QueryCtxt, false>
  33:     0x777bc7469d64 - rustc_query_impl[b034b92d40b1d47d]::query_impl::evaluate_obligation::get_query_non_incr::__rust_end_short_backtrace
  34:     0x777bc38caa92 - <rustc_trait_selection[acad18ec578eab22]::traits::fulfill::FulfillProcessor as rustc_data_structures[66d2db66d3aeea18]::obligation_forest::ObligationProcessor>::process_obligation
  35:     0x777bc70081e7 - <rustc_data_structures[66d2db66d3aeea18]::obligation_forest::ObligationForest<rustc_trait_selection[acad18ec578eab22]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[acad18ec578eab22]::traits::fulfill::FulfillProcessor>
  36:     0x777bc3bbbfea - <rustc_hir_typeck[673ed4476fae1319]::fn_ctxt::FnCtxt>::confirm_builtin_call
  37:     0x777bc7bb4c5d - <rustc_hir_typeck[673ed4476fae1319]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  38:     0x777bc7baedf6 - <rustc_hir_typeck[673ed4476fae1319]::fn_ctxt::FnCtxt>::check_block_with_expected
  39:     0x777bc7bb5760 - <rustc_hir_typeck[673ed4476fae1319]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  40:     0x777bc72f91f6 - rustc_hir_typeck[673ed4476fae1319]::check::check_fn
  41:     0x777bc72ed054 - rustc_hir_typeck[673ed4476fae1319]::typeck
  42:     0x777bc72eca9d - rustc_query_impl[b034b92d40b1d47d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b034b92d40b1d47d]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e321b4b4f2134162]::query::erase::Erased<[u8; 8usize]>>
  43:     0x777bc736a073 - rustc_query_system[4a94863d7e85f976]::query::plumbing::try_execute_query::<rustc_query_impl[b034b92d40b1d47d]::DynamicConfig<rustc_query_system[4a94863d7e85f976]::query::caches::VecCache<rustc_span[31538c27a715cd64]::def_id::LocalDefId, rustc_middle[e321b4b4f2134162]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[b034b92d40b1d47d]::plumbing::QueryCtxt, false>
  44:     0x777bc736924d - rustc_query_impl[b034b92d40b1d47d]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  45:     0x777bc7368e44 - <rustc_middle[e321b4b4f2134162]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[6239ffc5e5ec24c9]::check_crate::{closure#4}>::{closure#0}
  46:     0x777bc73671c1 - rustc_hir_analysis[6239ffc5e5ec24c9]::check_crate
  47:     0x777bc735cf15 - rustc_interface[73bd107be0165211]::passes::analysis
  48:     0x777bc735cad9 - rustc_query_impl[b034b92d40b1d47d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b034b92d40b1d47d]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e321b4b4f2134162]::query::erase::Erased<[u8; 1usize]>>
  49:     0x777bc7e50825 - rustc_query_system[4a94863d7e85f976]::query::plumbing::try_execute_query::<rustc_query_impl[b034b92d40b1d47d]::DynamicConfig<rustc_query_system[4a94863d7e85f976]::query::caches::SingleCache<rustc_middle[e321b4b4f2134162]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[b034b92d40b1d47d]::plumbing::QueryCtxt, false>
  50:     0x777bc7e5058f - rustc_query_impl[b034b92d40b1d47d]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  51:     0x777bc7d77e3f - rustc_interface[73bd107be0165211]::interface::run_compiler::<core[672c7616ff9a88f5]::result::Result<(), rustc_span[31538c27a715cd64]::ErrorGuaranteed>, rustc_driver_impl[6d6094f07793e4a9]::run_compiler::{closure#0}>::{closure#1}
  52:     0x777bc7c37e89 - std[e6dd88f179d4d596]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[73bd107be0165211]::util::run_in_thread_with_globals<rustc_interface[73bd107be0165211]::util::run_in_thread_pool_with_globals<rustc_interface[73bd107be0165211]::interface::run_compiler<core[672c7616ff9a88f5]::result::Result<(), rustc_span[31538c27a715cd64]::ErrorGuaranteed>, rustc_driver_impl[6d6094f07793e4a9]::run_compiler::{closure#0}>::{closure#1}, core[672c7616ff9a88f5]::result::Result<(), rustc_span[31538c27a715cd64]::ErrorGuaranteed>>::{closure#0}, core[672c7616ff9a88f5]::result::Result<(), rustc_span[31538c27a715cd64]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[672c7616ff9a88f5]::result::Result<(), rustc_span[31538c27a715cd64]::ErrorGuaranteed>>
  53:     0x777bc7c37c3a - <<std[e6dd88f179d4d596]::thread::Builder>::spawn_unchecked_<rustc_interface[73bd107be0165211]::util::run_in_thread_with_globals<rustc_interface[73bd107be0165211]::util::run_in_thread_pool_with_globals<rustc_interface[73bd107be0165211]::interface::run_compiler<core[672c7616ff9a88f5]::result::Result<(), rustc_span[31538c27a715cd64]::ErrorGuaranteed>, rustc_driver_impl[6d6094f07793e4a9]::run_compiler::{closure#0}>::{closure#1}, core[672c7616ff9a88f5]::result::Result<(), rustc_span[31538c27a715cd64]::ErrorGuaranteed>>::{closure#0}, core[672c7616ff9a88f5]::result::Result<(), rustc_span[31538c27a715cd64]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[672c7616ff9a88f5]::result::Result<(), rustc_span[31538c27a715cd64]::ErrorGuaranteed>>::{closure#2} as core[672c7616ff9a88f5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  54:     0x777bc942116b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcfcb27dcb2ebeeb7
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/alloc/src/boxed.rs:2064:9
  55:     0x777bc942116b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7d3cd9c06edd61cc
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/alloc/src/boxed.rs:2064:9
  56:     0x777bc942116b - std::sys::pal::unix::thread::Thread::new::thread_start::h082ffbd0fcdeae0d
                               at /rustc/d929a42a664c026167800801b26d734db925314f/library/std/src/sys/pal/unix/thread.rs:108:17
  57:     0x777bc24a6ded - <unknown>
  58:     0x777bc252a0dc - <unknown>
  59:                0x0 - <unknown>

error: 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: please make sure that you have updated to the latest nightly

note: rustc 1.81.0-nightly (d929a42a6 2024-06-25) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [layout_of] computing layout of `test::Superset`
#1 [evaluate_obligation] evaluating trait selection obligation `{type error}: core::mem::transmutability::BikeshedIntrinsicFrom<test::Superset, core::mem::transmutability::Assume { alignment: false, lifetimes: false, safety: false, validity: false }>`
end of query stack
error: aborting due to 9 previous errors; 1 warning emitted

Some errors have detailed explanations: E0124, E0412, E0517, E0601, E0658, E0740.
For more information about an error, try `rustc --explain E0124`.

@rustbot label +F-allow

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels Jun 25, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 25, 2024
@matthiaskrgr
Copy link
Member Author

bisects to #123367 cc @jswrenn

@matthiaskrgr
Copy link
Member Author

bit smaller

mod assert {
    use std::mem::{Assume, BikeshedIntrinsicFrom};

    pub fn is_transmutable<Src, Dst>()
    where
        Dst: BikeshedIntrinsicFrom<Src>,
    {
    }
}

#[repr(u32)]
enum Ox00 {
    V = 0x00,
}

#[repr(C, packed(2))]
enum OxFF {
    V = 0xFF,
}

fn test() {
    union Superset {
        a: Ox00,
        b: OxFF,
    }

    assert::is_transmutable::<Superset, Subset>();
}

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 1, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Jul 5, 2024
@workingjubilee workingjubilee self-assigned this Oct 17, 2024
@workingjubilee workingjubilee added the A-layout Area: Memory layout of types label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-layout Area: Memory layout of types C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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.

4 participants