@@ -34,7 +34,7 @@ use crate::ty::codec::{TyDecoder, TyEncoder};
3434use crate :: ty:: print:: { FmtPrinter , Printer , pretty_print_const, with_no_trimmed_paths} ;
3535use crate :: ty:: visit:: TypeVisitableExt ;
3636use crate :: ty:: {
37- self , AdtDef , GenericArg , GenericArgsRef , Instance , InstanceKind , List , Ty , TyCtxt , TypingEnv ,
37+ self , GenericArg , GenericArgsRef , Instance , InstanceKind , List , Ty , TyCtxt , TypingEnv ,
3838 UserTypeAnnotationIndex ,
3939} ;
4040
@@ -1483,53 +1483,10 @@ pub struct UserTypeProjections {
14831483 pub contents : Vec < UserTypeProjection > ,
14841484}
14851485
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 {
14951487 pub fn projections ( & self ) -> impl Iterator < Item = & UserTypeProjection > + ExactSizeIterator {
14961488 self . contents . iter ( )
14971489 }
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- }
15331490}
15341491
15351492/// Encodes the effect of a user-supplied type annotation on the
@@ -1554,42 +1511,6 @@ pub struct UserTypeProjection {
15541511 pub projs : Vec < ProjectionKind > ,
15551512}
15561513
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-
15931514rustc_index:: newtype_index! {
15941515 #[ derive( HashStable ) ]
15951516 #[ encodable]
0 commit comments