From fa33681d5c4b655679be0991cee43b5ea8905d3c Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Wed, 8 Jan 2020 15:42:54 +0900 Subject: [PATCH] Rustup to rust-lang/rust#67970 --- clippy_lints/src/needless_pass_by_value.rs | 3 ++- clippy_lints/src/utils/mod.rs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs index 2a58f6c3dc2..824e5554965 100644 --- a/clippy_lints/src/needless_pass_by_value.rs +++ b/clippy_lints/src/needless_pass_by_value.rs @@ -9,6 +9,7 @@ use rustc::declare_lint_pass; use rustc::hir::intravisit::FnKind; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::traits; +use rustc::traits::misc::can_type_implement_copy; use rustc::ty::{self, RegionKind, TypeFoldable}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::Applicability; @@ -205,7 +206,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue { let sugg = |db: &mut DiagnosticBuilder<'_>| { if let ty::Adt(def, ..) = ty.kind { if let Some(span) = cx.tcx.hir().span_if_local(def.did) { - if cx.param_env.can_type_implement_copy(cx.tcx, ty).is_ok() { + if can_type_implement_copy(cx.tcx, cx.param_env, ty).is_ok() { db.span_help(span, "consider marking this type as `Copy`"); } } diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 16ff010846f..1e6a57c6dfc 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -28,6 +28,7 @@ use matches::matches; use rustc::hir::intravisit::{NestedVisitorMap, Visitor}; use rustc::lint::{LateContext, Level, Lint, LintContext}; use rustc::traits; +use rustc::traits::predicate_for_trait_def; use rustc::ty::{ self, layout::{self, IntegerExt}, @@ -312,7 +313,8 @@ pub fn implements_trait<'a, 'tcx>( ty_params: &[GenericArg<'tcx>], ) -> bool { let ty = cx.tcx.erase_regions(&ty); - let obligation = cx.tcx.predicate_for_trait_def( + let obligation = predicate_for_trait_def( + cx.tcx, cx.param_env, traits::ObligationCause::dummy(), trait_id,