-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ICE: transmute: assertion failed: min <= max'
#117812
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
smaller: #![feature(transmutability)]
use std::mem::BikeshedIntrinsicFrom;
pub struct Context;
pub fn is_maybe_transmutable<Src, Dst>()
where
Dst: BikeshedIntrinsicFrom<Src, Context>,
{
}
fn should_pad_explicitly_aligned_field() {
#[repr(packed, align(0x100))]
#[repr(u8)]
enum V0u8 {
V = 0,
}
#[repr(C)]
struct ExplicitlyPadded(V0u8);
is_maybe_transmutable::<(), ExplicitlyPadded>();
} |
Regression in nightly-2022-11-25 found 7 bors merge commits in the specified range |
Panic on invalid code. Bisected to #103693 Nightly version: 1.75.0-nightly Shorter #![feature(transmutability)]
pub fn is_maybe_transmutable<Dst>()
where
Dst: std::mem::BikeshedIntrinsicFrom<(), ()>,
{
}
fn should_pad_explicitly_aligned_field() {
#[repr(packed, align(0x100))]
#[repr(u8)]
enum V0u8 {
V,
}
is_maybe_transmutable::<V0u8>();
}
fn main() {} The key difference is that |
#117812 (comment) still ICEs 🥲 |
This no longer ICEs because we no longer accept this combination of attributes on an enum, which is covered by this testcase: rust/tests/ui/repr/attr-usage-repr.rs Lines 24 to 25 in 3678036
|
The current version looks more like: #![feature(transmutability)]
mod assert {
use std::mem::{Assume, TransmuteFrom};
pub struct Context;
pub fn is_maybe_transmutable<Src, Dst>()
where
Dst: TransmuteFrom<
Src,
{
Assume {
alignment: true,
validity: true,
lifetimes: true,
safety: true,
}
},
>,
{
}
}
fn should_pad_explicitly_aligned_field() {
#[repr(packed, u8)]
#[derive(Copy, Clone)]
enum V0u8 {
V = 0,
}
#[repr(C)]
pub union Uninit {
a: (),
b: V0u8,
}
#[repr(C)]
#[repr(C)]
struct ExplicitlyPadded(V0u8, Uninit, V0u8);
assert::is_maybe_transmutable::<(), ExplicitlyPadded>();
} |
auto-reduced (treereduce-rust):
original code
original:
Version information
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
The text was updated successfully, but these errors were encountered: