@@ -127,7 +127,7 @@ impl ExpnHash {
127127
128128 /// Returns the crate-local part of the [ExpnHash].
129129 ///
130- /// Used for tests .
130+ /// Used for assertions .
131131 #[ inline]
132132 pub fn local_hash ( self ) -> Hash64 {
133133 self . 0 . split ( ) . 1
@@ -170,7 +170,7 @@ impl LocalExpnId {
170170 pub const ROOT : LocalExpnId = LocalExpnId :: from_u32 ( 0 ) ;
171171
172172 #[ inline]
173- pub fn from_raw ( idx : ExpnIndex ) -> LocalExpnId {
173+ fn from_raw ( idx : ExpnIndex ) -> LocalExpnId {
174174 LocalExpnId :: from_u32 ( idx. as_u32 ( ) )
175175 }
176176
@@ -201,11 +201,6 @@ impl LocalExpnId {
201201 } )
202202 }
203203
204- #[ inline]
205- pub fn expn_hash ( self ) -> ExpnHash {
206- HygieneData :: with ( |data| data. local_expn_hash ( self ) )
207- }
208-
209204 #[ inline]
210205 pub fn expn_data ( self ) -> ExpnData {
211206 HygieneData :: with ( |data| data. local_expn_data ( self ) . clone ( ) )
@@ -236,26 +231,13 @@ impl LocalExpnId {
236231 self . to_expn_id ( ) . is_descendant_of ( ancestor. to_expn_id ( ) )
237232 }
238233
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-
246234 /// Returns span for the macro which originally caused this expansion to happen.
247235 ///
248236 /// Stops backtracing at include! boundary.
249237 #[ inline]
250238 pub fn expansion_cause ( self ) -> Option < Span > {
251239 self . to_expn_id ( ) . expansion_cause ( )
252240 }
253-
254- #[ inline]
255- #[ track_caller]
256- pub fn parent ( self ) -> LocalExpnId {
257- self . expn_data ( ) . parent . as_local ( ) . unwrap ( )
258- }
259241}
260242
261243impl ExpnId {
@@ -330,7 +312,7 @@ impl ExpnId {
330312}
331313
332314#[ derive( Debug ) ]
333- pub struct HygieneData {
315+ pub ( crate ) struct HygieneData {
334316 /// Each expansion should have an associated expansion data, but sometimes there's a delay
335317 /// between creation of an expansion ID and obtaining its data (e.g. macros are collected
336318 /// first and then resolved later), so we use an `Option` here.
@@ -381,15 +363,10 @@ impl HygieneData {
381363 }
382364 }
383365
384- pub fn with < T , F : FnOnce ( & mut HygieneData ) -> T > ( f : F ) -> T {
366+ fn with < T , F : FnOnce ( & mut HygieneData ) -> T > ( f : F ) -> T {
385367 with_session_globals ( |session_globals| f ( & mut session_globals. hygiene_data . borrow_mut ( ) ) )
386368 }
387369
388- #[ inline]
389- fn local_expn_hash ( & self , expn_id : LocalExpnId ) -> ExpnHash {
390- self . local_expn_hashes [ expn_id]
391- }
392-
393370 #[ inline]
394371 fn expn_hash ( & self , expn_id : ExpnId ) -> ExpnHash {
395372 match expn_id. as_local ( ) {
@@ -743,7 +720,7 @@ impl SyntaxContext {
743720 }
744721
745722 /// 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 > {
723+ pub ( crate ) fn normalize_to_macros_2_0_and_adjust ( & mut self , expn_id : ExpnId ) -> Option < ExpnId > {
747724 HygieneData :: with ( |data| {
748725 * self = data. normalize_to_macros_2_0 ( * self ) ;
749726 data. adjust ( self , expn_id)
@@ -776,7 +753,11 @@ impl SyntaxContext {
776753 /// ```
777754 /// This returns `None` if the context cannot be glob-adjusted.
778755 /// 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 > > {
756+ pub ( crate ) fn glob_adjust (
757+ & mut self ,
758+ expn_id : ExpnId ,
759+ glob_span : Span ,
760+ ) -> Option < Option < ExpnId > > {
780761 HygieneData :: with ( |data| {
781762 let mut scope = None ;
782763 let mut glob_ctxt = data. normalize_to_macros_2_0 ( glob_span. ctxt ( ) ) ;
@@ -800,7 +781,7 @@ impl SyntaxContext {
800781 /// assert!(self.glob_adjust(expansion, glob_ctxt) == Some(privacy_checking_scope));
801782 /// }
802783 /// ```
803- pub fn reverse_glob_adjust (
784+ pub ( crate ) fn reverse_glob_adjust (
804785 & mut self ,
805786 expn_id : ExpnId ,
806787 glob_span : Span ,
@@ -855,11 +836,11 @@ impl SyntaxContext {
855836 }
856837
857838 #[ inline]
858- pub fn outer_mark ( self ) -> ( ExpnId , Transparency ) {
839+ fn outer_mark ( self ) -> ( ExpnId , Transparency ) {
859840 HygieneData :: with ( |data| data. outer_mark ( self ) )
860841 }
861842
862- pub fn dollar_crate_name ( self ) -> Symbol {
843+ pub ( crate ) fn dollar_crate_name ( self ) -> Symbol {
863844 HygieneData :: with ( |data| data. syntax_context_data [ self . 0 as usize ] . dollar_crate_name )
864845 }
865846
@@ -958,12 +939,12 @@ pub struct ExpnData {
958939 /// The normal module (`mod`) in which the expanded macro was defined.
959940 pub parent_module : Option < DefId > ,
960941 /// Suppresses the `unsafe_code` lint for code produced by this macro.
961- pub allow_internal_unsafe : bool ,
942+ pub ( crate ) allow_internal_unsafe : bool ,
962943 /// Enables the macro helper hack (`ident!(...)` -> `$crate::ident!(...)`) for this macro.
963944 pub local_inner_macros : bool ,
964945 /// Should debuginfo for the macro be collapsed to the outermost expansion site (in other
965946 /// words, was the macro definition annotated with `#[collapse_debuginfo]`)?
966- pub collapse_debuginfo : bool ,
947+ pub ( crate ) collapse_debuginfo : bool ,
967948}
968949
969950impl !PartialEq for ExpnData { }
0 commit comments