@@ -727,7 +727,7 @@ pub(crate) enum ItemKind {
727
727
OpaqueTyItem ( OpaqueTy ) ,
728
728
StaticItem ( Static ) ,
729
729
ConstantItem ( Constant ) ,
730
- TraitItem ( Trait ) ,
730
+ TraitItem ( Box < Trait > ) ,
731
731
TraitAliasItem ( TraitAlias ) ,
732
732
ImplItem ( Box < Impl > ) ,
733
733
/// A required method in a trait declaration meaning it's only a function signature.
@@ -1550,13 +1550,7 @@ pub(crate) enum Type {
1550
1550
BorrowedRef { lifetime : Option < Lifetime > , mutability : Mutability , type_ : Box < Type > } ,
1551
1551
1552
1552
/// A qualified path to an associated item: `<Type as Trait>::Name`
1553
- QPath {
1554
- assoc : Box < PathSegment > ,
1555
- self_type : Box < Type > ,
1556
- /// FIXME: compute this field on demand.
1557
- should_show_cast : bool ,
1558
- trait_ : Path ,
1559
- } ,
1553
+ QPath ( Box < QPathData > ) ,
1560
1554
1561
1555
/// A type that is inferred: `_`
1562
1556
Infer ,
@@ -1654,8 +1648,8 @@ impl Type {
1654
1648
}
1655
1649
1656
1650
pub ( crate ) fn projection ( & self ) -> Option < ( & Type , DefId , PathSegment ) > {
1657
- if let QPath { self_type, trait_, assoc, .. } = self {
1658
- Some ( ( self_type, trait_. def_id ( ) , * assoc. clone ( ) ) )
1651
+ if let QPath ( box QPathData { self_type, trait_, assoc, .. } ) = self {
1652
+ Some ( ( self_type, trait_. def_id ( ) , assoc. clone ( ) ) )
1659
1653
} else {
1660
1654
None
1661
1655
}
@@ -1679,7 +1673,7 @@ impl Type {
1679
1673
Slice ( ..) => PrimitiveType :: Slice ,
1680
1674
Array ( ..) => PrimitiveType :: Array ,
1681
1675
RawPointer ( ..) => PrimitiveType :: RawPointer ,
1682
- QPath { ref self_type, .. } => return self_type. inner_def_id ( cache) ,
1676
+ QPath ( box QPathData { ref self_type, .. } ) => return self_type. inner_def_id ( cache) ,
1683
1677
Generic ( _) | Infer | ImplTrait ( _) => return None ,
1684
1678
} ;
1685
1679
cache. and_then ( |c| Primitive ( t) . def_id ( c) )
@@ -1693,6 +1687,15 @@ impl Type {
1693
1687
}
1694
1688
}
1695
1689
1690
+ #[ derive( Clone , PartialEq , Eq , Debug , Hash ) ]
1691
+ pub ( crate ) struct QPathData {
1692
+ pub assoc : PathSegment ,
1693
+ pub self_type : Type ,
1694
+ /// FIXME: compute this field on demand.
1695
+ pub should_show_cast : bool ,
1696
+ pub trait_ : Path ,
1697
+ }
1698
+
1696
1699
/// A primitive (aka, builtin) type.
1697
1700
///
1698
1701
/// This represents things like `i32`, `str`, etc.
@@ -2484,11 +2487,11 @@ mod size_asserts {
2484
2487
// These are in alphabetical order, which is easy to maintain.
2485
2488
static_assert_size ! ( Crate , 72 ) ; // frequently moved by-value
2486
2489
static_assert_size ! ( DocFragment , 32 ) ;
2487
- static_assert_size ! ( GenericArg , 80 ) ;
2490
+ static_assert_size ! ( GenericArg , 64 ) ;
2488
2491
static_assert_size ! ( GenericArgs , 32 ) ;
2489
2492
static_assert_size ! ( GenericParamDef , 56 ) ;
2490
2493
static_assert_size ! ( Item , 56 ) ;
2491
- static_assert_size ! ( ItemKind , 112 ) ;
2494
+ static_assert_size ! ( ItemKind , 96 ) ;
2492
2495
static_assert_size ! ( PathSegment , 40 ) ;
2493
- static_assert_size ! ( Type , 72 ) ;
2496
+ static_assert_size ! ( Type , 56 ) ;
2494
2497
}
0 commit comments