@@ -125,14 +125,6 @@ impl ExpnHash {
125
125
StableCrateId ( self . 0 . split ( ) . 0 )
126
126
}
127
127
128
- /// Returns the crate-local part of the [ExpnHash].
129
- ///
130
- /// Used for tests.
131
- #[ inline]
132
- pub fn local_hash ( self ) -> Hash64 {
133
- self . 0 . split ( ) . 1
134
- }
135
-
136
128
#[ inline]
137
129
pub fn is_root ( self ) -> bool {
138
130
self . 0 == Fingerprint :: ZERO
@@ -170,7 +162,7 @@ impl LocalExpnId {
170
162
pub const ROOT : LocalExpnId = LocalExpnId :: from_u32 ( 0 ) ;
171
163
172
164
#[ inline]
173
- pub fn from_raw ( idx : ExpnIndex ) -> LocalExpnId {
165
+ fn from_raw ( idx : ExpnIndex ) -> LocalExpnId {
174
166
LocalExpnId :: from_u32 ( idx. as_u32 ( ) )
175
167
}
176
168
@@ -201,11 +193,6 @@ impl LocalExpnId {
201
193
} )
202
194
}
203
195
204
- #[ inline]
205
- pub fn expn_hash ( self ) -> ExpnHash {
206
- HygieneData :: with ( |data| data. local_expn_hash ( self ) )
207
- }
208
-
209
196
#[ inline]
210
197
pub fn expn_data ( self ) -> ExpnData {
211
198
HygieneData :: with ( |data| data. local_expn_data ( self ) . clone ( ) )
@@ -236,26 +223,13 @@ impl LocalExpnId {
236
223
self . to_expn_id ( ) . is_descendant_of ( ancestor. to_expn_id ( ) )
237
224
}
238
225
239
- /// `expn_id.outer_expn_is_descendant_of(ctxt)` is equivalent to but faster than
240
- /// `expn_id.is_descendant_of(ctxt.outer_expn())`.
241
- #[ inline]
242
- pub fn outer_expn_is_descendant_of ( self , ctxt : SyntaxContext ) -> bool {
243
- self . to_expn_id ( ) . outer_expn_is_descendant_of ( ctxt)
244
- }
245
-
246
226
/// Returns span for the macro which originally caused this expansion to happen.
247
227
///
248
228
/// Stops backtracing at include! boundary.
249
229
#[ inline]
250
230
pub fn expansion_cause ( self ) -> Option < Span > {
251
231
self . to_expn_id ( ) . expansion_cause ( )
252
232
}
253
-
254
- #[ inline]
255
- #[ track_caller]
256
- pub fn parent ( self ) -> LocalExpnId {
257
- self . expn_data ( ) . parent . as_local ( ) . unwrap ( )
258
- }
259
233
}
260
234
261
235
impl ExpnId {
@@ -330,7 +304,7 @@ impl ExpnId {
330
304
}
331
305
332
306
#[ derive( Debug ) ]
333
- pub struct HygieneData {
307
+ pub ( crate ) struct HygieneData {
334
308
/// Each expansion should have an associated expansion data, but sometimes there's a delay
335
309
/// between creation of an expansion ID and obtaining its data (e.g. macros are collected
336
310
/// first and then resolved later), so we use an `Option` here.
@@ -381,15 +355,10 @@ impl HygieneData {
381
355
}
382
356
}
383
357
384
- pub fn with < T , F : FnOnce ( & mut HygieneData ) -> T > ( f : F ) -> T {
358
+ fn with < T , F : FnOnce ( & mut HygieneData ) -> T > ( f : F ) -> T {
385
359
with_session_globals ( |session_globals| f ( & mut session_globals. hygiene_data . borrow_mut ( ) ) )
386
360
}
387
361
388
- #[ inline]
389
- fn local_expn_hash ( & self , expn_id : LocalExpnId ) -> ExpnHash {
390
- self . local_expn_hashes [ expn_id]
391
- }
392
-
393
362
#[ inline]
394
363
fn expn_hash ( & self , expn_id : ExpnId ) -> ExpnHash {
395
364
match expn_id. as_local ( ) {
@@ -743,7 +712,7 @@ impl SyntaxContext {
743
712
}
744
713
745
714
/// Like `SyntaxContext::adjust`, but also normalizes `self` to macros 2.0.
746
- pub fn normalize_to_macros_2_0_and_adjust ( & mut self , expn_id : ExpnId ) -> Option < ExpnId > {
715
+ pub ( crate ) fn normalize_to_macros_2_0_and_adjust ( & mut self , expn_id : ExpnId ) -> Option < ExpnId > {
747
716
HygieneData :: with ( |data| {
748
717
* self = data. normalize_to_macros_2_0 ( * self ) ;
749
718
data. adjust ( self , expn_id)
@@ -776,7 +745,11 @@ impl SyntaxContext {
776
745
/// ```
777
746
/// This returns `None` if the context cannot be glob-adjusted.
778
747
/// Otherwise, it returns the scope to use when privacy checking (see `adjust` for details).
779
- pub fn glob_adjust ( & mut self , expn_id : ExpnId , glob_span : Span ) -> Option < Option < ExpnId > > {
748
+ pub ( crate ) fn glob_adjust (
749
+ & mut self ,
750
+ expn_id : ExpnId ,
751
+ glob_span : Span ,
752
+ ) -> Option < Option < ExpnId > > {
780
753
HygieneData :: with ( |data| {
781
754
let mut scope = None ;
782
755
let mut glob_ctxt = data. normalize_to_macros_2_0 ( glob_span. ctxt ( ) ) ;
@@ -800,7 +773,7 @@ impl SyntaxContext {
800
773
/// assert!(self.glob_adjust(expansion, glob_ctxt) == Some(privacy_checking_scope));
801
774
/// }
802
775
/// ```
803
- pub fn reverse_glob_adjust (
776
+ pub ( crate ) fn reverse_glob_adjust (
804
777
& mut self ,
805
778
expn_id : ExpnId ,
806
779
glob_span : Span ,
@@ -855,11 +828,11 @@ impl SyntaxContext {
855
828
}
856
829
857
830
#[ inline]
858
- pub fn outer_mark ( self ) -> ( ExpnId , Transparency ) {
831
+ fn outer_mark ( self ) -> ( ExpnId , Transparency ) {
859
832
HygieneData :: with ( |data| data. outer_mark ( self ) )
860
833
}
861
834
862
- pub fn dollar_crate_name ( self ) -> Symbol {
835
+ pub ( crate ) fn dollar_crate_name ( self ) -> Symbol {
863
836
HygieneData :: with ( |data| data. syntax_context_data [ self . 0 as usize ] . dollar_crate_name )
864
837
}
865
838
@@ -958,12 +931,12 @@ pub struct ExpnData {
958
931
/// The normal module (`mod`) in which the expanded macro was defined.
959
932
pub parent_module : Option < DefId > ,
960
933
/// Suppresses the `unsafe_code` lint for code produced by this macro.
961
- pub allow_internal_unsafe : bool ,
934
+ pub ( crate ) allow_internal_unsafe : bool ,
962
935
/// Enables the macro helper hack (`ident!(...)` -> `$crate::ident!(...)`) for this macro.
963
936
pub local_inner_macros : bool ,
964
937
/// Should debuginfo for the macro be collapsed to the outermost expansion site (in other
965
938
/// words, was the macro definition annotated with `#[collapse_debuginfo]`)?
966
- pub collapse_debuginfo : bool ,
939
+ pub ( crate ) collapse_debuginfo : bool ,
967
940
}
968
941
969
942
impl !PartialEq for ExpnData { }
0 commit comments