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