Avoid a useless clone of UserTypeProjection
This commit is contained in:
parent
bf3bb5fd37
commit
a64efc72d0
2 changed files with 4 additions and 7 deletions
|
@ -1516,8 +1516,8 @@ impl<'tcx> UserTypeProjections {
|
||||||
self.contents.iter().map(|&(ref user_type, _span)| user_type)
|
self.contents.iter().map(|&(ref user_type, _span)| user_type)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn push_projection(mut self, user_ty: &UserTypeProjection, span: Span) -> Self {
|
pub fn push_user_type(mut self, base_user_ty: UserTypeAnnotationIndex, span: Span) -> Self {
|
||||||
self.contents.push((user_ty.clone(), span));
|
self.contents.push((UserTypeProjection { base: base_user_ty, projs: vec![] }, span));
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -926,12 +926,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
// Note that the variance doesn't apply here, as we are tracking the effect
|
// Note that the variance doesn't apply here, as we are tracking the effect
|
||||||
// of `user_ty` on any bindings contained with subpattern.
|
// of `user_ty` on any bindings contained with subpattern.
|
||||||
|
|
||||||
let projection = UserTypeProjection {
|
let base_user_ty = self.canonical_user_type_annotations.push(annotation.clone());
|
||||||
base: self.canonical_user_type_annotations.push(annotation.clone()),
|
|
||||||
projs: Vec::new(),
|
|
||||||
};
|
|
||||||
let subpattern_user_ty =
|
let subpattern_user_ty =
|
||||||
pattern_user_ty.push_projection(&projection, annotation.span);
|
pattern_user_ty.push_user_type(base_user_ty, annotation.span);
|
||||||
self.visit_primary_bindings(subpattern, subpattern_user_ty, f)
|
self.visit_primary_bindings(subpattern, subpattern_user_ty, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue