Skip to content

Commit

Permalink
make matches exhaustive
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Jan 27, 2020
1 parent ec61761 commit f7dcdcc
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2462,11 +2462,15 @@ impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection {
let projs: Vec<_> = self
.projs
.iter()
.map(|elem| match elem {
.map(|&elem| match elem {
Deref => Deref,
Field(f, ()) => Field(*f, ()),
Field(f, ()) => Field(f, ()),
Index(()) => Index(()),
elem => *elem,
Downcast(symbol, variantidx) => Downcast(symbol, variantidx),
ConstantIndex { offset, min_length, from_end } => {
ConstantIndex { offset, min_length, from_end }
}
Subslice { from, to, from_end } => Subslice { from, to, from_end },
})
.collect();

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

match self {
match *self {
Deref => Deref,
Field(f, ty) => Field(*f, ty.fold_with(folder)),
Field(f, ty) => Field(f, ty.fold_with(folder)),
Index(v) => Index(v.fold_with(folder)),
elem => *elem,
Downcast(symbol, variantidx) => Downcast(symbol, variantidx),
ConstantIndex { offset, min_length, from_end } => {
ConstantIndex { offset, min_length, from_end }
}
Subslice { from, to, from_end } => Subslice { from, to, from_end },
}
}

Expand Down

0 comments on commit f7dcdcc

Please sign in to comment.