@@ -38,7 +38,6 @@ use rustc_middle::mir::Mutability;
38
38
use rustc_middle:: ty:: adjustment:: AllowTwoPhase ;
39
39
use rustc_middle:: ty:: cast:: { CastKind , CastTy } ;
40
40
use rustc_middle:: ty:: error:: TypeError ;
41
- use rustc_middle:: ty:: subst:: SubstsRef ;
42
41
use rustc_middle:: ty:: { self , Ty , TypeAndMut , TypeVisitable , VariantDef } ;
43
42
use rustc_session:: lint;
44
43
use rustc_session:: Session ;
@@ -75,10 +74,8 @@ enum PointerKind<'tcx> {
75
74
VTable ( Option < DefId > ) ,
76
75
/// Slice
77
76
Length ,
78
- /// The unsize info of this projection
79
- OfProjection ( ty:: AliasTy < ' tcx > ) ,
80
- /// The unsize info of this opaque ty
81
- OfOpaque ( DefId , SubstsRef < ' tcx > ) ,
77
+ /// The unsize info of this projection or opaque type
78
+ OfAlias ( ty:: AliasTy < ' tcx > ) ,
82
79
/// The unsize info of this parameter
83
80
OfParam ( ty:: ParamTy ) ,
84
81
}
@@ -118,10 +115,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
118
115
// Pointers to foreign types are thin, despite being unsized
119
116
ty:: Foreign ( ..) => Some ( PointerKind :: Thin ) ,
120
117
// We should really try to normalize here.
121
- ty:: Alias ( ty:: Projection , pi) => Some ( PointerKind :: OfProjection ( pi) ) ,
122
- ty:: Alias ( ty:: Opaque , ty:: AliasTy { def_id, substs } ) => {
123
- Some ( PointerKind :: OfOpaque ( def_id, substs) )
124
- }
118
+ ty:: Alias ( _, pi) => Some ( PointerKind :: OfAlias ( pi) ) ,
125
119
ty:: Param ( p) => Some ( PointerKind :: OfParam ( p) ) ,
126
120
// Insufficient type information.
127
121
ty:: Placeholder ( ..) | ty:: Bound ( ..) | ty:: Infer ( _) => None ,
@@ -978,11 +972,9 @@ impl<'a, 'tcx> CastCheck<'tcx> {
978
972
Some ( PointerKind :: Thin ) => Ok ( CastKind :: AddrPtrCast ) ,
979
973
Some ( PointerKind :: VTable ( _) ) => Err ( CastError :: IntToFatCast ( Some ( "a vtable" ) ) ) ,
980
974
Some ( PointerKind :: Length ) => Err ( CastError :: IntToFatCast ( Some ( "a length" ) ) ) ,
981
- Some (
982
- PointerKind :: OfProjection ( _)
983
- | PointerKind :: OfOpaque ( _, _)
984
- | PointerKind :: OfParam ( _) ,
985
- ) => Err ( CastError :: IntToFatCast ( None ) ) ,
975
+ Some ( PointerKind :: OfAlias ( _) | PointerKind :: OfParam ( _) ) => {
976
+ Err ( CastError :: IntToFatCast ( None ) )
977
+ }
986
978
}
987
979
}
988
980
0 commit comments