@@ -13,7 +13,6 @@ use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
13
13
use rustc_data_structures:: fingerprint:: Fingerprint ;
14
14
use rustc_data_structures:: fx:: FxHashMap ;
15
15
use rustc_data_structures:: sorted_map:: SortedMap ;
16
- use rustc_error_messages:: MultiSpan ;
17
16
use rustc_index:: IndexVec ;
18
17
use rustc_macros:: HashStable_Generic ;
19
18
use rustc_span:: hygiene:: MacroKind ;
@@ -76,13 +75,6 @@ impl ParamName {
76
75
ParamName :: Fresh | ParamName :: Error => Ident :: with_dummy_span ( kw:: UnderscoreLifetime ) ,
77
76
}
78
77
}
79
-
80
- pub fn normalize_to_macros_2_0 ( & self ) -> ParamName {
81
- match * self {
82
- ParamName :: Plain ( ident) => ParamName :: Plain ( ident. normalize_to_macros_2_0 ( ) ) ,
83
- param_name => param_name,
84
- }
85
- }
86
78
}
87
79
88
80
#[ derive( Debug , Copy , Clone , PartialEq , Eq , HashStable_Generic ) ]
@@ -116,7 +108,7 @@ pub enum LifetimeName {
116
108
}
117
109
118
110
impl LifetimeName {
119
- pub fn is_elided ( & self ) -> bool {
111
+ fn is_elided ( & self ) -> bool {
120
112
match self {
121
113
LifetimeName :: ImplicitObjectLifetimeDefault | LifetimeName :: Infer => true ,
122
114
@@ -289,10 +281,6 @@ impl GenericArg<'_> {
289
281
}
290
282
}
291
283
292
- pub fn is_synthetic ( & self ) -> bool {
293
- matches ! ( self , GenericArg :: Lifetime ( lifetime) if lifetime. ident == Ident :: empty( ) )
294
- }
295
-
296
284
pub fn descr ( & self ) -> & ' static str {
297
285
match self {
298
286
GenericArg :: Lifetime ( _) => "lifetime" ,
@@ -368,11 +356,6 @@ impl<'hir> GenericArgs<'hir> {
368
356
panic ! ( "GenericArgs::inputs: not a `Fn(T) -> U`" ) ;
369
357
}
370
358
371
- #[ inline]
372
- pub fn has_type_params ( & self ) -> bool {
373
- self . args . iter ( ) . any ( |arg| matches ! ( arg, GenericArg :: Type ( _) ) )
374
- }
375
-
376
359
pub fn has_err ( & self ) -> bool {
377
360
self . args . iter ( ) . any ( |arg| match arg {
378
361
GenericArg :: Type ( ty) => matches ! ( ty. kind, TyKind :: Err ( _) ) ,
@@ -383,11 +366,6 @@ impl<'hir> GenericArgs<'hir> {
383
366
} )
384
367
}
385
368
386
- #[ inline]
387
- pub fn num_type_params ( & self ) -> usize {
388
- self . args . iter ( ) . filter ( |arg| matches ! ( arg, GenericArg :: Type ( _) ) ) . count ( )
389
- }
390
-
391
369
#[ inline]
392
370
pub fn num_lifetime_params ( & self ) -> usize {
393
371
self . args . iter ( ) . filter ( |arg| matches ! ( arg, GenericArg :: Lifetime ( _) ) ) . count ( )
@@ -589,14 +567,6 @@ impl<'hir> Generics<'hir> {
589
567
self . params . iter ( ) . find ( |& param| name == param. name . ident ( ) . name )
590
568
}
591
569
592
- pub fn spans ( & self ) -> MultiSpan {
593
- if self . params . is_empty ( ) {
594
- self . span . into ( )
595
- } else {
596
- self . params . iter ( ) . map ( |p| p. span ) . collect :: < Vec < Span > > ( ) . into ( )
597
- }
598
- }
599
-
600
570
/// If there are generic parameters, return where to introduce a new one.
601
571
pub fn span_for_lifetime_suggestion ( & self ) -> Option < Span > {
602
572
if let Some ( first) = self . params . first ( )
@@ -679,7 +649,7 @@ impl<'hir> Generics<'hir> {
679
649
)
680
650
}
681
651
682
- pub fn span_for_predicate_removal ( & self , pos : usize ) -> Span {
652
+ fn span_for_predicate_removal ( & self , pos : usize ) -> Span {
683
653
let predicate = & self . predicates [ pos] ;
684
654
let span = predicate. span ( ) ;
685
655
@@ -812,7 +782,7 @@ pub struct WhereRegionPredicate<'hir> {
812
782
813
783
impl < ' hir > WhereRegionPredicate < ' hir > {
814
784
/// Returns `true` if `param_def_id` matches the `lifetime` of this predicate.
815
- pub fn is_param_bound ( & self , param_def_id : LocalDefId ) -> bool {
785
+ fn is_param_bound ( & self , param_def_id : LocalDefId ) -> bool {
816
786
self . lifetime . res == LifetimeName :: Param ( param_def_id)
817
787
}
818
788
}
@@ -869,7 +839,7 @@ pub struct OwnerNodes<'tcx> {
869
839
}
870
840
871
841
impl < ' tcx > OwnerNodes < ' tcx > {
872
- pub fn node ( & self ) -> OwnerNode < ' tcx > {
842
+ fn node ( & self ) -> OwnerNode < ' tcx > {
873
843
use rustc_index:: Idx ;
874
844
let node = self . nodes [ ItemLocalId :: new ( 0 ) ] . as_ref ( ) . unwrap ( ) . node ;
875
845
let node = node. as_owner ( ) . unwrap ( ) ; // Indexing must ensure it is an OwnerNode.
@@ -1272,10 +1242,6 @@ impl BinOpKind {
1272
1242
matches ! ( self , BinOpKind :: And | BinOpKind :: Or )
1273
1243
}
1274
1244
1275
- pub fn is_shift ( self ) -> bool {
1276
- matches ! ( self , BinOpKind :: Shl | BinOpKind :: Shr )
1277
- }
1278
-
1279
1245
pub fn is_comparison ( self ) -> bool {
1280
1246
match self {
1281
1247
BinOpKind :: Eq
@@ -2115,16 +2081,6 @@ impl<'hir> QPath<'hir> {
2115
2081
QPath :: LangItem ( _, span, _) => span,
2116
2082
}
2117
2083
}
2118
-
2119
- /// Returns the span of the last segment of this `QPath`. For example, `method` in
2120
- /// `<() as Trait>::method`.
2121
- pub fn last_segment_span ( & self ) -> Span {
2122
- match * self {
2123
- QPath :: Resolved ( _, path) => path. segments . last ( ) . unwrap ( ) . ident . span ,
2124
- QPath :: TypeRelative ( _, segment) => segment. ident . span ,
2125
- QPath :: LangItem ( _, span, _) => span,
2126
- }
2127
- }
2128
2084
}
2129
2085
2130
2086
/// Hints at the original code for a let statement.
@@ -3896,12 +3852,6 @@ impl<'hir> Node<'hir> {
3896
3852
}
3897
3853
}
3898
3854
3899
- /// Get the fields for the tuple-constructor,
3900
- /// if this node is a tuple constructor, otherwise None
3901
- pub fn tuple_fields ( & self ) -> Option < & ' hir [ FieldDef < ' hir > ] > {
3902
- if let Node :: Ctor ( & VariantData :: Tuple ( fields, _, _) ) = self { Some ( fields) } else { None }
3903
- }
3904
-
3905
3855
/// Expect a [`Node::Param`] or panic.
3906
3856
#[ track_caller]
3907
3857
pub fn expect_param ( self ) -> & ' hir Param < ' hir > {
0 commit comments