|
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::{Res, DefKind}; |
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 |
|
0 commit comments