summaryrefslogtreecommitdiffstats
path: root/src/doc/reference/src/unsafety.md
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/doc/reference/src/unsafety.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/doc/reference/src/unsafety.md b/src/doc/reference/src/unsafety.md
new file mode 100644
index 000000000..915fa5b03
--- /dev/null
+++ b/src/doc/reference/src/unsafety.md
@@ -0,0 +1,19 @@
+# Unsafety
+
+Unsafe operations are those that can potentially violate the memory-safety
+guarantees of Rust's static semantics.
+
+The following language level features cannot be used in the safe subset of
+Rust:
+
+- Dereferencing a [raw pointer].
+- Reading or writing a [mutable] or [external] static variable.
+- Accessing a field of a [`union`], other than to assign to it.
+- Calling an unsafe function (including an intrinsic or foreign function).
+- Implementing an [unsafe trait].
+
+[`union`]: items/unions.md
+[mutable]: items/static-items.md#mutable-statics
+[external]: items/external-blocks.md
+[raw pointer]: types/pointer.md
+[unsafe trait]: items/traits.md#unsafe-traits