]> git.lizzy.rs Git - rust.git/commit
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)
commit442f997f98ac9f16f60ba3a7109f884dbf8d370c
tree644e0d2b3c45e2e04c5071831e540038bc11e443
parent481c9bad80754670197cf28d8c6d43825d4404f0
parente7cad62257e5b0d59ca18515a522e90924177330
Auto merge of #106371 - RalfJung:no-ret-position-noalias, r=nikic

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).