-
Notifications
You must be signed in to change notification settings - Fork 288
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
Fix issue with field retagging in scopeguard #359
Conversation
851f13a
to
4f3f617
Compare
Huh, what happened on |
4f3f617
to
a54ecb4
Compare
I think this is a recent (last few days) regression in rustc. I'm looking into it. |
By the way, this code is taken straight from the scopeguard crate. It would make sense to submit a fix there too. |
I've tried to reproduce the fault locally in a cursed Wine in WSL2 environment but the tests passed for me. |
84966c3
to
a54ecb4
Compare
Yep, it even fails without my diff, so there's something wrong. |
scopeguard has received quite some changes around adding |
With field retagging in SB, this causes UB because the read out value is invalidated by the move into `mem::forget`. Using `ManuallyDrop<T>` avoids the problem.
Now that the bug is fixed, this can be enabled. Field retagging is required to justify some of the `noalias` optimizations that rustc performs currently.
a54ecb4
to
1f751c6
Compare
Bisecting points to rust-lang/rust@9208625, I suspect the root cause might be rust-lang/rust#101325. |
@bors r+ |
☀️ Test successful - checks-actions |
@Amanieu any chance of a release that includes this patch? We're considering enabling field retagging by default (since it matches the LLVM IR that rustc generates, Cc rust-lang/miri#2528), but I'd like to avoid breaking hashbrown in Miri. |
Published hashbrown 0.13.1. |
With field retagging in SB, this causes UB because the read out value is invalidated by the move into
mem::forget
. UsingManuallyDrop<T>
avoids the problem. With that issue fixed, we can now enable field retagging in CI. Field retagging is required to justify some of thenoalias
optimizations that rustcperforms currently.
Miri error