Skip to content

Commit ffcfc5b

Browse files
committed
Remove P<> from visit_ty
1 parent 4f310b5 commit ffcfc5b

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

compiler/rustc_ast/src/mut_visit.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub trait MutVisitor: Sized {
174174
walk_generic_arg(self, arg);
175175
}
176176

177-
fn visit_ty(&mut self, t: &mut P<Ty>) {
177+
fn visit_ty(&mut self, t: &mut Ty) {
178178
walk_ty(self, t);
179179
}
180180

@@ -476,8 +476,8 @@ fn walk_assoc_item_constraint<T: MutVisitor>(
476476
vis.visit_span(span);
477477
}
478478

479-
pub fn walk_ty<T: MutVisitor>(vis: &mut T, ty: &mut P<Ty>) {
480-
let Ty { id, kind, span, tokens } = ty.deref_mut();
479+
pub fn walk_ty<T: MutVisitor>(vis: &mut T, ty: &mut Ty) {
480+
let Ty { id, kind, span, tokens } = ty;
481481
vis.visit_id(id);
482482
match kind {
483483
TyKind::Err(_guar) => {}

compiler/rustc_builtin_macros/src/deriving/smart_ptr.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use ast::HasAttrs;
2-
use ast::ptr::P;
32
use rustc_ast::mut_visit::MutVisitor;
43
use rustc_ast::visit::BoundKind;
54
use rustc_ast::{
@@ -373,11 +372,11 @@ struct TypeSubstitution<'a> {
373372
}
374373

375374
impl<'a> ast::mut_visit::MutVisitor for TypeSubstitution<'a> {
376-
fn visit_ty(&mut self, ty: &mut P<ast::Ty>) {
375+
fn visit_ty(&mut self, ty: &mut ast::Ty) {
377376
if let Some(name) = ty.kind.is_simple_path()
378377
&& name == self.from_name
379378
{
380-
**ty = self.to_ty.clone();
379+
*ty = self.to_ty.clone();
381380
self.rewritten = true;
382381
} else {
383382
ast::mut_visit::walk_ty(self, ty);

compiler/rustc_expand/src/expand.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -1586,14 +1586,14 @@ impl InvocationCollectorNode for ast::Crate {
15861586
}
15871587
}
15881588

1589-
impl InvocationCollectorNode for P<ast::Ty> {
1590-
type OutputTy = P<ast::Ty>;
1589+
impl InvocationCollectorNode for ast::Ty {
1590+
type OutputTy = ast::Ty;
15911591
const KIND: AstFragmentKind = AstFragmentKind::Ty;
15921592
fn to_annotatable(self) -> Annotatable {
15931593
unreachable!()
15941594
}
15951595
fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy {
1596-
fragment.make_ty()
1596+
fragment.make_ty().into_inner()
15971597
}
15981598
fn walk<V: MutVisitor>(&mut self, visitor: &mut V) {
15991599
walk_ty(visitor, self)
@@ -1602,8 +1602,7 @@ impl InvocationCollectorNode for P<ast::Ty> {
16021602
matches!(self.kind, ast::TyKind::MacCall(..))
16031603
}
16041604
fn take_mac_call(self) -> (P<ast::MacCall>, Self::AttrsTy, AddSemicolon) {
1605-
let node = self.into_inner();
1606-
match node.kind {
1605+
match self.kind {
16071606
TyKind::MacCall(mac) => (mac, AttrVec::new(), AddSemicolon::No),
16081607
_ => unreachable!(),
16091608
}
@@ -2168,7 +2167,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
21682167
self.visit_node(node)
21692168
}
21702169

2171-
fn visit_ty(&mut self, node: &mut P<ast::Ty>) {
2170+
fn visit_ty(&mut self, node: &mut ast::Ty) {
21722171
self.visit_node(node)
21732172
}
21742173

compiler/rustc_expand/src/placeholders.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,9 @@ impl MutVisitor for PlaceholderExpander {
374374
}
375375
}
376376

377-
fn visit_ty(&mut self, ty: &mut P<ast::Ty>) {
377+
fn visit_ty(&mut self, ty: &mut ast::Ty) {
378378
match ty.kind {
379-
ast::TyKind::MacCall(_) => *ty = self.remove(ty.id).make_ty(),
379+
ast::TyKind::MacCall(_) => *ty = self.remove(ty.id).make_ty().into_inner(),
380380
_ => walk_ty(self, ty),
381381
}
382382
}

0 commit comments

Comments
 (0)