From 614297eb9bc8fa5d9c54f653dc35b8cc3a22891f Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Thu, 1 Jun 2017 21:59:40 -0700 Subject: [PATCH] Update codegen lints for latest nightly. --- codegen/build.rs | 2 +- codegen/src/lints/utils.rs | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/codegen/build.rs b/codegen/build.rs index ee46bdef..6adc6416 100644 --- a/codegen/build.rs +++ b/codegen/build.rs @@ -8,7 +8,7 @@ use ansi_term::Color::{Red, Yellow, Blue, White}; use version_check::{is_nightly, is_min_version, is_min_date}; // Specifies the minimum nightly version needed to compile Rocket's codegen. -const MIN_DATE: &'static str = "2017-05-26"; +const MIN_DATE: &'static str = "2017-06-01"; const MIN_VERSION: &'static str = "1.19.0-nightly"; // Convenience macro for writing to stderr. diff --git a/codegen/src/lints/utils.rs b/codegen/src/lints/utils.rs index 50a5175f..464961a0 100644 --- a/codegen/src/lints/utils.rs +++ b/codegen/src/lints/utils.rs @@ -46,18 +46,11 @@ pub fn match_def_path(tcx: ty::TyCtxt, def_id: DefId, path: &[&str]) -> bool { /// Check if the method call given in `expr` belongs to given type. pub fn is_impl_method(cx: &LateContext, expr: &Expr, path: &[&str]) -> bool { - let method_call = ty::MethodCall::expr(expr.id); - - let trt_id = cx.tables - .method_map - .get(&method_call) - .and_then(|callee| cx.tcx.impl_of_method(callee.def_id)); - - if let Some(trt_id) = trt_id { - match_def_path(cx.tcx, trt_id, path) - } else { - false - } + cx.tables.type_dependent_defs + .get(&expr.id) + .and_then(|callee| cx.tcx.impl_of_method(callee.def_id())) + .map(|trt_id| match_def_path(cx.tcx, trt_id, path)) + .unwrap_or(false) } pub fn find_initial_receiver<'e>(cx: &LateContext,