Skip to content

Commit 07dc272

Browse files
committed
Update test suite to nightly-2025-05-31
1 parent abfcd60 commit 07dc272

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

tests/test_precedence.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ use rustc_ast::ptr::P;
4747
use rustc_ast_pretty::pprust;
4848
use rustc_span::edition::Edition;
4949
use std::fs;
50+
use std::mem;
5051
use std::path::Path;
5152
use std::process;
5253
use std::sync::atomic::{AtomicUsize, Ordering};
@@ -206,7 +207,7 @@ fn librustc_parenthesize(mut librustc_expr: P<ast::Expr>) -> P<ast::Expr> {
206207
ExprKind, GenericArg, GenericBound, Local, LocalKind, Pat, PolyTraitRef, Stmt, StmtKind,
207208
StructExpr, StructRest, TraitBoundModifiers, Ty,
208209
};
209-
use rustc_ast::mut_visit::{visit_clobber, walk_flat_map_assoc_item, MutVisitor};
210+
use rustc_ast::mut_visit::{walk_flat_map_assoc_item, MutVisitor};
210211
use rustc_ast::visit::{AssocCtxt, BoundKind};
211212
use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
212213
use rustc_span::DUMMY_SP;
@@ -280,13 +281,16 @@ fn librustc_parenthesize(mut librustc_expr: P<ast::Expr>) -> P<ast::Expr> {
280281
match e.kind {
281282
ExprKind::Block(..) | ExprKind::If(..) | ExprKind::Let(..) => {}
282283
ExprKind::Binary(..) if contains_let_chain(e) => {}
283-
_ => visit_clobber(&mut **e, |inner| Expr {
284-
id: ast::DUMMY_NODE_ID,
285-
kind: ExprKind::Paren(P(inner)),
286-
span: DUMMY_SP,
287-
attrs: ThinVec::new(),
288-
tokens: None,
289-
}),
284+
_ => {
285+
let inner = mem::replace(e, Expr::dummy());
286+
**e = Expr {
287+
id: ast::DUMMY_NODE_ID,
288+
kind: ExprKind::Paren(inner),
289+
span: DUMMY_SP,
290+
attrs: ThinVec::new(),
291+
tokens: None,
292+
};
293+
}
290294
}
291295
}
292296

@@ -319,15 +323,15 @@ fn librustc_parenthesize(mut librustc_expr: P<ast::Expr>) -> P<ast::Expr> {
319323
}
320324
}
321325

322-
fn visit_block(&mut self, block: &mut P<Block>) {
326+
fn visit_block(&mut self, block: &mut Block) {
323327
self.visit_id(&mut block.id);
324328
block
325329
.stmts
326330
.flat_map_in_place(|stmt| flat_map_stmt(stmt, self));
327331
self.visit_span(&mut block.span);
328332
}
329333

330-
fn visit_local(&mut self, local: &mut P<Local>) {
334+
fn visit_local(&mut self, local: &mut Local) {
331335
match &mut local.kind {
332336
LocalKind::Decl => {}
333337
LocalKind::Init(init) => {

0 commit comments

Comments
 (0)