@@ -14,7 +14,7 @@ use rustc::traits::{FulfillmentContext, Normalized, ObligationCause};
14
14
use rustc:: traits:: query:: { CanonicalTyGoal , NoSolution } ;
15
15
use rustc:: traits:: query:: dropck_outlives:: { DtorckConstraint , DropckOutlivesResult } ;
16
16
use rustc:: ty:: { self , ParamEnvAnd , Ty , TyCtxt } ;
17
- use rustc:: ty:: subst:: { UnpackedKind , Subst } ;
17
+ use rustc:: ty:: subst:: { Subst , Substs } ;
18
18
use rustc:: util:: nodemap:: FxHashSet ;
19
19
use rustc_data_structures:: sync:: Lrc ;
20
20
use syntax:: codemap:: { Span , DUMMY_SP } ;
@@ -280,14 +280,11 @@ crate fn adt_dtorck_constraint<'a, 'tcx>(
280
280
if def. is_phantom_data ( ) {
281
281
// The first generic parameter here is guaranteed to be a type because it's
282
282
// `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 ) ;
288
285
let result = DtorckConstraint {
289
286
outlives : vec ! [ ] ,
290
- dtorck_types : vec ! [ ty ] ,
287
+ dtorck_types : vec ! [ substs . type_at ( 0 ) ] ,
291
288
overflows : vec ! [ ] ,
292
289
} ;
293
290
debug ! ( "dtorck_constraint: {:?} => {:?}" , def, result) ;
0 commit comments