@@ -137,12 +137,6 @@ enum Scope<'a> {
137
137
s : ScopeRef < ' a > ,
138
138
} ,
139
139
140
- /// A scope which either determines unspecified lifetimes or errors
141
- /// on them (e.g., due to ambiguity).
142
- Elision {
143
- s : ScopeRef < ' a > ,
144
- } ,
145
-
146
140
/// Use a specific lifetime (if `Some`) or leave it unset (to be
147
141
/// inferred in a function body or potentially error outside one),
148
142
/// for the default choice of lifetime in a trait object type.
@@ -211,7 +205,6 @@ impl<'a> fmt::Debug for TruncatedScopeDebug<'a> {
211
205
Scope :: Body { id, s : _ } => {
212
206
f. debug_struct ( "Body" ) . field ( "id" , id) . field ( "s" , & ".." ) . finish ( )
213
207
}
214
- Scope :: Elision { s : _ } => f. debug_struct ( "Elision" ) . field ( "s" , & ".." ) . finish ( ) ,
215
208
Scope :: ObjectLifetimeDefault { lifetime, s : _ } => f
216
209
. debug_struct ( "ObjectLifetimeDefault" )
217
210
. field ( "lifetime" , lifetime)
@@ -325,9 +318,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
325
318
break ( vec ! [ ] , BinderScopeType :: Normal ) ;
326
319
}
327
320
328
- Scope :: Elision { s, .. }
329
- | Scope :: ObjectLifetimeDefault { s, .. }
330
- | Scope :: AnonConstBoundary { s } => {
321
+ Scope :: ObjectLifetimeDefault { s, .. } | Scope :: AnonConstBoundary { s } => {
331
322
scope = s;
332
323
}
333
324
@@ -526,16 +517,12 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
526
517
| hir:: ItemKind :: Macro ( ..)
527
518
| hir:: ItemKind :: Mod ( ..)
528
519
| hir:: ItemKind :: ForeignMod { .. }
520
+ | hir:: ItemKind :: Static ( ..)
521
+ | hir:: ItemKind :: Const ( ..)
529
522
| hir:: ItemKind :: GlobalAsm ( ..) => {
530
523
// These sorts of items have no lifetime parameters at all.
531
524
intravisit:: walk_item ( self , item) ;
532
525
}
533
- hir:: ItemKind :: Static ( ..) | hir:: ItemKind :: Const ( ..) => {
534
- // No lifetime parameters, but implied 'static.
535
- self . with ( Scope :: Elision { s : self . scope } , |this| {
536
- intravisit:: walk_item ( this, item)
537
- } ) ;
538
- }
539
526
hir:: ItemKind :: OpaqueTy ( hir:: OpaqueTy {
540
527
origin : hir:: OpaqueTyOrigin :: TyAlias { .. } ,
541
528
..
@@ -727,12 +714,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
727
714
// Elided lifetimes are not allowed in non-return
728
715
// position impl Trait
729
716
let scope = Scope :: TraitRefBoundary { s : self . scope } ;
730
- self . with ( scope, |this| {
731
- let scope = Scope :: Elision { s : this. scope } ;
732
- this. with ( scope, |this| {
733
- intravisit:: walk_item ( this, opaque_ty) ;
734
- } )
735
- } ) ;
717
+ self . with ( scope, |this| intravisit:: walk_item ( this, opaque_ty) ) ;
736
718
737
719
return ;
738
720
}
@@ -1293,8 +1275,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
1293
1275
scope = s;
1294
1276
}
1295
1277
1296
- Scope :: Elision { s, .. }
1297
- | Scope :: ObjectLifetimeDefault { s, .. }
1278
+ Scope :: ObjectLifetimeDefault { s, .. }
1298
1279
| Scope :: Supertrait { s, .. }
1299
1280
| Scope :: TraitRefBoundary { s, .. }
1300
1281
| Scope :: AnonConstBoundary { s } => {
@@ -1357,7 +1338,6 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
1357
1338
Scope :: Root { .. } => break ,
1358
1339
Scope :: Binder { s, .. }
1359
1340
| Scope :: Body { s, .. }
1360
- | Scope :: Elision { s, .. }
1361
1341
| Scope :: ObjectLifetimeDefault { s, .. }
1362
1342
| Scope :: Supertrait { s, .. }
1363
1343
| Scope :: TraitRefBoundary { s, .. }
@@ -1409,8 +1389,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
1409
1389
scope = s;
1410
1390
}
1411
1391
1412
- Scope :: Elision { s, .. }
1413
- | Scope :: ObjectLifetimeDefault { s, .. }
1392
+ Scope :: ObjectLifetimeDefault { s, .. }
1414
1393
| Scope :: Supertrait { s, .. }
1415
1394
| Scope :: TraitRefBoundary { s, .. } => {
1416
1395
scope = s;
@@ -1483,7 +1462,6 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
1483
1462
Scope :: Root { .. } => break ,
1484
1463
Scope :: Binder { s, .. }
1485
1464
| Scope :: Body { s, .. }
1486
- | Scope :: Elision { s, .. }
1487
1465
| Scope :: ObjectLifetimeDefault { s, .. }
1488
1466
| Scope :: Supertrait { s, .. }
1489
1467
| Scope :: TraitRefBoundary { s, .. }
@@ -1564,7 +1542,6 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
1564
1542
Scope :: Body { .. } => break true ,
1565
1543
1566
1544
Scope :: Binder { s, .. }
1567
- | Scope :: Elision { s, .. }
1568
1545
| Scope :: ObjectLifetimeDefault { s, .. }
1569
1546
| Scope :: Supertrait { s, .. }
1570
1547
| Scope :: TraitRefBoundary { s, .. }
@@ -1832,14 +1809,20 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
1832
1809
output : Option < & ' tcx hir:: Ty < ' tcx > > ,
1833
1810
in_closure : bool ,
1834
1811
) {
1835
- self . with ( Scope :: Elision { s : self . scope } , |this| {
1836
- for input in inputs {
1837
- this. visit_ty ( input) ;
1838
- }
1839
- if !in_closure && let Some ( output) = output {
1840
- this. visit_ty ( output) ;
1841
- }
1842
- } ) ;
1812
+ self . with (
1813
+ Scope :: ObjectLifetimeDefault {
1814
+ lifetime : Some ( ResolvedArg :: StaticLifetime ) ,
1815
+ s : self . scope ,
1816
+ } ,
1817
+ |this| {
1818
+ for input in inputs {
1819
+ this. visit_ty ( input) ;
1820
+ }
1821
+ if !in_closure && let Some ( output) = output {
1822
+ this. visit_ty ( output) ;
1823
+ }
1824
+ } ,
1825
+ ) ;
1843
1826
if in_closure && let Some ( output) = output {
1844
1827
self . visit_ty ( output) ;
1845
1828
}
@@ -1859,7 +1842,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
1859
1842
scope = s;
1860
1843
}
1861
1844
1862
- Scope :: Root { .. } | Scope :: Elision { .. } => break ResolvedArg :: StaticLifetime ,
1845
+ Scope :: Root { .. } => break ResolvedArg :: StaticLifetime ,
1863
1846
1864
1847
Scope :: Body { .. } | Scope :: ObjectLifetimeDefault { lifetime : None , .. } => return ,
1865
1848
0 commit comments