about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMiguel Ojeda <ojeda@kernel.org>2021-01-25 14:53:19 +0100
committerMiguel Ojeda <ojeda@kernel.org>2021-01-25 14:53:19 +0100
commit0140dacabbc6b5a33f19f88c22b531f318ef8f37 (patch)
treea77dd2d4446c8215db3402dffc90d0bdde29c629
parent76299b3f42a402aa896b76fccd725f52080f374d (diff)
downloadrust-0140dacabbc6b5a33f19f88c22b531f318ef8f37.tar.gz
rust-0140dacabbc6b5a33f19f88c22b531f318ef8f37.zip
Link the reference about undefined behavior
Suggested-by: Mara Bos <m-ou.se@m-ou.se>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
-rw-r--r--library/core/src/option.rs4
-rw-r--r--library/core/src/result.rs8
2 files changed, 9 insertions, 3 deletions
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index 5d34f5ca155..9f89bfd674a 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -433,7 +433,9 @@ impl<T> Option<T> {
     ///
     /// # Safety
     ///
-    /// Undefined behavior if the value is [`None`].
+    /// Calling this method on [`None`] is *[undefined behavior]*.
+    ///
+    /// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
     ///
     /// # Examples
     ///
diff --git a/library/core/src/result.rs b/library/core/src/result.rs
index a357750b92f..436f4bf20c7 100644
--- a/library/core/src/result.rs
+++ b/library/core/src/result.rs
@@ -827,7 +827,9 @@ impl<T, E> Result<T, E> {
     ///
     /// # Safety
     ///
-    /// Undefined behavior if the value is an [`Err`].
+    /// Calling this method on an [`Err`] is *[undefined behavior]*.
+    ///
+    /// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
     ///
     /// # Examples
     ///
@@ -859,7 +861,9 @@ impl<T, E> Result<T, E> {
     ///
     /// # Safety
     ///
-    /// Undefined behavior if the value is an [`Ok`].
+    /// Calling this method on an [`Ok`] is *[undefined behavior]*.
+    ///
+    /// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
     ///
     /// # Examples
     ///