@@ -63,10 +63,10 @@ struct SyntaxContextData {
6363 outer_expn : ExpnId ,
6464 outer_transparency : Transparency ,
6565 parent : SyntaxContext ,
66- /// This context, but with all transparent and semi-transparent expansions filtered away.
66+ /// This context, but with all transparent and semi-opaque expansions filtered away.
6767 opaque : SyntaxContext ,
6868 /// This context, but with all transparent expansions filtered away.
69- opaque_and_semitransparent : SyntaxContext ,
69+ opaque_and_semiopaque : SyntaxContext ,
7070 /// Name of the crate to which `$crate` with this context would resolve.
7171 dollar_crate_name : Symbol ,
7272}
@@ -75,14 +75,14 @@ impl SyntaxContextData {
7575 fn new (
7676 ( parent, outer_expn, outer_transparency) : SyntaxContextKey ,
7777 opaque : SyntaxContext ,
78- opaque_and_semitransparent : SyntaxContext ,
78+ opaque_and_semiopaque : SyntaxContext ,
7979 ) -> SyntaxContextData {
8080 SyntaxContextData {
8181 outer_expn,
8282 outer_transparency,
8383 parent,
8484 opaque,
85- opaque_and_semitransparent ,
85+ opaque_and_semiopaque ,
8686 dollar_crate_name : kw:: DollarCrate ,
8787 }
8888 }
@@ -93,7 +93,7 @@ impl SyntaxContextData {
9393 outer_transparency : Transparency :: Opaque ,
9494 parent : SyntaxContext :: root ( ) ,
9595 opaque : SyntaxContext :: root ( ) ,
96- opaque_and_semitransparent : SyntaxContext :: root ( ) ,
96+ opaque_and_semiopaque : SyntaxContext :: root ( ) ,
9797 dollar_crate_name : kw:: DollarCrate ,
9898 }
9999 }
@@ -204,21 +204,21 @@ pub enum Transparency {
204204 /// Identifier produced by a transparent expansion is always resolved at call-site.
205205 /// Call-site spans in procedural macros, hygiene opt-out in `macro` should use this.
206206 Transparent ,
207- /// Identifier produced by a semi-transparent expansion may be resolved
207+ /// Identifier produced by a semi-opaque expansion may be resolved
208208 /// either at call-site or at definition-site.
209209 /// If it's a local variable, label or `$crate` then it's resolved at def-site.
210210 /// Otherwise it's resolved at call-site.
211211 /// `macro_rules` macros behave like this, built-in macros currently behave like this too,
212212 /// but that's an implementation detail.
213- SemiTransparent ,
213+ SemiOpaque ,
214214 /// Identifier produced by an opaque expansion is always resolved at definition-site.
215215 /// Def-site spans in procedural macros, identifiers from `macro` by default use this.
216216 Opaque ,
217217}
218218
219219impl Transparency {
220220 pub fn fallback ( macro_rules : bool ) -> Self {
221- if macro_rules { Transparency :: SemiTransparent } else { Transparency :: Opaque }
221+ if macro_rules { Transparency :: SemiOpaque } else { Transparency :: Opaque }
222222 }
223223}
224224
@@ -466,7 +466,7 @@ impl HygieneData {
466466
467467 fn normalize_to_macro_rules ( & self , ctxt : SyntaxContext ) -> SyntaxContext {
468468 debug_assert ! ( !self . syntax_context_data[ ctxt. 0 as usize ] . is_decode_placeholder( ) ) ;
469- self . syntax_context_data [ ctxt. 0 as usize ] . opaque_and_semitransparent
469+ self . syntax_context_data [ ctxt. 0 as usize ] . opaque_and_semiopaque
470470 }
471471
472472 fn outer_expn ( & self , ctxt : SyntaxContext ) -> ExpnId {
@@ -559,7 +559,7 @@ impl HygieneData {
559559 }
560560
561561 let call_site_ctxt = self . expn_data ( expn_id) . call_site . ctxt ( ) ;
562- let mut call_site_ctxt = if transparency == Transparency :: SemiTransparent {
562+ let mut call_site_ctxt = if transparency == Transparency :: SemiOpaque {
563563 self . normalize_to_macros_2_0 ( call_site_ctxt)
564564 } else {
565565 self . normalize_to_macro_rules ( call_site_ctxt)
@@ -605,33 +605,32 @@ impl HygieneData {
605605 self . syntax_context_data . push ( SyntaxContextData :: decode_placeholder ( ) ) ;
606606 self . syntax_context_map . insert ( key, ctxt) ;
607607
608- // Opaque and semi-transparent versions of the parent. Note that they may be equal to the
608+ // Opaque and semi-opaque versions of the parent. Note that they may be equal to the
609609 // parent itself. E.g. `parent_opaque` == `parent` if the expn chain contains only opaques,
610- // and `parent_opaque_and_semitransparent` == `parent` if the expn contains only opaques
611- // and semi-transparents.
610+ // and `parent_opaque_and_semiopaque` == `parent` if the expn contains only (semi-)opaques.
612611 let parent_opaque = self . syntax_context_data [ parent. 0 as usize ] . opaque ;
613- let parent_opaque_and_semitransparent =
614- self . syntax_context_data [ parent. 0 as usize ] . opaque_and_semitransparent ;
612+ let parent_opaque_and_semiopaque =
613+ self . syntax_context_data [ parent. 0 as usize ] . opaque_and_semiopaque ;
615614
616- // Evaluate opaque and semi-transparent versions of the new syntax context.
617- let ( opaque, opaque_and_semitransparent ) = match transparency {
618- Transparency :: Transparent => ( parent_opaque, parent_opaque_and_semitransparent ) ,
619- Transparency :: SemiTransparent => (
615+ // Evaluate opaque and semi-opaque versions of the new syntax context.
616+ let ( opaque, opaque_and_semiopaque ) = match transparency {
617+ Transparency :: Transparent => ( parent_opaque, parent_opaque_and_semiopaque ) ,
618+ Transparency :: SemiOpaque => (
620619 parent_opaque,
621- // Will be the same as `ctxt` if the expn chain contains only opaques and semi-transparents .
622- self . alloc_ctxt ( parent_opaque_and_semitransparent , expn_id, transparency) ,
620+ // Will be the same as `ctxt` if the expn chain contains only ( semi-)opaques .
621+ self . alloc_ctxt ( parent_opaque_and_semiopaque , expn_id, transparency) ,
623622 ) ,
624623 Transparency :: Opaque => (
625624 // Will be the same as `ctxt` if the expn chain contains only opaques.
626625 self . alloc_ctxt ( parent_opaque, expn_id, transparency) ,
627- // Will be the same as `ctxt` if the expn chain contains only opaques and semi-transparents .
628- self . alloc_ctxt ( parent_opaque_and_semitransparent , expn_id, transparency) ,
626+ // Will be the same as `ctxt` if the expn chain contains only ( semi-)opaques .
627+ self . alloc_ctxt ( parent_opaque_and_semiopaque , expn_id, transparency) ,
629628 ) ,
630629 } ;
631630
632631 // Fill the full data, now that we have it.
633632 self . syntax_context_data [ ctxt. as_u32 ( ) as usize ] =
634- SyntaxContextData :: new ( key, opaque, opaque_and_semitransparent ) ;
633+ SyntaxContextData :: new ( key, opaque, opaque_and_semiopaque ) ;
635634 ctxt
636635 }
637636}
0 commit comments