-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rustc_trans: don't apply noalias on returned references. #46253
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
57fe4d3
to
5eed95e
Compare
@bors r+ |
📌 Commit 5eed95e has been approved by |
rustc_trans: don't apply noalias on returned references. In #45225 frozen returned `&T` were accidentally maked `noalias`, unlike `&mut T`. Return value `noalias` is only sound for functions that return dynamic allocations, e.g. `Box`, and using it on anything else can lead to miscompilation, as LLVM assumes certain usage patterns. Fixes #46239.
☀️ Test successful - status-appveyor, status-travis |
As per the IRC discussion with @eddyb on Friday, I'll tentatively mark this as beta-accepted. @rust-lang/compiler, please veto within the next 15 hours if you don't think this is a good idea. I'll do the backport tomorrow. |
In #45225 frozen returned
&T
were accidentally makednoalias
, unlike&mut T
.Return value
noalias
is only sound for functions that return dynamic allocations, e.g.Box
, and using it on anything else can lead to miscompilation, as LLVM assumes certain usage patterns.Fixes #46239.