add back noalias to &mut T pointer parameters#13935
Merged
bors merged 1 commit intorust-lang:masterfrom May 5, 2014
thestinger:noalias
Merged
add back noalias to &mut T pointer parameters#13935bors merged 1 commit intorust-lang:masterfrom thestinger:noalias
noalias to &mut T pointer parameters#13935bors merged 1 commit intorust-lang:masterfrom
thestinger:noalias
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
Member
|
Can't |
Contributor
Author
|
It can't alias in safe code or valid |
Contributor
Author
bors
added a commit
that referenced
this pull request
May 5, 2014
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
Contributor
|
I am not sure if I agree (nor sure if I disagree...) regarding potential aliasing of |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 13, 2023
…=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.
bors
pushed a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 28, 2025
Some of the links are wrong since lead to non existing docs so fix them changelog: none
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was removed because these could alias with
&const Tor@mut Tand 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
noaliasmarker 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
noaliasattribute.Test case:
Before:
After:
Closes #12436