]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #106371 - RalfJung:no-ret-position-noalias, r=nikic
authorbors <bors@rust-lang.org>
Tue, 3 Jan 2023 04:54:03 +0000 (04:54 +0000)
committerbors <bors@rust-lang.org>
Tue, 3 Jan 2023 04:54:03 +0000 (04:54 +0000)
do not add noalias in return position

`noalias` as a return attribute in LLVM indicates that the returned pointer does not alias anything else that is reachable from the caller, *including things reachable before this function call*. This is clearly not the case with a function like `fn id(Box<T>) -> Box<T>`, so we cannot use this attribute.

Fixes https://github.com/rust-lang/unsafe-code-guidelines/issues/385 (including an actual miscompilation that `@comex` managed to produce).


Trivial merge