-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
add back noalias
to &mut T
pointer parameters
#13935
Conversation
This was removed because these could alias with `&const T` or `@mut T` and those are now gone from the language. There are still aliasing issues within local scopes, but this is correct for function parameters. This also removes the no-op `noalias` marker on proc (not a pointer) and leaves out the mention of #6750 because real type-based alias analysis is not within the scope of best effort usage of the `noalias` attribute. Test case: pub fn foo(x: &mut &mut u32) { **x = 5; **x = 5; } Before: define void @_ZN3foo20h0ce94c9671b0150bdaa4v0.0E(i32** nocapture readonly) unnamed_addr #0 { entry-block: %1 = load i32** %0, align 8 store i32 5, i32* %1, align 4 %2 = load i32** %0, align 8 store i32 5, i32* %2, align 4 ret void } After: define void @_ZN3foo20h0ce94c9671b0150bdaa4v0.0E(i32** noalias nocapture readonly) unnamed_addr #0 { entry-block: %1 = load i32** %0, align 8 store i32 5, i32* %1, align 4 ret void } Closes #12436
Can't |
It can't alias in safe code or valid |
This was removed because these could alias with `&const T` or `@mut T` and those are now gone from the language. There are still aliasing issues within local scopes, but this is correct for function parameters. This also removes the no-op `noalias` marker on proc (not a pointer) and leaves out the mention of #6750 because real type-based alias analysis is not within the scope of best effort usage of the `noalias` attribute. Test case: pub fn foo(x: &mut &mut u32) { **x = 5; **x = 5; } Before: define void @_ZN3foo20h0ce94c9671b0150bdaa4v0.0E(i32** nocapture readonly) unnamed_addr #0 { entry-block: %1 = load i32** %0, align 8 store i32 5, i32* %1, align 4 %2 = load i32** %0, align 8 store i32 5, i32* %2, align 4 ret void } After: define void @_ZN3foo20h0ce94c9671b0150bdaa4v0.0E(i32** noalias nocapture readonly) unnamed_addr #0 { entry-block: %1 = load i32** %0, align 8 store i32 5, i32* %1, align 4 ret void } Closes #12436
I am not sure if I agree (nor sure if I disagree...) regarding potential aliasing of |
…=Veykril Assist: desugar doc-comment My need for this arose due to wanting to do feature dependent documentation and therefor convert parts of my doc-comments to attributes. Not sure about the pub-making of the other handlers functions, but I didn't think it made much sense to reimplement them.
Some of the links are wrong since lead to non existing docs so fix them changelog: none
This was removed because these could alias with
&const T
or@mut T
and those are now gone from the language. There are still aliasing
issues within local scopes, but this is correct for function parameters.
This also removes the no-op
noalias
marker on proc (not a pointer) andleaves out the mention of #6750 because real type-based alias analysis
is not within the scope of best effort usage of the
noalias
attribute.Test case:
Before:
After:
Closes #12436