@@ -1556,13 +1556,7 @@ pub(crate) enum Type {
1556
1556
BorrowedRef { lifetime : Option < Lifetime > , mutability : Mutability , type_ : Box < Type > } ,
1557
1557
1558
1558
/// 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 > ) ,
1566
1560
1567
1561
/// A type that is inferred: `_`
1568
1562
Infer ,
@@ -1660,8 +1654,8 @@ impl Type {
1660
1654
}
1661
1655
1662
1656
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 ( ) ) )
1665
1659
} else {
1666
1660
None
1667
1661
}
@@ -1685,7 +1679,7 @@ impl Type {
1685
1679
Slice ( ..) => PrimitiveType :: Slice ,
1686
1680
Array ( ..) => PrimitiveType :: Array ,
1687
1681
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) ,
1689
1683
Generic ( _) | Infer | ImplTrait ( _) => return None ,
1690
1684
} ;
1691
1685
cache. and_then ( |c| Primitive ( t) . def_id ( c) )
@@ -1699,6 +1693,15 @@ impl Type {
1699
1693
}
1700
1694
}
1701
1695
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
+
1702
1705
/// A primitive (aka, builtin) type.
1703
1706
///
1704
1707
/// This represents things like `i32`, `str`, etc.
@@ -2490,11 +2493,11 @@ mod size_asserts {
2490
2493
// These are in alphabetical order, which is easy to maintain.
2491
2494
static_assert_size ! ( Crate , 72 ) ; // frequently moved by-value
2492
2495
static_assert_size ! ( DocFragment , 32 ) ;
2493
- static_assert_size ! ( GenericArg , 80 ) ;
2496
+ static_assert_size ! ( GenericArg , 64 ) ;
2494
2497
static_assert_size ! ( GenericArgs , 32 ) ;
2495
2498
static_assert_size ! ( GenericParamDef , 56 ) ;
2496
2499
static_assert_size ! ( Item , 56 ) ;
2497
2500
static_assert_size ! ( ItemKind , 112 ) ;
2498
2501
static_assert_size ! ( PathSegment , 40 ) ;
2499
- static_assert_size ! ( Type , 72 ) ;
2502
+ static_assert_size ! ( Type , 56 ) ;
2500
2503
}
0 commit comments