1
Fork 0
This commit is contained in:
lcnr 2020-10-24 09:27:15 +02:00 committed by Bastian Kauschke
parent 80acfea5a7
commit a6cbd64dae
19 changed files with 87 additions and 105 deletions

View file

@ -742,7 +742,7 @@ pub enum ImplicitSelfKind {
None,
}
CloneTypeFoldableAndLiftImpls! { BindingForm<'tcx>, }
TrivialTypeFoldableAndLiftImpls! { BindingForm<'tcx>, }
mod binding_form_impl {
use crate::ich::StableHashingContext;
@ -2452,29 +2452,14 @@ impl UserTypeProjection {
}
}
CloneTypeFoldableAndLiftImpls! { ProjectionKind, }
TrivialTypeFoldableAndLiftImpls! { ProjectionKind, }
impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection {
fn super_fold_with<F: TypeFolder<'tcx>>(self, folder: &mut F) -> Self {
use crate::mir::ProjectionElem::*;
let base = self.base.fold_with(folder);
let projs: Vec<_> = self
.projs
.iter()
.map(|&elem| match elem {
Deref => Deref,
Field(f, ()) => Field(f, ()),
Index(()) => Index(()),
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();
UserTypeProjection { base, projs }
UserTypeProjection {
base: self.base.fold_with(folder),
projs: self.projs.fold_with(folder),
}
}
fn super_visit_with<Vs: TypeVisitor<'tcx>>(&self, visitor: &mut Vs) -> ControlFlow<()> {