-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Expressions in block tail supposed to outlive block variables dropped early. #33490
Comments
Updated to reflect that borrowck enforces the semantics we want to support, even though old trans doesn't respect them. |
@eddyb is the remaining bug here just that old trans does it wrong? |
@nikomatsakis Correct, as everyone seems to agree that while the scoping semantics regionck/borrowck enforce may appear strange, they're intended. |
Then since old trans doesn't exist anymore, should this be closed? |
Indeed. |
There is a FIXME related to this issue, |
@Eh2406 Looks like the braces can be removed now. |
rust-lang#33490 is closed remove the FIXME let's see if this can be cleaned up. rust-lang#33490 (comment)
rust-lang#33490 is closed remove the FIXME let's see if this can be cleaned up. rust-lang#33490 (comment)
Found while investigating the remaining wrong case in #32433. Effectively use-after-free.
Can be used to cause a segmentation fault (check out on playpen):
The
Fine
pointee drops before theEvil
holding of the pointer, and in between those the destructor ofDirty
overwrites the same heap location of the deallocatedBox<Vec<i32>>
with a different 3-usize
Box
, causing a segmentation fault on Debug mode and garbage to be printed on Release mode.EDIT: Works fine even with old trans if there is any sort of block nesting (i.e. only the outermost block of a function has the broken behavior) - check out on playpen.
cc @rust-lang/compiler @rust-lang/lang
The text was updated successfully, but these errors were encountered: