Handle spans of ~const
, const
and async
trait bounds in macro expansion
This commit is contained in:
parent
87e60a7d28
commit
ff46ea8253
1 changed files with 22 additions and 1 deletions
|
@ -238,6 +238,10 @@ pub trait MutVisitor: Sized {
|
||||||
walk_ident(self, i);
|
walk_ident(self, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn visit_modifiers(&mut self, m: &mut TraitBoundModifiers) {
|
||||||
|
walk_modifiers(self, m);
|
||||||
|
}
|
||||||
|
|
||||||
fn visit_path(&mut self, p: &mut Path) {
|
fn visit_path(&mut self, p: &mut Path) {
|
||||||
walk_path(self, p);
|
walk_path(self, p);
|
||||||
}
|
}
|
||||||
|
@ -1156,12 +1160,29 @@ fn walk_trait_ref<T: MutVisitor>(vis: &mut T, TraitRef { path, ref_id }: &mut Tr
|
||||||
}
|
}
|
||||||
|
|
||||||
fn walk_poly_trait_ref<T: MutVisitor>(vis: &mut T, p: &mut PolyTraitRef) {
|
fn walk_poly_trait_ref<T: MutVisitor>(vis: &mut T, p: &mut PolyTraitRef) {
|
||||||
let PolyTraitRef { bound_generic_params, modifiers: _, trait_ref, span } = p;
|
let PolyTraitRef { bound_generic_params, modifiers, trait_ref, span } = p;
|
||||||
|
vis.visit_modifiers(modifiers);
|
||||||
bound_generic_params.flat_map_in_place(|param| vis.flat_map_generic_param(param));
|
bound_generic_params.flat_map_in_place(|param| vis.flat_map_generic_param(param));
|
||||||
vis.visit_trait_ref(trait_ref);
|
vis.visit_trait_ref(trait_ref);
|
||||||
vis.visit_span(span);
|
vis.visit_span(span);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn walk_modifiers<V: MutVisitor>(vis: &mut V, m: &mut TraitBoundModifiers) {
|
||||||
|
let TraitBoundModifiers { constness, asyncness, polarity } = m;
|
||||||
|
match constness {
|
||||||
|
BoundConstness::Never => {}
|
||||||
|
BoundConstness::Always(span) | BoundConstness::Maybe(span) => vis.visit_span(span),
|
||||||
|
}
|
||||||
|
match asyncness {
|
||||||
|
BoundAsyncness::Normal => {}
|
||||||
|
BoundAsyncness::Async(span) => vis.visit_span(span),
|
||||||
|
}
|
||||||
|
match polarity {
|
||||||
|
BoundPolarity::Positive => {}
|
||||||
|
BoundPolarity::Negative(span) | BoundPolarity::Maybe(span) => vis.visit_span(span),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn walk_field_def<T: MutVisitor>(visitor: &mut T, fd: &mut FieldDef) {
|
pub fn walk_field_def<T: MutVisitor>(visitor: &mut T, fd: &mut FieldDef) {
|
||||||
let FieldDef { span, ident, vis, id, ty, attrs, is_placeholder: _, safety, default } = fd;
|
let FieldDef { span, ident, vis, id, ty, attrs, is_placeholder: _, safety, default } = fd;
|
||||||
visitor.visit_id(id);
|
visitor.visit_id(id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue