@@ -33,8 +33,8 @@ use crate::mir::interpret::{AllocRange, Scalar};
3333use crate :: ty:: codec:: { TyDecoder , TyEncoder } ;
3434use crate :: ty:: print:: { FmtPrinter , Printer , pretty_print_const, with_no_trimmed_paths} ;
3535use 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 ,
3838} ;
3939
4040mod basic_blocks;
@@ -1482,53 +1482,10 @@ pub struct UserTypeProjections {
14821482 pub contents : Vec < UserTypeProjection > ,
14831483}
14841484
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 {
14941486 pub fn projections ( & self ) -> impl Iterator < Item = & UserTypeProjection > + ExactSizeIterator {
14951487 self . contents . iter ( )
14961488 }
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- }
15321489}
15331490
15341491/// Encodes the effect of a user-supplied type annotation on the
@@ -1553,42 +1510,6 @@ pub struct UserTypeProjection {
15531510 pub projs : Vec < ProjectionKind > ,
15541511}
15551512
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-
15921513rustc_index:: newtype_index! {
15931514 #[ derive( HashStable ) ]
15941515 #[ encodable]
0 commit comments