Skip to content

Commit 6d58910

Browse files
authored
Rollup merge of #139909 - oli-obk:or-patterns, r=BoxyUwU
implement or-patterns for pattern types These are necessary to represent `NonZeroI32`, as the range for that is `..0 | 1..`. The `rustc_scalar_layout_range_*` attributes avoided this by just implementing wraparound and having a single `1..=-1` range effectively. See https://rust-lang.zulipchat.com/#narrow/channel/481660-t-lang.2Fpattern-types/topic/.60or.20pattern.60.20representation.20in.20type.20system/with/504217694 for some background discussion cc rust-lang/rust#123646 r? `@BoxyUwU`
2 parents d172204 + bca637c commit 6d58910

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clippy_utils/src/hir_utils.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,11 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
11171117
self.hash_const_arg(s);
11181118
self.hash_const_arg(e);
11191119
},
1120+
TyPatKind::Or(variants) => {
1121+
for variant in variants.iter() {
1122+
self.hash_ty_pat(variant)
1123+
}
1124+
},
11201125
TyPatKind::Err(_) => {},
11211126
}
11221127
}

0 commit comments

Comments
 (0)