Rollup merge of #142371 - fee1-dead-contrib:push-xqlkumzurkus, r=petrochenkov
avoid `&mut P<T>` in `visit_expr` etc methods trying a different way than rust-lang/rust#141636 r? ghost
This commit is contained in:
@@ -710,6 +710,12 @@ impl Pat {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<P<Pat>> for Pat {
|
||||
fn from(value: P<Pat>) -> Self {
|
||||
*value
|
||||
}
|
||||
}
|
||||
|
||||
/// A single field in a struct pattern.
|
||||
///
|
||||
/// Patterns like the fields of `Foo { x, ref y, ref mut z }`
|
||||
@@ -1553,17 +1559,23 @@ impl Expr {
|
||||
)
|
||||
}
|
||||
|
||||
/// Creates a dummy `P<Expr>`.
|
||||
/// Creates a dummy `Expr`.
|
||||
///
|
||||
/// Should only be used when it will be replaced afterwards or as a return value when an error was encountered.
|
||||
pub fn dummy() -> P<Expr> {
|
||||
P(Expr {
|
||||
pub fn dummy() -> Expr {
|
||||
Expr {
|
||||
id: DUMMY_NODE_ID,
|
||||
kind: ExprKind::Dummy,
|
||||
span: DUMMY_SP,
|
||||
attrs: ThinVec::new(),
|
||||
tokens: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<P<Expr>> for Expr {
|
||||
fn from(value: P<Expr>) -> Self {
|
||||
*value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2374,6 +2386,12 @@ impl Clone for Ty {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<P<Ty>> for Ty {
|
||||
fn from(value: P<Ty>) -> Self {
|
||||
*value
|
||||
}
|
||||
}
|
||||
|
||||
impl Ty {
|
||||
pub fn peel_refs(&self) -> &Self {
|
||||
let mut final_ty = self;
|
||||
|
||||
@@ -168,7 +168,7 @@ pub trait MutVisitor: Sized + MutVisitorResult<Result = ()> {
|
||||
walk_flat_map_arm(self, arm)
|
||||
}
|
||||
|
||||
fn visit_pat(&mut self, p: &mut P<Pat>) {
|
||||
fn visit_pat(&mut self, p: &mut Pat) {
|
||||
walk_pat(self, p);
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ pub trait MutVisitor: Sized + MutVisitorResult<Result = ()> {
|
||||
walk_anon_const(self, c);
|
||||
}
|
||||
|
||||
fn visit_expr(&mut self, e: &mut P<Expr>) {
|
||||
fn visit_expr(&mut self, e: &mut Expr) {
|
||||
walk_expr(self, e);
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ pub trait MutVisitor: Sized + MutVisitorResult<Result = ()> {
|
||||
walk_generic_arg(self, arg);
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, t: &mut P<Ty>) {
|
||||
fn visit_ty(&mut self, t: &mut Ty) {
|
||||
walk_ty(self, t);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user