@@ -226,7 +226,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
226226 return self . ifthenelse ( cond, then, otherwise) ;
227227 }
228228 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 ) ) ,
230230 ExprKind :: Block ( ref block, _) => self . block ( block) ,
231231 ExprKind :: Lit ( ref lit) => Some ( lit_to_constant ( & lit. node , self . tables . expr_ty_opt ( e) ) ) ,
232232 ExprKind :: Array ( ref vec) => self . multi ( vec) . map ( Constant :: Vec ) ,
@@ -319,7 +319,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
319319 }
320320
321321 /// 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 > {
323323 let res = self . tables . qpath_res ( qpath, id) ;
324324 match res {
325325 Res :: Def ( DefKind :: Const , def_id) | Res :: Def ( DefKind :: AssocConst , def_id) => {
@@ -334,7 +334,8 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
334334 . lcx
335335 . tcx
336336 . 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) ) ?;
338339 let result = miri_to_const ( & result) ;
339340 if result. is_some ( ) {
340341 self . needed_resolution = true ;
0 commit comments