@@ -10,7 +10,6 @@ use crate::mir::interpret::ConstValue;
10
10
use syntax:: symbol:: { keywords, Symbol } ;
11
11
12
12
use rustc_target:: spec:: abi:: Abi ;
13
- use syntax:: symbol:: InternedString ;
14
13
15
14
use std:: cell:: Cell ;
16
15
use std:: fmt:: { self , Write as _} ;
@@ -818,7 +817,7 @@ pub struct FmtPrinterData<'a, 'gcx, 'tcx, F> {
818
817
empty_path : bool ,
819
818
in_value : bool ,
820
819
821
- used_region_names : FxHashSet < InternedString > ,
820
+ used_region_names : FxHashSet < Symbol > ,
822
821
region_index : usize ,
823
822
binder_depth : usize ,
824
823
@@ -1142,14 +1141,16 @@ impl<F: fmt::Write> PrettyPrinter<'gcx, 'tcx> for FmtPrinter<'_, 'gcx, 'tcx, F>
1142
1141
1143
1142
match * region {
1144
1143
ty:: ReEarlyBound ( ref data) => {
1145
- data. name != "" && data. name != "'_"
1144
+ data. name != keywords:: Invalid . name ( ) &&
1145
+ data. name != keywords:: UnderscoreLifetime . name ( )
1146
1146
}
1147
1147
1148
1148
ty:: ReLateBound ( _, br) |
1149
1149
ty:: ReFree ( ty:: FreeRegion { bound_region : br, .. } ) |
1150
1150
ty:: RePlaceholder ( ty:: Placeholder { name : br, .. } ) => {
1151
1151
if let ty:: BrNamed ( _, name) = br {
1152
- if name != "" && name != "'_" {
1152
+ if name != keywords:: Invalid . name ( ) &&
1153
+ name != keywords:: UnderscoreLifetime . name ( ) {
1153
1154
return true ;
1154
1155
}
1155
1156
}
@@ -1205,7 +1206,7 @@ impl<F: fmt::Write> FmtPrinter<'_, '_, '_, F> {
1205
1206
// `explain_region()` or `note_and_explain_region()`.
1206
1207
match * region {
1207
1208
ty:: ReEarlyBound ( ref data) => {
1208
- if data. name != "" {
1209
+ if data. name != keywords :: Invalid . name ( ) {
1209
1210
p ! ( write( "{}" , data. name) ) ;
1210
1211
return Ok ( self ) ;
1211
1212
}
@@ -1214,7 +1215,8 @@ impl<F: fmt::Write> FmtPrinter<'_, '_, '_, F> {
1214
1215
ty:: ReFree ( ty:: FreeRegion { bound_region : br, .. } ) |
1215
1216
ty:: RePlaceholder ( ty:: Placeholder { name : br, .. } ) => {
1216
1217
if let ty:: BrNamed ( _, name) = br {
1217
- if name != "" && name != "'_" {
1218
+ if name != keywords:: Invalid . name ( ) &&
1219
+ name != keywords:: UnderscoreLifetime . name ( ) {
1218
1220
p ! ( write( "{}" , name) ) ;
1219
1221
return Ok ( self ) ;
1220
1222
}
@@ -1283,12 +1285,12 @@ impl<F: fmt::Write> FmtPrinter<'_, 'gcx, 'tcx, F> {
1283
1285
) -> Result < Self , fmt:: Error >
1284
1286
where T : Print < ' gcx , ' tcx , Self , Output = Self , Error = fmt:: Error > + TypeFoldable < ' tcx >
1285
1287
{
1286
- fn name_by_region_index ( index : usize ) -> InternedString {
1288
+ fn name_by_region_index ( index : usize ) -> Symbol {
1287
1289
match index {
1288
1290
0 => Symbol :: intern ( "'r" ) ,
1289
1291
1 => Symbol :: intern ( "'s" ) ,
1290
1292
i => Symbol :: intern ( & format ! ( "'t{}" , i-2 ) ) ,
1291
- } . as_interned_str ( )
1293
+ }
1292
1294
}
1293
1295
1294
1296
// Replace any anonymous late-bound regions with named
@@ -1351,7 +1353,7 @@ impl<F: fmt::Write> FmtPrinter<'_, 'gcx, 'tcx, F> {
1351
1353
where T : TypeFoldable < ' tcx >
1352
1354
{
1353
1355
1354
- struct LateBoundRegionNameCollector < ' a > ( & ' a mut FxHashSet < InternedString > ) ;
1356
+ struct LateBoundRegionNameCollector < ' a > ( & ' a mut FxHashSet < Symbol > ) ;
1355
1357
impl < ' tcx > ty:: fold:: TypeVisitor < ' tcx > for LateBoundRegionNameCollector < ' _ > {
1356
1358
fn visit_region ( & mut self , r : ty:: Region < ' tcx > ) -> bool {
1357
1359
match * r {
0 commit comments