2
2
3
3
use crate :: utils:: { clip, sext, unsext} ;
4
4
use if_chain:: if_chain;
5
- use rustc:: hir:: def:: Def ;
5
+ 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 } ;
@@ -247,8 +247,8 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
247
247
if_chain ! {
248
248
if args. is_empty( ) ;
249
249
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( ) ;
252
252
let def_path = self . lcx. get_def_path( def_id)
253
253
. iter( )
254
254
. map( LocalInternedString :: get)
@@ -322,9 +322,9 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
322
322
fn fetch_path ( & mut self , qpath : & QPath , id : HirId ) -> Option < Constant > {
323
323
use rustc:: mir:: interpret:: GlobalId ;
324
324
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) => {
328
328
let substs = self . tables . node_substs ( id) ;
329
329
let substs = if self . substs . is_empty ( ) {
330
330
substs
@@ -338,11 +338,11 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
338
338
} ;
339
339
340
340
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 ( ) {
343
343
self . needed_resolution = true ;
344
344
}
345
- ret
345
+ result
346
346
} ,
347
347
// FIXME: cover all usable cases.
348
348
_ => None ,
0 commit comments