@@ -1556,13 +1556,7 @@ pub(crate) enum Type {
15561556 BorrowedRef { lifetime : Option < Lifetime > , mutability : Mutability , type_ : Box < Type > } ,
15571557
15581558 /// A qualified path to an associated item: `<Type as Trait>::Name`
1559- QPath {
1560- assoc : Box < PathSegment > ,
1561- self_type : Box < Type > ,
1562- /// FIXME: compute this field on demand.
1563- should_show_cast : bool ,
1564- trait_ : Path ,
1565- } ,
1559+ QPath ( Box < QPathData > ) ,
15661560
15671561 /// A type that is inferred: `_`
15681562 Infer ,
@@ -1660,8 +1654,8 @@ impl Type {
16601654 }
16611655
16621656 pub ( crate ) fn projection ( & self ) -> Option < ( & Type , DefId , PathSegment ) > {
1663- if let QPath { self_type, trait_, assoc, .. } = self {
1664- Some ( ( self_type, trait_. def_id ( ) , * assoc. clone ( ) ) )
1657+ if let QPath ( box QPathData { self_type, trait_, assoc, .. } ) = self {
1658+ Some ( ( self_type, trait_. def_id ( ) , assoc. clone ( ) ) )
16651659 } else {
16661660 None
16671661 }
@@ -1685,7 +1679,7 @@ impl Type {
16851679 Slice ( ..) => PrimitiveType :: Slice ,
16861680 Array ( ..) => PrimitiveType :: Array ,
16871681 RawPointer ( ..) => PrimitiveType :: RawPointer ,
1688- QPath { ref self_type, .. } => return self_type. inner_def_id ( cache) ,
1682+ QPath ( box QPathData { ref self_type, .. } ) => return self_type. inner_def_id ( cache) ,
16891683 Generic ( _) | Infer | ImplTrait ( _) => return None ,
16901684 } ;
16911685 cache. and_then ( |c| Primitive ( t) . def_id ( c) )
@@ -1699,6 +1693,15 @@ impl Type {
16991693 }
17001694}
17011695
1696+ #[ derive( Clone , PartialEq , Eq , Debug , Hash ) ]
1697+ pub ( crate ) struct QPathData {
1698+ pub assoc : PathSegment ,
1699+ pub self_type : Type ,
1700+ /// FIXME: compute this field on demand.
1701+ pub should_show_cast : bool ,
1702+ pub trait_ : Path ,
1703+ }
1704+
17021705/// A primitive (aka, builtin) type.
17031706///
17041707/// This represents things like `i32`, `str`, etc.
@@ -2490,11 +2493,11 @@ mod size_asserts {
24902493 // These are in alphabetical order, which is easy to maintain.
24912494 static_assert_size ! ( Crate , 72 ) ; // frequently moved by-value
24922495 static_assert_size ! ( DocFragment , 32 ) ;
2493- static_assert_size ! ( GenericArg , 80 ) ;
2496+ static_assert_size ! ( GenericArg , 64 ) ;
24942497 static_assert_size ! ( GenericArgs , 32 ) ;
24952498 static_assert_size ! ( GenericParamDef , 56 ) ;
24962499 static_assert_size ! ( Item , 56 ) ;
24972500 static_assert_size ! ( ItemKind , 112 ) ;
24982501 static_assert_size ! ( PathSegment , 40 ) ;
2499- static_assert_size ! ( Type , 72 ) ;
2502+ static_assert_size ! ( Type , 56 ) ;
25002503}
0 commit comments