about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-03-04 18:41:43 +0100
committerMara Bos <m-ou.se@m-ou.se>2021-03-04 18:41:43 +0100
commit5bd1204fc2a3147d425bc98fc0fefb00c6b4702d (patch)
tree23dd4c31ff1fc3f2fc5e1f7d50cda877f77d5a69
parent0a8e401188062f0c60c989978352663b1e25e70e (diff)
downloadrust-5bd1204fc2a3147d425bc98fc0fefb00c6b4702d.tar.gz
rust-5bd1204fc2a3147d425bc98fc0fefb00c6b4702d.zip
Fix assert_matches doc examples.
-rw-r--r--library/core/src/macros/mod.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index 1d41d7f64bb..b0b35c6915f 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -124,13 +124,15 @@ macro_rules! assert_ne {
 /// # Examples
 ///
 /// ```
+/// #![feature(assert_matches)]
+///
 /// let a = 1u32.checked_add(2);
 /// let b = 1u32.checked_sub(2);
 /// assert_matches!(a, Some(_));
 /// assert_matches!(b, None);
 ///
 /// let c = Ok("abc".to_string());
-/// assert_matches!(a, Ok(x) | Err(x) if x.len() < 100);
+/// assert_matches!(c, Ok(x) | Err(x) if x.len() < 100);
 /// ```
 #[macro_export]
 #[unstable(feature = "assert_matches", issue = "none")]
@@ -279,13 +281,15 @@ macro_rules! debug_assert_ne {
 /// # Examples
 ///
 /// ```
+/// #![feature(assert_matches)]
+///
 /// let a = 1u32.checked_add(2);
 /// let b = 1u32.checked_sub(2);
 /// debug_assert_matches!(a, Some(_));
 /// debug_assert_matches!(b, None);
 ///
 /// let c = Ok("abc".to_string());
-/// debug_assert_matches!(a, Ok(x) | Err(x) if x.len() < 100);
+/// debug_assert_matches!(c, Ok(x) | Err(x) if x.len() < 100);
 /// ```
 #[macro_export]
 #[unstable(feature = "assert_matches", issue = "none")]