-
Notifications
You must be signed in to change notification settings - Fork 13.4k
rustc_trans: don't apply noalias on returned references. #46253
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
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.