File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -98,11 +98,15 @@ fn clif_pair_type_from_ty<'tcx>(
9898
9999/// Is a pointer to this type a fat ptr?
100100pub ( crate ) fn has_ptr_meta < ' tcx > ( tcx : TyCtxt < ' tcx > , ty : Ty < ' tcx > ) -> bool {
101- let ptr_ty = Ty :: new_ptr ( tcx, TypeAndMut { ty, mutbl : rustc_hir:: Mutability :: Not } ) ;
102- match & tcx. layout_of ( ParamEnv :: reveal_all ( ) . and ( ptr_ty) ) . unwrap ( ) . abi {
103- Abi :: Scalar ( _) => false ,
104- Abi :: ScalarPair ( _, _) => true ,
105- abi => unreachable ! ( "Abi of ptr to {:?} is {:?}???" , ty, abi) ,
101+ if ty. is_sized ( tcx, ParamEnv :: reveal_all ( ) ) {
102+ return false ;
103+ }
104+
105+ let tail = tcx. struct_tail_erasing_lifetimes ( ty, ParamEnv :: reveal_all ( ) ) ;
106+ match tail. kind ( ) {
107+ ty:: Foreign ( ..) => false ,
108+ ty:: Str | ty:: Slice ( ..) | ty:: Dynamic ( ..) => true ,
109+ _ => bug ! ( "unexpected unsized tail: {:?}" , tail) ,
106110 }
107111}
108112
You can’t perform that action at this time.
0 commit comments