-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Handle bindings in substructure of patterns with type ascriptions #55274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
26c4069
54681b0
36d8432
28ce99d
b569caf
740e8a3
7e76196
f09a0eb
92cbe47
47e2d82
82ab668
639a3ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,7 +147,7 @@ macro_rules! make_mir_visitor { | |
fn visit_ascribe_user_ty(&mut self, | ||
place: & $($mutability)* Place<'tcx>, | ||
variance: & $($mutability)* ty::Variance, | ||
user_ty: & $($mutability)* UserTypeAnnotation<'tcx>, | ||
user_ty: & $($mutability)* UserTypeProjection<'tcx>, | ||
location: Location) { | ||
self.super_ascribe_user_ty(place, variance, user_ty, location); | ||
} | ||
|
@@ -175,9 +175,8 @@ macro_rules! make_mir_visitor { | |
|
||
fn visit_projection_elem(&mut self, | ||
place: & $($mutability)* PlaceElem<'tcx>, | ||
context: PlaceContext<'tcx>, | ||
location: Location) { | ||
self.super_projection_elem(place, context, location); | ||
self.super_projection_elem(place, location); | ||
} | ||
|
||
fn visit_branch(&mut self, | ||
|
@@ -214,6 +213,13 @@ macro_rules! make_mir_visitor { | |
self.super_ty(ty); | ||
} | ||
|
||
fn visit_user_type_projection( | ||
&mut self, | ||
ty: & $($mutability)* UserTypeProjection<'tcx>, | ||
) { | ||
self.super_user_type_projection(ty); | ||
} | ||
|
||
fn visit_user_type_annotation( | ||
&mut self, | ||
ty: & $($mutability)* UserTypeAnnotation<'tcx>, | ||
|
@@ -640,10 +646,10 @@ macro_rules! make_mir_visitor { | |
fn super_ascribe_user_ty(&mut self, | ||
place: & $($mutability)* Place<'tcx>, | ||
_variance: & $($mutability)* ty::Variance, | ||
user_ty: & $($mutability)* UserTypeAnnotation<'tcx>, | ||
user_ty: & $($mutability)* UserTypeProjection<'tcx>, | ||
location: Location) { | ||
self.visit_place(place, PlaceContext::Validate, location); | ||
self.visit_user_type_annotation(user_ty); | ||
self.visit_user_type_projection(user_ty); | ||
} | ||
|
||
fn super_place(&mut self, | ||
|
@@ -692,12 +698,11 @@ macro_rules! make_mir_visitor { | |
PlaceContext::Projection(Mutability::Not) | ||
}; | ||
self.visit_place(base, context, location); | ||
self.visit_projection_elem(elem, context, location); | ||
self.visit_projection_elem(elem, location); | ||
} | ||
|
||
fn super_projection_elem(&mut self, | ||
proj: & $($mutability)* PlaceElem<'tcx>, | ||
_context: PlaceContext<'tcx>, | ||
location: Location) { | ||
match *proj { | ||
ProjectionElem::Deref => { | ||
|
@@ -738,8 +743,8 @@ macro_rules! make_mir_visitor { | |
local, | ||
source_info: *source_info, | ||
}); | ||
if let Some((user_ty, _)) = user_ty { | ||
self.visit_user_type_annotation(user_ty); | ||
for (user_ty, _) in & $($mutability)* user_ty.contents { | ||
self.visit_user_type_projection(user_ty); | ||
} | ||
self.visit_source_info(source_info); | ||
self.visit_source_scope(visibility_scope); | ||
|
@@ -786,6 +791,17 @@ macro_rules! make_mir_visitor { | |
self.visit_source_scope(scope); | ||
} | ||
|
||
fn super_user_type_projection( | ||
&mut self, | ||
ty: & $($mutability)* UserTypeProjection<'tcx>, | ||
) { | ||
let UserTypeProjection { | ||
ref $($mutability)* base, | ||
projs: _, // Note: Does not visit projection elems! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any particular reason for this? I guess just because nobody has any reason to. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, the existing MIR visit methods take a |
||
} = *ty; | ||
self.visit_user_type_annotation(base); | ||
} | ||
|
||
fn super_user_type_annotation( | ||
&mut self, | ||
_ty: & $($mutability)* UserTypeAnnotation<'tcx>, | ||
|
Uh oh!
There was an error while loading. Please reload this page.