Skip to content

Commit 6c0314a

Browse files
committed
Make note of noalias in unsafe reference section
Fixes #19733
1 parent 242ed0b commit 6c0314a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/doc/reference.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1231,12 +1231,15 @@ the guarantee that these issues are never caused by safe code.
12311231

12321232
* Data races
12331233
* Dereferencing a null/dangling raw pointer
1234-
* Mutating an immutable value/reference without `UnsafeCell`
12351234
* Reads of [undef](http://llvm.org/docs/LangRef.html#undefined-values)
12361235
(uninitialized) memory
12371236
* Breaking the [pointer aliasing
12381237
rules](http://llvm.org/docs/LangRef.html#pointer-aliasing-rules)
12391238
with raw pointers (a subset of the rules used by C)
1239+
* `&mut` and `&` follow LLVM’s scoped [noalias] model, except if the `&T`
1240+
contains an `UnsafeCell<U>`. Unsafe code must not violate these aliasing
1241+
guarantees.
1242+
* Mutating an immutable value/reference without `UnsafeCell<U>`
12401243
* Invoking undefined behavior via compiler intrinsics:
12411244
* Indexing outside of the bounds of an object with `std::ptr::offset`
12421245
(`offset` intrinsic), with
@@ -1253,6 +1256,8 @@ the guarantee that these issues are never caused by safe code.
12531256
code. Rust's failure system is not compatible with exception handling in
12541257
other languages. Unwinding must be caught and handled at FFI boundaries.
12551258

1259+
[noalias]: http://llvm.org/docs/LangRef.html#noalias
1260+
12561261
##### Behaviour not considered unsafe
12571262

12581263
This is a list of behaviour not considered *unsafe* in Rust terms, but that may

0 commit comments

Comments
 (0)