Skip to content

Commit 3fc26cd

Browse files
committed
Remove P<> from visit_expr
1 parent 9652937 commit 3fc26cd

File tree

6 files changed

+13
-15
lines changed

6 files changed

+13
-15
lines changed

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub trait MutVisitor: Sized {
156156
walk_anon_const(self, c);
157157
}
158158

159-
fn visit_expr(&mut self, e: &mut P<Expr>) {
159+
fn visit_expr(&mut self, e: &mut Expr) {
160160
walk_expr(self, e);
161161
}
162162

compiler/rustc_builtin_macros/src/cfg_eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ impl CfgEval<'_> {
209209

210210
impl MutVisitor for CfgEval<'_> {
211211
#[instrument(level = "trace", skip(self))]
212-
fn visit_expr(&mut self, expr: &mut P<ast::Expr>) {
212+
fn visit_expr(&mut self, expr: &mut ast::Expr) {
213213
self.0.configure_expr(expr, false);
214214
mut_visit::walk_expr(self, expr);
215215
}

compiler/rustc_expand/src/config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Conditional compilation stripping.
22
3-
use rustc_ast::ptr::P;
43
use rustc_ast::token::{Delimiter, Token, TokenKind};
54
use rustc_ast::tokenstream::{
65
AttrTokenStream, AttrTokenTree, LazyAttrTokenStream, Spacing, TokenTree,
@@ -419,7 +418,7 @@ impl<'a> StripUnconfigured<'a> {
419418
}
420419

421420
#[instrument(level = "trace", skip(self))]
422-
pub fn configure_expr(&self, expr: &mut P<ast::Expr>, method_receiver: bool) {
421+
pub fn configure_expr(&self, expr: &mut ast::Expr, method_receiver: bool) {
423422
if !method_receiver {
424423
for attr in expr.attrs.iter() {
425424
self.maybe_emit_expr_attr_err(attr);

compiler/rustc_expand/src/expand.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,15 +1634,15 @@ impl InvocationCollectorNode for P<ast::Pat> {
16341634
}
16351635
}
16361636

1637-
impl InvocationCollectorNode for P<ast::Expr> {
1638-
type OutputTy = P<ast::Expr>;
1637+
impl InvocationCollectorNode for ast::Expr {
1638+
type OutputTy = ast::Expr;
16391639
type AttrsTy = ast::AttrVec;
16401640
const KIND: AstFragmentKind = AstFragmentKind::Expr;
16411641
fn to_annotatable(self) -> Annotatable {
1642-
Annotatable::Expr(self)
1642+
Annotatable::Expr(P(self))
16431643
}
16441644
fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy {
1645-
fragment.make_expr()
1645+
fragment.make_expr().into_inner()
16461646
}
16471647
fn descr() -> &'static str {
16481648
"an expression"
@@ -1654,9 +1654,8 @@ impl InvocationCollectorNode for P<ast::Expr> {
16541654
matches!(self.kind, ExprKind::MacCall(..))
16551655
}
16561656
fn take_mac_call(self) -> (P<ast::MacCall>, Self::AttrsTy, AddSemicolon) {
1657-
let node = self.into_inner();
1658-
match node.kind {
1659-
ExprKind::MacCall(mac) => (mac, node.attrs, AddSemicolon::No),
1657+
match self.kind {
1658+
ExprKind::MacCall(mac) => (mac, self.attrs, AddSemicolon::No),
16601659
_ => unreachable!(),
16611660
}
16621661
}
@@ -2178,7 +2177,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
21782177
self.visit_node(node)
21792178
}
21802179

2181-
fn visit_expr(&mut self, node: &mut P<ast::Expr>) {
2180+
fn visit_expr(&mut self, node: &mut ast::Expr) {
21822181
// FIXME: Feature gating is performed inconsistently between `Expr` and `OptExpr`.
21832182
if let Some(attr) = node.attrs.first() {
21842183
self.cfg().maybe_emit_expr_attr_err(attr);

compiler/rustc_expand/src/placeholders.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,9 @@ impl MutVisitor for PlaceholderExpander {
300300
}
301301
}
302302

303-
fn visit_expr(&mut self, expr: &mut P<ast::Expr>) {
303+
fn visit_expr(&mut self, expr: &mut ast::Expr) {
304304
match expr.kind {
305-
ast::ExprKind::MacCall(_) => *expr = self.remove(expr.id).make_expr(),
305+
ast::ExprKind::MacCall(_) => *expr = self.remove(expr.id).make_expr().into_inner(),
306306
_ => walk_expr(self, expr),
307307
}
308308
}

compiler/rustc_parse/src/parser/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3927,7 +3927,7 @@ impl<'a> CondChecker<'a> {
39273927
}
39283928

39293929
impl MutVisitor for CondChecker<'_> {
3930-
fn visit_expr(&mut self, e: &mut P<Expr>) {
3930+
fn visit_expr(&mut self, e: &mut Expr) {
39313931
use ForbiddenLetReason::*;
39323932

39333933
let span = e.span;

0 commit comments

Comments
 (0)