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_resolve | |
| parent | 4c7749e8c8e50ad146da599eea3a250160c1bc2b (diff) | |
| download | rust-ad1113f87ef828b300ebb8fca397efd358580da3.tar.gz rust-ad1113f87ef828b300ebb8fca397efd358580da3.zip | |
remove `P`
Diffstat (limited to 'compiler/rustc_resolve')
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/late.rs | 19 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/late/diagnostics.rs | 9 |
3 files changed, 14 insertions, 17 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 517e20e0619..66f79585d92 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1,4 +1,3 @@ -use rustc_ast::ptr::P; use rustc_ast::visit::{self, Visitor}; use rustc_ast::{ self as ast, CRATE_NODE_ID, Crate, ItemKind, ModKind, NodeId, Path, join_path_idents, @@ -3347,7 +3346,7 @@ impl<'tcx> visit::Visitor<'tcx> for UsePlacementFinder { } } -fn search_for_any_use_in_items(items: &[P<ast::Item>]) -> Option<Span> { +fn search_for_any_use_in_items(items: &[Box<ast::Item>]) -> Option<Span> { for item in items { if let ItemKind::Use(..) = item.kind && is_span_suitable_for_use_injection(item.span) diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index fb6f5725704..8f0c08c3998 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -12,7 +12,6 @@ use std::collections::BTreeSet; use std::collections::hash_map::Entry; use std::mem::{replace, swap, take}; -use rustc_ast::ptr::P; use rustc_ast::visit::{ AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor, try_visit, visit_opt, walk_list, }; @@ -670,7 +669,7 @@ pub(crate) struct UnnecessaryQualification<'ra> { #[derive(Default, Debug)] struct DiagMetadata<'ast> { /// The current trait's associated items' ident, used for diagnostic suggestions. - current_trait_assoc_items: Option<&'ast [P<AssocItem>]>, + current_trait_assoc_items: Option<&'ast [Box<AssocItem>]>, /// The current self type if inside an impl (used for better errors). current_self_type: Option<Ty>, @@ -720,7 +719,7 @@ struct DiagMetadata<'ast> { current_type_path: Option<&'ast Ty>, /// The current impl items (used to suggest). - current_impl_items: Option<&'ast [P<AssocItem>]>, + current_impl_items: Option<&'ast [Box<AssocItem>]>, /// When processing impl trait currently_processing_impl_trait: Option<(TraitRef, Ty)>, @@ -3038,7 +3037,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { } /// When evaluating a `trait` use its associated types' idents for suggestions in E0412. - fn resolve_trait_items(&mut self, trait_items: &'ast [P<AssocItem>]) { + fn resolve_trait_items(&mut self, trait_items: &'ast [Box<AssocItem>]) { let trait_assoc_items = replace(&mut self.diag_metadata.current_trait_assoc_items, Some(trait_items)); @@ -3179,7 +3178,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { opt_trait_reference: &'ast Option<TraitRef>, self_type: &'ast Ty, item_id: NodeId, - impl_items: &'ast [P<AssocItem>], + impl_items: &'ast [Box<AssocItem>], ) { debug!("resolve_implementation"); // If applicable, create a rib for the type parameters. @@ -3671,7 +3670,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { /// pattern as a whole counts as a never pattern (since it's definitionallly unreachable). fn compute_and_check_or_pat_binding_map( &mut self, - pats: &[P<Pat>], + pats: &[Box<Pat>], ) -> Result<FxIndexMap<Ident, BindingInfo>, IsNeverPattern> { let mut missing_vars = FxIndexMap::default(); let mut inconsistent_vars = FxIndexMap::default(); @@ -4109,7 +4108,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { fn smart_resolve_path( &mut self, id: NodeId, - qself: &Option<P<QSelf>>, + qself: &Option<Box<QSelf>>, path: &Path, source: PathSource<'_, 'ast, '_>, ) { @@ -4126,7 +4125,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { #[instrument(level = "debug", skip(self))] fn smart_resolve_path_fragment( &mut self, - qself: &Option<P<QSelf>>, + qself: &Option<Box<QSelf>>, path: &[Segment], source: PathSource<'_, 'ast, '_>, finalize: Finalize, @@ -4434,7 +4433,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { // Resolve in alternative namespaces if resolution in the primary namespace fails. fn resolve_qpath_anywhere( &mut self, - qself: &Option<P<QSelf>>, + qself: &Option<Box<QSelf>>, path: &[Segment], primary_ns: Namespace, span: Span, @@ -4485,7 +4484,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { /// Handles paths that may refer to associated items. fn resolve_qpath( &mut self, - qself: &Option<P<QSelf>>, + qself: &Option<Box<QSelf>>, path: &[Segment], ns: Namespace, finalize: Finalize, diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 19cd45294eb..0807142a7c3 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -4,7 +4,6 @@ use std::borrow::Cow; use std::iter; use std::ops::Deref; -use rustc_ast::ptr::P; use rustc_ast::visit::{FnCtxt, FnKind, LifetimeCtxt, Visitor, walk_ty}; use rustc_ast::{ self as ast, AssocItemKind, DUMMY_NODE_ID, Expr, ExprKind, GenericParam, GenericParamKind, @@ -2150,7 +2149,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { err: &mut Diag<'_>, path_span: Span, call_span: Span, - args: &[P<Expr>], + args: &[Box<Expr>], ) { if def_id.is_local() { // Doing analysis on local `DefId`s would cause infinite recursion. @@ -3788,7 +3787,7 @@ fn mk_where_bound_predicate( ident: last.ident, gen_args: None, kind: ast::AssocItemConstraintKind::Equality { - term: ast::Term::Ty(ast::ptr::P(ast::Ty { + term: ast::Term::Ty(Box::new(ast::Ty { kind: ast::TyKind::Path(None, poly_trait_ref.trait_ref.path.clone()), id: DUMMY_NODE_ID, span: DUMMY_SP, @@ -3805,7 +3804,7 @@ fn mk_where_bound_predicate( Some(_) => return None, None => { second_last.args = - Some(ast::ptr::P(ast::GenericArgs::AngleBracketed(ast::AngleBracketedArgs { + Some(Box::new(ast::GenericArgs::AngleBracketed(ast::AngleBracketedArgs { args: ThinVec::from([added_constraint]), span: DUMMY_SP, }))); @@ -3818,7 +3817,7 @@ fn mk_where_bound_predicate( let new_where_bound_predicate = ast::WhereBoundPredicate { bound_generic_params: ThinVec::new(), - bounded_ty: ast::ptr::P(ty.clone()), + bounded_ty: Box::new(ty.clone()), bounds: vec