@@ -6,7 +6,7 @@ use rustc::hir::def::{DefKind, Res};
6
6
use rustc:: hir:: * ;
7
7
use rustc:: lint:: LateContext ;
8
8
use rustc:: ty:: subst:: { Subst , SubstsRef } ;
9
- use rustc:: ty:: { self , Instance , Ty , TyCtxt } ;
9
+ use rustc:: ty:: { self , Ty , TyCtxt } ;
10
10
use rustc:: { bug, span_bug} ;
11
11
use rustc_data_structures:: sync:: Lrc ;
12
12
use std:: cmp:: Ordering :: { self , Equal } ;
@@ -328,8 +328,6 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
328
328
329
329
/// Lookup a possibly constant expression from a `ExprKind::Path`.
330
330
fn fetch_path ( & mut self , qpath : & QPath , id : HirId ) -> Option < Constant > {
331
- use rustc:: mir:: interpret:: GlobalId ;
332
-
333
331
let res = self . tables . qpath_res ( qpath, id) ;
334
332
match res {
335
333
Res :: Def ( DefKind :: Const , def_id) | Res :: Def ( DefKind :: AssocConst , def_id) => {
@@ -339,13 +337,12 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
339
337
} else {
340
338
substs. subst ( self . lcx . tcx , self . substs )
341
339
} ;
342
- let instance = Instance :: resolve ( self . lcx . tcx , self . param_env , def_id, substs) ?;
343
- let gid = GlobalId {
344
- instance,
345
- promoted : None ,
346
- } ;
347
340
348
- let result = self . lcx . tcx . const_eval ( self . param_env . and ( gid) ) . ok ( ) ?;
341
+ let result = self
342
+ . lcx
343
+ . tcx
344
+ . const_eval_resolve ( self . param_env , def_id, substs, None )
345
+ . ok ( ) ?;
349
346
let result = miri_to_const ( & result) ;
350
347
if result. is_some ( ) {
351
348
self . needed_resolution = true ;
0 commit comments