-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
debug ice: alignment mismatch between ABI and layout in TyAndLayout
#112433
Comments
cc @bryangarza |
I think the issue is that you can't have both Same error happens with just:
|
Packed is a modifier on repr(Rust) and repr(C), so it's intended that you use both: https://doc.rust-lang.org/nomicon/other-reprs.html#reprpacked |
Regardless, the code should not be ICEing no matter what invalid input is given by the user 😜 |
Oh I see now, yeah the ICE mentions @rustbot claim |
I need to print this and frame this above my desk :p |
@matthiaskrgr: of course, you should know the caveats to that, lol |
This just makes sure that the ICE in rust-lang#112433 doesn't regress.
@matthiaskrgr the ICE is gone in latest nightly, but I added a test anyways #113868 |
@bryangarza: Did you check this on a compiler with debug assertions enabled? If so, I'd also be curious to know when this was fixed and why, but I guess that also is difficult given that debug assertions are not enabled on nightly compiler releases. |
This still crashes with debug assertions enabled (built 1.5 days ago @ d351515 ) |
Ah, yeah I can replicate it with debug assertions. Will work on a fix. |
Okay, so here's what I know so far. This is the test: // check-fail
#![crate_type="lib"]
#![feature(transmutability)]
mod assert {
use std::mem::BikeshedIntrinsicFrom;
pub fn is_transmutable<Src, Dst, Context>()
where
Dst: BikeshedIntrinsicFrom<Src, Context>,
{
}
}
#[repr(C, packed(2))] //~ ERROR attribute should be applied to a struct or union
enum V0usize {
V,
}
fn nsize() {
fn u_should_have_correct_length() {
type Current = V0usize;
type Analog = V0usize;
type Context = V0usize;
assert::is_transmutable::<Current, Analog, Context>();
}
}
Because of this line in the test: assert::is_transmutable::<Current, Analog, Context>(); We are checking the layout here:
Which, goes through this check: rust/compiler/rustc_ty_utils/src/layout_sanity_check.rs Lines 23 to 26 in 9339f44
And then ICEs here: rust/compiler/rustc_ty_utils/src/layout_sanity_check.rs Lines 82 to 86 in 9339f44
I'm thinking that Safe Transmute should quit early because of the error on the enum (saying that rust/compiler/rustc_transmute/src/layout/tree.rs Lines 264 to 266 in 9339f44
So this is where I'm at -- I don't know if there is a way for Safe Transmute to know that it shouldn't continue because the enum itself has an error? If anyone has any pointers please let me know. Going to move on to some other work and if possible, come back to it later. |
Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: