mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Avoid a useless clone of UserTypeProjection
This commit is contained in:
parent
bf3bb5fd37
commit
a64efc72d0
@ -1516,8 +1516,8 @@ impl<'tcx> UserTypeProjections {
|
||||
self.contents.iter().map(|&(ref user_type, _span)| user_type)
|
||||
}
|
||||
|
||||
pub fn push_projection(mut self, user_ty: &UserTypeProjection, span: Span) -> Self {
|
||||
self.contents.push((user_ty.clone(), span));
|
||||
pub fn push_user_type(mut self, base_user_ty: UserTypeAnnotationIndex, span: Span) -> Self {
|
||||
self.contents.push((UserTypeProjection { base: base_user_ty, projs: vec![] }, span));
|
||||
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
|
||||
// of `user_ty` on any bindings contained with subpattern.
|
||||
|
||||
let projection = UserTypeProjection {
|
||||
base: self.canonical_user_type_annotations.push(annotation.clone()),
|
||||
projs: Vec::new(),
|
||||
};
|
||||
let base_user_ty = self.canonical_user_type_annotations.push(annotation.clone());
|
||||
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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user