@@ -1564,13 +1564,7 @@ pub(crate) enum Type {
15641564 BorrowedRef { lifetime : Option < Lifetime > , mutability : Mutability , type_ : Box < Type > } ,
15651565
15661566 /// A qualified path to an associated item: `<Type as Trait>::Name`
1567- QPath {
1568- assoc : Box < PathSegment > ,
1569- self_type : Box < Type > ,
1570- /// FIXME: compute this field on demand.
1571- should_show_cast : bool ,
1572- trait_ : Path ,
1573- } ,
1567+ QPath ( Box < QPathData > ) ,
15741568
15751569 /// A type that is inferred: `_`
15761570 Infer ,
@@ -1581,7 +1575,16 @@ pub(crate) enum Type {
15811575
15821576// `Type` is used a lot. Make sure it doesn't unintentionally get bigger.
15831577#[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
1584- rustc_data_structures:: static_assert_size!( Type , 72 ) ;
1578+ rustc_data_structures:: static_assert_size!( Type , 56 ) ;
1579+
1580+ #[ derive( Clone , PartialEq , Eq , Debug , Hash ) ]
1581+ pub ( crate ) struct QPathData {
1582+ pub ( crate ) assoc : PathSegment ,
1583+ pub ( crate ) self_type : Type ,
1584+ /// FIXME: compute this field on demand.
1585+ pub ( crate ) should_show_cast : bool ,
1586+ pub ( crate ) trait_ : Path ,
1587+ }
15851588
15861589impl Type {
15871590 /// When comparing types for equality, it can help to ignore `&` wrapping.
@@ -1676,8 +1679,9 @@ impl Type {
16761679 }
16771680
16781681 pub ( crate ) fn projection ( & self ) -> Option < ( & Type , DefId , PathSegment ) > {
1679- if let QPath { self_type, trait_, assoc, .. } = self {
1680- Some ( ( self_type, trait_. def_id ( ) , * assoc. clone ( ) ) )
1682+ if let QPath ( qpath) = self {
1683+ let QPathData { self_type, trait_, assoc, .. } = & * * qpath;
1684+ Some ( ( self_type, trait_. def_id ( ) , assoc. clone ( ) ) )
16811685 } else {
16821686 None
16831687 }
@@ -1701,7 +1705,7 @@ impl Type {
17011705 Slice ( ..) => PrimitiveType :: Slice ,
17021706 Array ( ..) => PrimitiveType :: Array ,
17031707 RawPointer ( ..) => PrimitiveType :: RawPointer ,
1704- QPath { ref self_type , .. } => return self_type. inner_def_id ( cache) ,
1708+ QPath ( ref qpath ) => return qpath . self_type . inner_def_id ( cache) ,
17051709 Generic ( _) | Infer | ImplTrait ( _) => return None ,
17061710 } ;
17071711 cache. and_then ( |c| Primitive ( t) . def_id ( c) )
@@ -2222,7 +2226,7 @@ pub(crate) enum GenericArg {
22222226// `GenericArg` can occur many times in a single `Path`, so make sure it
22232227// doesn't increase in size unexpectedly.
22242228#[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
2225- rustc_data_structures:: static_assert_size!( GenericArg , 80 ) ;
2229+ rustc_data_structures:: static_assert_size!( GenericArg , 64 ) ;
22262230
22272231#[ derive( Clone , PartialEq , Eq , Debug , Hash ) ]
22282232pub ( crate ) enum GenericArgs {
0 commit comments