@@ -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
@@ -1483,53 +1483,10 @@ pub struct UserTypeProjections {
1483
1483
pub contents : Vec < UserTypeProjection > ,
1484
1484
}
1485
1485
1486
- impl < ' tcx > UserTypeProjections {
1487
- pub fn none ( ) -> Self {
1488
- UserTypeProjections { contents : vec ! [ ] }
1489
- }
1490
-
1491
- pub fn is_empty ( & self ) -> bool {
1492
- self . contents . is_empty ( )
1493
- }
1494
-
1486
+ impl UserTypeProjections {
1495
1487
pub fn projections ( & self ) -> impl Iterator < Item = & UserTypeProjection > + ExactSizeIterator {
1496
1488
self . contents . iter ( )
1497
1489
}
1498
-
1499
- pub fn push_user_type ( mut self , base_user_type : UserTypeAnnotationIndex ) -> Self {
1500
- self . contents . push ( UserTypeProjection { base : base_user_type, projs : vec ! [ ] } ) ;
1501
- self
1502
- }
1503
-
1504
- fn map_projections ( mut self , f : impl FnMut ( UserTypeProjection ) -> UserTypeProjection ) -> Self {
1505
- self . contents = self . contents . into_iter ( ) . map ( f) . collect ( ) ;
1506
- self
1507
- }
1508
-
1509
- pub fn index ( self ) -> Self {
1510
- self . map_projections ( |pat_ty_proj| pat_ty_proj. index ( ) )
1511
- }
1512
-
1513
- pub fn subslice ( self , from : u64 , to : u64 ) -> Self {
1514
- self . map_projections ( |pat_ty_proj| pat_ty_proj. subslice ( from, to) )
1515
- }
1516
-
1517
- pub fn deref ( self ) -> Self {
1518
- self . map_projections ( |pat_ty_proj| pat_ty_proj. deref ( ) )
1519
- }
1520
-
1521
- pub fn leaf ( self , field : FieldIdx ) -> Self {
1522
- self . map_projections ( |pat_ty_proj| pat_ty_proj. leaf ( field) )
1523
- }
1524
-
1525
- pub fn variant (
1526
- self ,
1527
- adt_def : AdtDef < ' tcx > ,
1528
- variant_index : VariantIdx ,
1529
- field_index : FieldIdx ,
1530
- ) -> Self {
1531
- self . map_projections ( |pat_ty_proj| pat_ty_proj. variant ( adt_def, variant_index, field_index) )
1532
- }
1533
1490
}
1534
1491
1535
1492
/// Encodes the effect of a user-supplied type annotation on the
@@ -1554,42 +1511,6 @@ pub struct UserTypeProjection {
1554
1511
pub projs : Vec < ProjectionKind > ,
1555
1512
}
1556
1513
1557
- impl UserTypeProjection {
1558
- pub ( crate ) fn index ( mut self ) -> Self {
1559
- self . projs . push ( ProjectionElem :: Index ( ( ) ) ) ;
1560
- self
1561
- }
1562
-
1563
- pub ( crate ) fn subslice ( mut self , from : u64 , to : u64 ) -> Self {
1564
- self . projs . push ( ProjectionElem :: Subslice { from, to, from_end : true } ) ;
1565
- self
1566
- }
1567
-
1568
- pub ( crate ) fn deref ( mut self ) -> Self {
1569
- self . projs . push ( ProjectionElem :: Deref ) ;
1570
- self
1571
- }
1572
-
1573
- pub ( crate ) fn leaf ( mut self , field : FieldIdx ) -> Self {
1574
- self . projs . push ( ProjectionElem :: Field ( field, ( ) ) ) ;
1575
- self
1576
- }
1577
-
1578
- pub ( crate ) fn variant (
1579
- mut self ,
1580
- adt_def : AdtDef < ' _ > ,
1581
- variant_index : VariantIdx ,
1582
- field_index : FieldIdx ,
1583
- ) -> Self {
1584
- self . projs . push ( ProjectionElem :: Downcast (
1585
- Some ( adt_def. variant ( variant_index) . name ) ,
1586
- variant_index,
1587
- ) ) ;
1588
- self . projs . push ( ProjectionElem :: Field ( field_index, ( ) ) ) ;
1589
- self
1590
- }
1591
- }
1592
-
1593
1514
rustc_index:: newtype_index! {
1594
1515
#[ derive( HashStable ) ]
1595
1516
#[ encodable]
0 commit comments