22
33use crate :: utils:: { clip, sext, unsext} ;
44use if_chain:: if_chain;
5- use rustc:: hir:: def:: Def ;
5+ use rustc:: hir:: def:: { DefKind , Res } ;
66use rustc:: hir:: * ;
77use rustc:: lint:: LateContext ;
88use rustc:: ty:: subst:: { Subst , SubstsRef } ;
@@ -247,8 +247,8 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
247247 if_chain ! {
248248 if args. is_empty( ) ;
249249 if let ExprKind :: Path ( qpath) = & callee. node;
250- let def = self . tables. qpath_def ( qpath, callee. hir_id) ;
251- if let Some ( def_id) = def . opt_def_id( ) ;
250+ let res = self . tables. qpath_res ( qpath, callee. hir_id) ;
251+ if let Some ( def_id) = res . opt_def_id( ) ;
252252 let def_path = self . lcx. get_def_path( def_id)
253253 . iter( )
254254 . map( LocalInternedString :: get)
@@ -322,9 +322,9 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
322322 fn fetch_path ( & mut self , qpath : & QPath , id : HirId ) -> Option < Constant > {
323323 use rustc:: mir:: interpret:: GlobalId ;
324324
325- let def = self . tables . qpath_def ( qpath, id) ;
326- match def {
327- Def :: Const ( def_id) | Def :: AssociatedConst ( def_id) => {
325+ let res = self . tables . qpath_res ( qpath, id) ;
326+ match res {
327+ Res :: Def ( DefKind :: Const , def_id) | Res :: Def ( DefKind :: AssociatedConst , def_id) => {
328328 let substs = self . tables . node_substs ( id) ;
329329 let substs = if self . substs . is_empty ( ) {
330330 substs
@@ -338,11 +338,11 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
338338 } ;
339339
340340 let result = self . lcx . tcx . const_eval ( self . param_env . and ( gid) ) . ok ( ) ?;
341- let ret = miri_to_const ( self . lcx . tcx , & result) ;
342- if ret . is_some ( ) {
341+ let result = miri_to_const ( self . lcx . tcx , & result) ;
342+ if result . is_some ( ) {
343343 self . needed_resolution = true ;
344344 }
345- ret
345+ result
346346 } ,
347347 // FIXME: cover all usable cases.
348348 _ => None ,
0 commit comments