@@ -462,6 +462,14 @@ pub struct CReaderCacheKey {
462
462
#[ rustc_pass_by_value]
463
463
pub struct Ty < ' tcx > ( Interned < ' tcx , WithCachedTypeInfo < TyKind < ' tcx > > > ) ;
464
464
465
+ impl < ' tcx > IntoKind for Ty < ' tcx > {
466
+ type Kind = TyKind < ' tcx > ;
467
+
468
+ fn kind ( & self ) -> TyKind < ' tcx > {
469
+ ( * self ) . kind ( ) . clone ( )
470
+ }
471
+ }
472
+
465
473
impl EarlyParamRegion {
466
474
/// Does this early bound region have a name? Early bound regions normally
467
475
/// always have names except when using anonymous lifetimes (`'_`).
@@ -1517,7 +1525,7 @@ pub struct Placeholder<T> {
1517
1525
1518
1526
pub type PlaceholderRegion = Placeholder < BoundRegion > ;
1519
1527
1520
- impl rustc_type_ir:: Placeholder for PlaceholderRegion {
1528
+ impl < ' tcx > rustc_type_ir:: Placeholder < TyCtxt < ' tcx > > for PlaceholderRegion {
1521
1529
fn universe ( & self ) -> UniverseIndex {
1522
1530
self . universe
1523
1531
}
@@ -1526,14 +1534,18 @@ impl rustc_type_ir::Placeholder for PlaceholderRegion {
1526
1534
self . bound . var
1527
1535
}
1528
1536
1529
- fn with_updated_universe ( self , ui : UniverseIndex ) -> Self {
1530
- Placeholder { universe : ui, ..self }
1537
+ fn with_updated_universe ( & self , ui : UniverseIndex ) -> Self {
1538
+ Placeholder { universe : ui, ..* self }
1539
+ }
1540
+
1541
+ fn new ( ui : UniverseIndex , var : BoundVar ) -> Self {
1542
+ Placeholder { universe : ui, bound : BoundRegion { var, kind : BoundRegionKind :: BrAnon } }
1531
1543
}
1532
1544
}
1533
1545
1534
1546
pub type PlaceholderType = Placeholder < BoundTy > ;
1535
1547
1536
- impl rustc_type_ir:: Placeholder for PlaceholderType {
1548
+ impl < ' tcx > rustc_type_ir:: Placeholder < TyCtxt < ' tcx > > for PlaceholderType {
1537
1549
fn universe ( & self ) -> UniverseIndex {
1538
1550
self . universe
1539
1551
}
@@ -1542,8 +1554,12 @@ impl rustc_type_ir::Placeholder for PlaceholderType {
1542
1554
self . bound . var
1543
1555
}
1544
1556
1545
- fn with_updated_universe ( self , ui : UniverseIndex ) -> Self {
1546
- Placeholder { universe : ui, ..self }
1557
+ fn with_updated_universe ( & self , ui : UniverseIndex ) -> Self {
1558
+ Placeholder { universe : ui, ..* self }
1559
+ }
1560
+
1561
+ fn new ( ui : UniverseIndex , var : BoundVar ) -> Self {
1562
+ Placeholder { universe : ui, bound : BoundTy { var, kind : BoundTyKind :: Anon } }
1547
1563
}
1548
1564
}
1549
1565
@@ -1556,7 +1572,7 @@ pub struct BoundConst<'tcx> {
1556
1572
1557
1573
pub type PlaceholderConst = Placeholder < BoundVar > ;
1558
1574
1559
- impl rustc_type_ir:: Placeholder for PlaceholderConst {
1575
+ impl < ' tcx > rustc_type_ir:: Placeholder < TyCtxt < ' tcx > > for PlaceholderConst {
1560
1576
fn universe ( & self ) -> UniverseIndex {
1561
1577
self . universe
1562
1578
}
@@ -1565,8 +1581,12 @@ impl rustc_type_ir::Placeholder for PlaceholderConst {
1565
1581
self . bound
1566
1582
}
1567
1583
1568
- fn with_updated_universe ( self , ui : UniverseIndex ) -> Self {
1569
- Placeholder { universe : ui, ..self }
1584
+ fn with_updated_universe ( & self , ui : UniverseIndex ) -> Self {
1585
+ Placeholder { universe : ui, ..* self }
1586
+ }
1587
+
1588
+ fn new ( ui : UniverseIndex , var : BoundVar ) -> Self {
1589
+ Placeholder { universe : ui, bound : var }
1570
1590
}
1571
1591
}
1572
1592
0 commit comments