@@ -14,7 +14,7 @@ use rustc::traits::{FulfillmentContext, Normalized, ObligationCause};
1414use rustc:: traits:: query:: { CanonicalTyGoal , NoSolution } ;
1515use rustc:: traits:: query:: dropck_outlives:: { DtorckConstraint , DropckOutlivesResult } ;
1616use rustc:: ty:: { self , ParamEnvAnd , Ty , TyCtxt } ;
17- use rustc:: ty:: subst:: { UnpackedKind , Subst } ;
17+ use rustc:: ty:: subst:: { Subst , Substs } ;
1818use rustc:: util:: nodemap:: FxHashSet ;
1919use rustc_data_structures:: sync:: Lrc ;
2020use syntax:: codemap:: { Span , DUMMY_SP } ;
@@ -280,14 +280,11 @@ crate fn adt_dtorck_constraint<'a, 'tcx>(
280280 if def. is_phantom_data ( ) {
281281 // The first generic parameter here is guaranteed to be a type because it's
282282 // `PhantomData`.
283- let param = & tcx. generics_of ( def_id) . params [ 0 ] ;
284- let ty = match tcx. mk_param_from_def ( param) . unpack ( ) {
285- UnpackedKind :: Type ( ty) => ty,
286- _ => unreachable ! ( ) ,
287- } ;
283+ let substs = Substs :: identity_for_item ( tcx, def_id) ;
284+ assert_eq ! ( substs. len( ) , 1 ) ;
288285 let result = DtorckConstraint {
289286 outlives : vec ! [ ] ,
290- dtorck_types : vec ! [ ty ] ,
287+ dtorck_types : vec ! [ substs . type_at ( 0 ) ] ,
291288 overflows : vec ! [ ] ,
292289 } ;
293290 debug ! ( "dtorck_constraint: {:?} => {:?}" , def, result) ;
0 commit comments