Skip to content

Commit f7dcdcc

Browse files
committed
make matches exhaustive
1 parent ec61761 commit f7dcdcc

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/librustc/mir/mod.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -2462,11 +2462,15 @@ impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection {
24622462
let projs: Vec<_> = self
24632463
.projs
24642464
.iter()
2465-
.map(|elem| match elem {
2465+
.map(|&elem| match elem {
24662466
Deref => Deref,
2467-
Field(f, ()) => Field(*f, ()),
2467+
Field(f, ()) => Field(f, ()),
24682468
Index(()) => Index(()),
2469-
elem => *elem,
2469+
Downcast(symbol, variantidx) => Downcast(symbol, variantidx),
2470+
ConstantIndex { offset, min_length, from_end } => {
2471+
ConstantIndex { offset, min_length, from_end }
2472+
}
2473+
Subslice { from, to, from_end } => Subslice { from, to, from_end },
24702474
})
24712475
.collect();
24722476

@@ -2862,11 +2866,15 @@ impl<'tcx> TypeFoldable<'tcx> for PlaceElem<'tcx> {
28622866
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
28632867
use crate::mir::ProjectionElem::*;
28642868

2865-
match self {
2869+
match *self {
28662870
Deref => Deref,
2867-
Field(f, ty) => Field(*f, ty.fold_with(folder)),
2871+
Field(f, ty) => Field(f, ty.fold_with(folder)),
28682872
Index(v) => Index(v.fold_with(folder)),
2869-
elem => *elem,
2873+
Downcast(symbol, variantidx) => Downcast(symbol, variantidx),
2874+
ConstantIndex { offset, min_length, from_end } => {
2875+
ConstantIndex { offset, min_length, from_end }
2876+
}
2877+
Subslice { from, to, from_end } => Subslice { from, to, from_end },
28702878
}
28712879
}
28722880

0 commit comments

Comments
 (0)