Auto merge of #5018 - JohnTitor:rustup-0108, r=phansch

Rustup to rust-lang/rust#67970

changelog: none
This commit is contained in:
bors 2020-01-08 06:56:57 +00:00
commit baa5cc17da
2 changed files with 5 additions and 2 deletions

View file

@ -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`");
}
}

View file

@ -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,