diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2025-08-09 13:24:06 +0800 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2025-08-09 15:47:01 +0800 |
| commit | ad1113f87ef828b300ebb8fca397efd358580da3 (patch) | |
| tree | 1698ee8e278895989d53e13aa569f1c9601b4d19 /compiler/rustc_ast_lowering | |
| parent | 4c7749e8c8e50ad146da599eea3a250160c1bc2b (diff) | |
| download | rust-ad1113f87ef828b300ebb8fca397efd358580da3.tar.gz rust-ad1113f87ef828b300ebb8fca397efd358580da3.zip | |
remove `P`
Diffstat (limited to 'compiler/rustc_ast_lowering')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/expr.rs | 17 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/item.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/pat.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/path.rs | 2 |
5 files changed, 14 insertions, 17 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index fb42cfea30b..2ddbf083a09 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -1,7 +1,6 @@ use std::ops::ControlFlow; use std::sync::Arc; -use rustc_ast::ptr::P as AstP; use rustc_ast::*; use rustc_ast_pretty::pprust::expr_to_string; use rustc_data_structures::stack::ensure_sufficient_stack; @@ -53,7 +52,7 @@ impl<'v> rustc_ast::visit::Visitor<'v> for WillCreateDefIdsVisitor { } impl<'hir> LoweringContext<'_, 'hir> { - fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> &'hir [hir::Expr<'hir>] { + fn lower_exprs(&mut self, exprs: &[Box<Expr>]) -> &'hir [hir::Expr<'hir>] { self.arena.alloc_from_iter(exprs.iter().map(|x| self.lower_expr_mut(x))) } @@ -455,7 +454,7 @@ impl<'hir> LoweringContext<'_, 'hir> { fn lower_legacy_const_generics( &mut self, mut f: Expr, - args: ThinVec<AstP<Expr>>, + args: ThinVec<Box<Expr>>, legacy_args_idx: &[usize], ) -> hir::ExprKind<'hir> { let ExprKind::Path(None, path) = &mut f.kind else { @@ -495,7 +494,7 @@ impl<'hir> LoweringContext<'_, 'hir> { self.create_def(node_id, None, DefKind::AnonConst, f.span); let mut visitor = WillCreateDefIdsVisitor {}; let const_value = if let ControlFlow::Break(span) = visitor.visit_expr(&arg) { - AstP(Expr { + Box::new(Expr { id: self.next_node_id(), kind: ExprKind::Err(invalid_expr_error(self.tcx, span)), span: f.span, @@ -516,7 +515,7 @@ impl<'hir> LoweringContext<'_, 'hir> { // Add generic args to the last element of the path. let last_segment = path.segments.last_mut().unwrap(); assert!(last_segment.args.is_none()); - last_segment.args = Some(AstP(GenericArgs::AngleBracketed(AngleBracketedArgs { + last_segment.args = Some(Box::new(GenericArgs::AngleBracketed(AngleBracketedArgs { span: DUMMY_SP, args: generic_args, }))); @@ -812,7 +811,7 @@ impl<'hir> LoweringContext<'_, 'hir> { self.lower_attrs( inner_hir_id, &[Attribute { - kind: AttrKind::Normal(ptr::P(NormalAttr::from_ident(Ident::new( + kind: AttrKind::Normal(Box::new(NormalAttr::from_ident(Ident::new( sym::track_caller, span, )))), @@ -1285,7 +1284,7 @@ impl<'hir> LoweringContext<'_, 'hir> { fn extract_tuple_struct_path<'a>( &mut self, expr: &'a Expr, - ) -> Option<(&'a Option<AstP<QSelf>>, &'a Path)> { + ) -> Option<(&'a Option<Box<QSelf>>, &'a Path)> { if let ExprKind::Path(qself, path) = &expr.kind { // Does the path resolve to something disallowed in a tuple struct/variant pattern? if let Some(partial_res) = self.resolver.get_partial_res(expr.id) { @@ -1307,7 +1306,7 @@ impl<'hir> LoweringContext<'_, 'hir> { fn extract_unit_struct_path<'a>( &mut self, expr: &'a Expr, - ) -> Option<(&'a Option<AstP<QSelf>>, &'a Path)> { + ) -> Option<(&'a Option<Box<QSelf>>, &'a Path)> { if let ExprKind::Path(qself, path) = &expr.kind { // Does the path resolve to something disallowed in a unit struct/variant pattern? if let Some(partial_res) = self.resolver.get_partial_res(expr.id) { @@ -1478,7 +1477,7 @@ impl<'hir> LoweringContext<'_, 'hir> { /// Each sub-assignment is recorded in `assignments`. fn destructure_sequence( &mut self, - elements: &[AstP<Expr>], + elements: &[Box<Expr>], ctx: &str, eq_sign_span: Span, assignments: &mut Vec<hir::Stmt<'hir>>, diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 9f54af57528..ac6fac4c08e 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -1,5 +1,4 @@ use rustc_abi::ExternAbi; -use rustc_ast::ptr::P; use rustc_ast::visit::AssocCtxt; use rustc_ast::*; use rustc_errors::{E0570, ErrorGuaranteed, struct_span_code_err}; @@ -102,7 +101,7 @@ impl<'a, 'hir> ItemLowerer<'a, 'hir> { impl<'hir> LoweringContext<'_, 'hir> { pub(super) fn lower_mod( &mut self, - items: &[P<Item>], + items: &[Box<Item>], spans: &ModSpans, ) -> &'hir hir::Mod<'hir> { self.arena.alloc(hir::Mod { @@ -462,7 +461,7 @@ impl<'hir> LoweringContext<'_, 'hir> { } ItemKind::MacroDef(ident, MacroDef { body, macro_rules }) => { let ident = self.lower_ident(*ident); - let body = P(self.lower_delim_args(body)); + let body = Box::new(self.lower_delim_args(body)); let def_id = self.local_def_id(id); let def_kind = self.tcx.def_kind(def_id); let DefKind::Macro(macro_kind) = def_kind else { diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index d097e3cbaa8..64c1b53f633 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1217,7 +1217,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { fn lower_path_ty( &mut self, t: &Ty, - qself: &Option<ptr::P<QSelf>>, + qself: &Option<Box<QSelf>>, path: &Path, param_mode: ParamMode, itctx: ImplTraitContext, diff --git a/compiler/rustc_ast_lowering/src/pat.rs b/compiler/rustc_ast_lowering/src/pat.rs index e4440621048..b6533060a76 100644 --- a/compiler/rustc_ast_lowering/src/pat.rs +++ b/compiler/rustc_ast_lowering/src/pat.rs @@ -1,6 +1,5 @@ use std::sync::Arc; -use rustc_ast::ptr::P; use rustc_ast::*; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_hir::def::{DefKind, Res}; @@ -154,7 +153,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { fn lower_pat_tuple( &mut self, - pats: &[P<Pat>], + pats: &[Box<Pat>], ctx: &str, ) -> (&'hir [hir::Pat<'hir>], hir::DotDotPos) { let mut elems = Vec::with_capacity(pats.len()); @@ -209,7 +208,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { /// When encountering `($binding_mode $ident @)? ..` (`slice`), /// this is interpreted as a sub-slice pattern semantically. /// Patterns that follow, which are not like `slice` -- or an error occurs, are in `after`. - fn lower_pat_slice(&mut self, pats: &[P<Pat>]) -> hir::PatKind<'hir> { + fn lower_pat_slice(&mut self, pats: &[Box<Pat>]) -> hir::PatKind<'hir> { let mut before = Vec::new(); let mut after = Vec::new(); let mut slice = None; diff --git a/compiler/rustc_ast_lowering/src/path.rs b/compiler/rustc_ast_lowering/src/path.rs index c80ef275c80..3322e0fb66b 100644 --- a/compiler/rustc_ast_lowering/src/path.rs +++ b/compiler/rustc_ast_lowering/src/path.rs @@ -24,7 +24,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { pub(crate) fn lower_qpath( &mut self, id: NodeId, - qself: &Option<ptr::P<QSelf>>, + qself: &Option<Box<QSelf>>, p: &Path, param_mode: ParamMode, allow_return_type_notation: AllowReturnTypeNotation, |
