File tree Expand file tree Collapse file tree 1 file changed +6
-16
lines changed
compiler/rustc_session/src/lint Expand file tree Collapse file tree 1 file changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -2239,23 +2239,13 @@ declare_lint! {
2239
2239
/// ```rust,compile_fail
2240
2240
/// #![deny(nontrivial_structural_match)]
2241
2241
///
2242
- /// struct Plus(i32, i32);
2243
- /// const ONE_PLUS_TWO: &&Plus = &&Plus(1, 2);
2244
- ///
2245
- /// impl PartialEq for Plus {
2246
- /// fn eq(&self, other: &Self) -> bool {
2247
- /// self.0 + self.1 == other.0 + other.1
2248
- /// }
2249
- /// }
2250
- ///
2251
- /// impl Eq for Plus {}
2252
- ///
2242
+ /// #[derive(Copy, Clone, Debug)]
2243
+ /// struct NoDerive(u32);
2244
+ /// impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
2245
+ /// impl Eq for NoDerive { }
2253
2246
/// fn main() {
2254
- /// if let ONE_PLUS_TWO = &&Plus(3, 0) {
2255
- /// println!("semantic!");
2256
- /// } else {
2257
- /// println!("structural!");
2258
- /// }
2247
+ /// const INDEX: Option<NoDerive> = [None, Some(NoDerive(10))][0];
2248
+ /// match None { Some(_) => panic!("whoops"), INDEX => dbg!(INDEX), };
2259
2249
/// }
2260
2250
/// ```
2261
2251
///
You can’t perform that action at this time.
0 commit comments