Skip to content

Commit 2a9d086

Browse files
authored
Unrolled build for rust-lang#138754
Rollup merge of rust-lang#138754 - oli-obk:push-vtqtnwluyxop, r=compiler-errors Handle spans of `~const`, `const` and `async` trait bounds in macro expansion r? `@compiler-errors` `visit_span` is actually only used in one place (the `transcribe::Marker`), and all of this syntax is unstable, so while it would still be nice to write a test for it, I wager there's lots more interesting things in `transcribe::Marker` to write tests for. And the worst is some diagnostics being weird or incremental being not as incremental as it could be
2 parents 5d85a71 + ff46ea8 commit 2a9d086

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

compiler/rustc_ast/src/mut_visit.rs

+22-1
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ pub trait MutVisitor: Sized {
238238
walk_ident(self, i);
239239
}
240240

241+
fn visit_modifiers(&mut self, m: &mut TraitBoundModifiers) {
242+
walk_modifiers(self, m);
243+
}
244+
241245
fn visit_path(&mut self, p: &mut Path) {
242246
walk_path(self, p);
243247
}
@@ -1156,12 +1160,29 @@ fn walk_trait_ref<T: MutVisitor>(vis: &mut T, TraitRef { path, ref_id }: &mut Tr
11561160
}
11571161

11581162
fn walk_poly_trait_ref<T: MutVisitor>(vis: &mut T, p: &mut PolyTraitRef) {
1159-
let PolyTraitRef { bound_generic_params, modifiers: _, trait_ref, span } = p;
1163+
let PolyTraitRef { bound_generic_params, modifiers, trait_ref, span } = p;
1164+
vis.visit_modifiers(modifiers);
11601165
bound_generic_params.flat_map_in_place(|param| vis.flat_map_generic_param(param));
11611166
vis.visit_trait_ref(trait_ref);
11621167
vis.visit_span(span);
11631168
}
11641169

1170+
fn walk_modifiers<V: MutVisitor>(vis: &mut V, m: &mut TraitBoundModifiers) {
1171+
let TraitBoundModifiers { constness, asyncness, polarity } = m;
1172+
match constness {
1173+
BoundConstness::Never => {}
1174+
BoundConstness::Always(span) | BoundConstness::Maybe(span) => vis.visit_span(span),
1175+
}
1176+
match asyncness {
1177+
BoundAsyncness::Normal => {}
1178+
BoundAsyncness::Async(span) => vis.visit_span(span),
1179+
}
1180+
match polarity {
1181+
BoundPolarity::Positive => {}
1182+
BoundPolarity::Negative(span) | BoundPolarity::Maybe(span) => vis.visit_span(span),
1183+
}
1184+
}
1185+
11651186
pub fn walk_field_def<T: MutVisitor>(visitor: &mut T, fd: &mut FieldDef) {
11661187
let FieldDef { span, ident, vis, id, ty, attrs, is_placeholder: _, safety, default } = fd;
11671188
visitor.visit_id(id);

0 commit comments

Comments
 (0)