@@ -226,7 +226,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
226
226
return self . ifthenelse ( cond, then, otherwise) ;
227
227
}
228
228
match e. kind {
229
- ExprKind :: Path ( ref qpath) => self . fetch_path ( qpath, e. hir_id ) ,
229
+ ExprKind :: Path ( ref qpath) => self . fetch_path ( qpath, e. hir_id , self . tables . expr_ty ( e ) ) ,
230
230
ExprKind :: Block ( ref block, _) => self . block ( block) ,
231
231
ExprKind :: Lit ( ref lit) => Some ( lit_to_constant ( & lit. node , self . tables . expr_ty_opt ( e) ) ) ,
232
232
ExprKind :: Array ( ref vec) => self . multi ( vec) . map ( Constant :: Vec ) ,
@@ -319,7 +319,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
319
319
}
320
320
321
321
/// Lookup a possibly constant expression from a `ExprKind::Path`.
322
- fn fetch_path ( & mut self , qpath : & QPath < ' _ > , id : HirId ) -> Option < Constant > {
322
+ fn fetch_path ( & mut self , qpath : & QPath < ' _ > , id : HirId , ty : Ty < ' cc > ) -> Option < Constant > {
323
323
let res = self . tables . qpath_res ( qpath, id) ;
324
324
match res {
325
325
Res :: Def ( DefKind :: Const , def_id) | Res :: Def ( DefKind :: AssocConst , def_id) => {
@@ -334,7 +334,8 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
334
334
. lcx
335
335
. tcx
336
336
. const_eval_resolve ( self . param_env , def_id, substs, None , None )
337
- . ok ( ) ?;
337
+ . ok ( )
338
+ . map ( |val| rustc:: ty:: Const :: from_value ( self . lcx . tcx , val, ty) ) ?;
338
339
let result = miri_to_const ( & result) ;
339
340
if result. is_some ( ) {
340
341
self . needed_resolution = true ;
0 commit comments