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