Skip to content

Rustup to rust-lang/rust#67970 #5018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clippy_lints/src/needless_pass_by_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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`");
}
}
Expand Down
4 changes: 3 additions & 1 deletion clippy_lints/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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,
Expand Down