@@ -34,7 +34,7 @@ use crate::ty::codec::{TyDecoder, TyEncoder};
34
34
use crate :: ty:: print:: { FmtPrinter , Printer , pretty_print_const, with_no_trimmed_paths} ;
35
35
use crate :: ty:: visit:: TypeVisitableExt ;
36
36
use crate :: ty:: {
37
- self , AdtDef , GenericArg , GenericArgsRef , Instance , InstanceKind , List , Ty , TyCtxt , TypingEnv ,
37
+ self , GenericArg , GenericArgsRef , Instance , InstanceKind , List , Ty , TyCtxt , TypingEnv ,
38
38
UserTypeAnnotationIndex ,
39
39
} ;
40
40
@@ -1472,53 +1472,10 @@ pub struct UserTypeProjections {
1472
1472
pub contents : Vec < UserTypeProjection > ,
1473
1473
}
1474
1474
1475
- impl < ' tcx > UserTypeProjections {
1476
- pub fn none ( ) -> Self {
1477
- UserTypeProjections { contents : vec ! [ ] }
1478
- }
1479
-
1480
- pub fn is_empty ( & self ) -> bool {
1481
- self . contents . is_empty ( )
1482
- }
1483
-
1475
+ impl UserTypeProjections {
1484
1476
pub fn projections ( & self ) -> impl Iterator < Item = & UserTypeProjection > + ExactSizeIterator {
1485
1477
self . contents . iter ( )
1486
1478
}
1487
-
1488
- pub fn push_user_type ( mut self , base_user_type : UserTypeAnnotationIndex ) -> Self {
1489
- self . contents . push ( UserTypeProjection { base : base_user_type, projs : vec ! [ ] } ) ;
1490
- self
1491
- }
1492
-
1493
- fn map_projections ( mut self , f : impl FnMut ( UserTypeProjection ) -> UserTypeProjection ) -> Self {
1494
- self . contents = self . contents . into_iter ( ) . map ( f) . collect ( ) ;
1495
- self
1496
- }
1497
-
1498
- pub fn index ( self ) -> Self {
1499
- self . map_projections ( |pat_ty_proj| pat_ty_proj. index ( ) )
1500
- }
1501
-
1502
- pub fn subslice ( self , from : u64 , to : u64 ) -> Self {
1503
- self . map_projections ( |pat_ty_proj| pat_ty_proj. subslice ( from, to) )
1504
- }
1505
-
1506
- pub fn deref ( self ) -> Self {
1507
- self . map_projections ( |pat_ty_proj| pat_ty_proj. deref ( ) )
1508
- }
1509
-
1510
- pub fn leaf ( self , field : FieldIdx ) -> Self {
1511
- self . map_projections ( |pat_ty_proj| pat_ty_proj. leaf ( field) )
1512
- }
1513
-
1514
- pub fn variant (
1515
- self ,
1516
- adt_def : AdtDef < ' tcx > ,
1517
- variant_index : VariantIdx ,
1518
- field_index : FieldIdx ,
1519
- ) -> Self {
1520
- self . map_projections ( |pat_ty_proj| pat_ty_proj. variant ( adt_def, variant_index, field_index) )
1521
- }
1522
1479
}
1523
1480
1524
1481
/// Encodes the effect of a user-supplied type annotation on the
@@ -1543,42 +1500,6 @@ pub struct UserTypeProjection {
1543
1500
pub projs : Vec < ProjectionKind > ,
1544
1501
}
1545
1502
1546
- impl UserTypeProjection {
1547
- pub ( crate ) fn index ( mut self ) -> Self {
1548
- self . projs . push ( ProjectionElem :: Index ( ( ) ) ) ;
1549
- self
1550
- }
1551
-
1552
- pub ( crate ) fn subslice ( mut self , from : u64 , to : u64 ) -> Self {
1553
- self . projs . push ( ProjectionElem :: Subslice { from, to, from_end : true } ) ;
1554
- self
1555
- }
1556
-
1557
- pub ( crate ) fn deref ( mut self ) -> Self {
1558
- self . projs . push ( ProjectionElem :: Deref ) ;
1559
- self
1560
- }
1561
-
1562
- pub ( crate ) fn leaf ( mut self , field : FieldIdx ) -> Self {
1563
- self . projs . push ( ProjectionElem :: Field ( field, ( ) ) ) ;
1564
- self
1565
- }
1566
-
1567
- pub ( crate ) fn variant (
1568
- mut self ,
1569
- adt_def : AdtDef < ' _ > ,
1570
- variant_index : VariantIdx ,
1571
- field_index : FieldIdx ,
1572
- ) -> Self {
1573
- self . projs . push ( ProjectionElem :: Downcast (
1574
- Some ( adt_def. variant ( variant_index) . name ) ,
1575
- variant_index,
1576
- ) ) ;
1577
- self . projs . push ( ProjectionElem :: Field ( field_index, ( ) ) ) ;
1578
- self
1579
- }
1580
- }
1581
-
1582
1503
rustc_index:: newtype_index! {
1583
1504
#[ derive( HashStable ) ]
1584
1505
#[ encodable]
0 commit comments