]> git.lizzy.rs Git - rust.git/commitdiff
Update documentation tests
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Wed, 23 Sep 2020 16:55:27 +0000 (18:55 +0200)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Wed, 23 Sep 2020 16:55:27 +0000 (18:55 +0200)
compiler/rustc_session/src/lint/builtin.rs

index b39e01a009eb2bcb6f4d3bfbed81c73e610ca30c..8e1c843ae61341ecb7112f5997947306f8a0c4de 100644 (file)
     /// ```rust,compile_fail
     /// #![deny(nontrivial_structural_match)]
     ///
-    /// struct Plus(i32, i32);
-    /// const ONE_PLUS_TWO: &&Plus = &&Plus(1, 2);
-    ///
-    /// impl PartialEq for Plus {
-    ///     fn eq(&self, other: &Self) -> bool {
-    ///         self.0 + self.1 == other.0 + other.1
-    ///     }
-    /// }
-    ///
-    /// impl Eq for Plus {}
-    ///
+    /// #[derive(Copy, Clone, Debug)]
+    /// struct NoDerive(u32);
+    /// impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
+    /// impl Eq for NoDerive { }
     /// fn main() {
-    ///     if let ONE_PLUS_TWO = &&Plus(3, 0) {
-    ///         println!("semantic!");
-    ///     } else {
-    ///         println!("structural!");
-    ///     }
+    ///     const INDEX: Option<NoDerive> = [None, Some(NoDerive(10))][0];
+    ///     match None { Some(_) => panic!("whoops"), INDEX => dbg!(INDEX), };
     /// }
     /// ```
     ///