@@ -66,10 +66,10 @@ pub struct SyntaxContextData {
66
66
outer_expn : ExpnId ,
67
67
outer_transparency : Transparency ,
68
68
parent : SyntaxContext ,
69
- /// This context, but with all transparent and semi-transparent expansions filtered away.
69
+ /// This context, but with all transparent and semi-opaque expansions filtered away.
70
70
opaque : SyntaxContext ,
71
71
/// This context, but with all transparent expansions filtered away.
72
- opaque_and_semitransparent : SyntaxContext ,
72
+ opaque_and_semiopaque : SyntaxContext ,
73
73
/// Name of the crate to which `$crate` with this context would resolve.
74
74
dollar_crate_name : Symbol ,
75
75
}
@@ -78,14 +78,14 @@ impl SyntaxContextData {
78
78
fn new (
79
79
( parent, outer_expn, outer_transparency) : SyntaxContextKey ,
80
80
opaque : SyntaxContext ,
81
- opaque_and_semitransparent : SyntaxContext ,
81
+ opaque_and_semiopaque : SyntaxContext ,
82
82
) -> SyntaxContextData {
83
83
SyntaxContextData {
84
84
outer_expn,
85
85
outer_transparency,
86
86
parent,
87
87
opaque,
88
- opaque_and_semitransparent ,
88
+ opaque_and_semiopaque ,
89
89
dollar_crate_name : kw:: DollarCrate ,
90
90
}
91
91
}
@@ -96,7 +96,7 @@ impl SyntaxContextData {
96
96
outer_transparency : Transparency :: Opaque ,
97
97
parent : SyntaxContext :: root ( ) ,
98
98
opaque : SyntaxContext :: root ( ) ,
99
- opaque_and_semitransparent : SyntaxContext :: root ( ) ,
99
+ opaque_and_semiopaque : SyntaxContext :: root ( ) ,
100
100
dollar_crate_name : kw:: DollarCrate ,
101
101
}
102
102
}
@@ -207,21 +207,21 @@ pub enum Transparency {
207
207
/// Identifier produced by a transparent expansion is always resolved at call-site.
208
208
/// Call-site spans in procedural macros, hygiene opt-out in `macro` should use this.
209
209
Transparent ,
210
- /// Identifier produced by a semi-transparent expansion may be resolved
210
+ /// Identifier produced by a semi-opaque expansion may be resolved
211
211
/// either at call-site or at definition-site.
212
212
/// If it's a local variable, label or `$crate` then it's resolved at def-site.
213
213
/// Otherwise it's resolved at call-site.
214
214
/// `macro_rules` macros behave like this, built-in macros currently behave like this too,
215
215
/// but that's an implementation detail.
216
- SemiTransparent ,
216
+ SemiOpaque ,
217
217
/// Identifier produced by an opaque expansion is always resolved at definition-site.
218
218
/// Def-site spans in procedural macros, identifiers from `macro` by default use this.
219
219
Opaque ,
220
220
}
221
221
222
222
impl Transparency {
223
223
pub fn fallback ( macro_rules : bool ) -> Self {
224
- if macro_rules { Transparency :: SemiTransparent } else { Transparency :: Opaque }
224
+ if macro_rules { Transparency :: SemiOpaque } else { Transparency :: Opaque }
225
225
}
226
226
}
227
227
@@ -469,7 +469,7 @@ impl HygieneData {
469
469
470
470
fn normalize_to_macro_rules ( & self , ctxt : SyntaxContext ) -> SyntaxContext {
471
471
debug_assert ! ( !self . syntax_context_data[ ctxt. 0 as usize ] . is_decode_placeholder( ) ) ;
472
- self . syntax_context_data [ ctxt. 0 as usize ] . opaque_and_semitransparent
472
+ self . syntax_context_data [ ctxt. 0 as usize ] . opaque_and_semiopaque
473
473
}
474
474
475
475
fn outer_expn ( & self , ctxt : SyntaxContext ) -> ExpnId {
@@ -562,7 +562,7 @@ impl HygieneData {
562
562
}
563
563
564
564
let call_site_ctxt = self . expn_data ( expn_id) . call_site . ctxt ( ) ;
565
- let mut call_site_ctxt = if transparency == Transparency :: SemiTransparent {
565
+ let mut call_site_ctxt = if transparency == Transparency :: SemiOpaque {
566
566
self . normalize_to_macros_2_0 ( call_site_ctxt)
567
567
} else {
568
568
self . normalize_to_macro_rules ( call_site_ctxt)
@@ -608,33 +608,32 @@ impl HygieneData {
608
608
self . syntax_context_data . push ( SyntaxContextData :: decode_placeholder ( ) ) ;
609
609
self . syntax_context_map . insert ( key, ctxt) ;
610
610
611
- // Opaque and semi-transparent versions of the parent. Note that they may be equal to the
611
+ // Opaque and semi-opaque versions of the parent. Note that they may be equal to the
612
612
// parent itself. E.g. `parent_opaque` == `parent` if the expn chain contains only opaques,
613
- // and `parent_opaque_and_semitransparent` == `parent` if the expn contains only opaques
614
- // and semi-transparents.
613
+ // and `parent_opaque_and_semiopaque` == `parent` if the expn contains only (semi-)opaques.
615
614
let parent_opaque = self . syntax_context_data [ parent. 0 as usize ] . opaque ;
616
- let parent_opaque_and_semitransparent =
617
- self . syntax_context_data [ parent. 0 as usize ] . opaque_and_semitransparent ;
615
+ let parent_opaque_and_semiopaque =
616
+ self . syntax_context_data [ parent. 0 as usize ] . opaque_and_semiopaque ;
618
617
619
- // Evaluate opaque and semi-transparent versions of the new syntax context.
620
- let ( opaque, opaque_and_semitransparent ) = match transparency {
621
- Transparency :: Transparent => ( parent_opaque, parent_opaque_and_semitransparent ) ,
622
- Transparency :: SemiTransparent => (
618
+ // Evaluate opaque and semi-opaque versions of the new syntax context.
619
+ let ( opaque, opaque_and_semiopaque ) = match transparency {
620
+ Transparency :: Transparent => ( parent_opaque, parent_opaque_and_semiopaque ) ,
621
+ Transparency :: SemiOpaque => (
623
622
parent_opaque,
624
- // Will be the same as `ctxt` if the expn chain contains only opaques and semi-transparents .
625
- self . alloc_ctxt ( parent_opaque_and_semitransparent , expn_id, transparency) ,
623
+ // Will be the same as `ctxt` if the expn chain contains only ( semi-)opaques .
624
+ self . alloc_ctxt ( parent_opaque_and_semiopaque , expn_id, transparency) ,
626
625
) ,
627
626
Transparency :: Opaque => (
628
627
// Will be the same as `ctxt` if the expn chain contains only opaques.
629
628
self . alloc_ctxt ( parent_opaque, expn_id, transparency) ,
630
- // Will be the same as `ctxt` if the expn chain contains only opaques and semi-transparents .
631
- self . alloc_ctxt ( parent_opaque_and_semitransparent , expn_id, transparency) ,
629
+ // Will be the same as `ctxt` if the expn chain contains only ( semi-)opaques .
630
+ self . alloc_ctxt ( parent_opaque_and_semiopaque , expn_id, transparency) ,
632
631
) ,
633
632
} ;
634
633
635
634
// Fill the full data, now that we have it.
636
635
self . syntax_context_data [ ctxt. as_u32 ( ) as usize ] =
637
- SyntaxContextData :: new ( key, opaque, opaque_and_semitransparent ) ;
636
+ SyntaxContextData :: new ( key, opaque, opaque_and_semiopaque ) ;
638
637
ctxt
639
638
}
640
639
}
0 commit comments