Skip to content

Commit 6e11a8b

Browse files
committed
expand: Remove redundant calls to configure
Starting from rust-lang#63468 cfg attributes on variants, fields, fn params etc. are processed together with other attributes (via `configure!`).
1 parent 18c94b3 commit 6e11a8b

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

compiler/rustc_expand/src/expand.rs

+3-21
Original file line numberDiff line numberDiff line change
@@ -1067,8 +1067,6 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
10671067
fn visit_expr(&mut self, expr: &mut P<ast::Expr>) {
10681068
self.cfg.configure_expr(expr);
10691069
visit_clobber(expr.deref_mut(), |mut expr| {
1070-
self.cfg.configure_expr_kind(&mut expr.kind);
1071-
10721070
if let Some(attr) = self.take_first_attr(&mut expr) {
10731071
// Collect the invoc regardless of whether or not attributes are permitted here
10741072
// expansion will eat the attribute so it won't error later.
@@ -1166,8 +1164,6 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
11661164
fn filter_map_expr(&mut self, expr: P<ast::Expr>) -> Option<P<ast::Expr>> {
11671165
let expr = configure!(self, expr);
11681166
expr.filter_map(|mut expr| {
1169-
self.cfg.configure_expr_kind(&mut expr.kind);
1170-
11711167
if let Some(attr) = self.take_first_attr(&mut expr) {
11721168
self.cfg.maybe_emit_expr_attr_err(&attr.0);
11731169

@@ -1192,7 +1188,6 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
11921188
}
11931189

11941190
fn visit_pat(&mut self, pat: &mut P<ast::Pat>) {
1195-
self.cfg.configure_pat(pat);
11961191
match pat.kind {
11971192
PatKind::MacCall(_) => {}
11981193
_ => return noop_visit_pat(pat, self),
@@ -1406,15 +1401,12 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
14061401
});
14071402
}
14081403

1409-
fn visit_foreign_mod(&mut self, foreign_mod: &mut ast::ForeignMod) {
1410-
self.cfg.configure_foreign_mod(foreign_mod);
1411-
noop_visit_foreign_mod(foreign_mod, self);
1412-
}
1413-
14141404
fn flat_map_foreign_item(
14151405
&mut self,
1416-
mut foreign_item: P<ast::ForeignItem>,
1406+
foreign_item: P<ast::ForeignItem>,
14171407
) -> SmallVec<[P<ast::ForeignItem>; 1]> {
1408+
let mut foreign_item = configure!(self, foreign_item);
1409+
14181410
if let Some(attr) = self.take_first_attr(&mut foreign_item) {
14191411
return self
14201412
.collect_attr(
@@ -1439,11 +1431,6 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
14391431
}
14401432
}
14411433

1442-
fn visit_item_kind(&mut self, item: &mut ast::ItemKind) {
1443-
self.cfg.configure_item_kind(item);
1444-
noop_visit_item_kind(item, self);
1445-
}
1446-
14471434
fn flat_map_generic_param(
14481435
&mut self,
14491436
param: ast::GenericParam,
@@ -1602,11 +1589,6 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
16021589
*id = self.cx.resolver.next_node_id()
16031590
}
16041591
}
1605-
1606-
fn visit_fn_decl(&mut self, mut fn_decl: &mut P<ast::FnDecl>) {
1607-
self.cfg.configure_fn_decl(&mut fn_decl);
1608-
noop_visit_fn_decl(fn_decl, self);
1609-
}
16101592
}
16111593

16121594
pub struct ExpansionConfig<'feat> {

0 commit comments

Comments
 (0)