Skip to content

Commit baa5cc1

Browse files
committed
Auto merge of #5018 - JohnTitor:rustup-0108, r=phansch
Rustup to rust-lang/rust#67970 changelog: none
2 parents c092068 + fa33681 commit baa5cc1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

clippy_lints/src/needless_pass_by_value.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use rustc::declare_lint_pass;
99
use rustc::hir::intravisit::FnKind;
1010
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
1111
use rustc::traits;
12+
use rustc::traits::misc::can_type_implement_copy;
1213
use rustc::ty::{self, RegionKind, TypeFoldable};
1314
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1415
use rustc_errors::Applicability;
@@ -205,7 +206,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
205206
let sugg = |db: &mut DiagnosticBuilder<'_>| {
206207
if let ty::Adt(def, ..) = ty.kind {
207208
if let Some(span) = cx.tcx.hir().span_if_local(def.did) {
208-
if cx.param_env.can_type_implement_copy(cx.tcx, ty).is_ok() {
209+
if can_type_implement_copy(cx.tcx, cx.param_env, ty).is_ok() {
209210
db.span_help(span, "consider marking this type as `Copy`");
210211
}
211212
}

clippy_lints/src/utils/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use matches::matches;
2828
use rustc::hir::intravisit::{NestedVisitorMap, Visitor};
2929
use rustc::lint::{LateContext, Level, Lint, LintContext};
3030
use rustc::traits;
31+
use rustc::traits::predicate_for_trait_def;
3132
use rustc::ty::{
3233
self,
3334
layout::{self, IntegerExt},
@@ -312,7 +313,8 @@ pub fn implements_trait<'a, 'tcx>(
312313
ty_params: &[GenericArg<'tcx>],
313314
) -> bool {
314315
let ty = cx.tcx.erase_regions(&ty);
315-
let obligation = cx.tcx.predicate_for_trait_def(
316+
let obligation = predicate_for_trait_def(
317+
cx.tcx,
316318
cx.param_env,
317319
traits::ObligationCause::dummy(),
318320
trait_id,

0 commit comments

Comments
 (0)