Skip to content

Commit

Permalink
Auto merge of rust-lang#5739 - flip1995:rustup, r=flip1995
Browse files Browse the repository at this point in the history
Rustup

changelog: none

r? @ghost
  • Loading branch information
bors committed Jun 23, 2020
2 parents c56c7e2 + 1d077f6 commit 4cc2fa9
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ fn is_mutable_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>, span: Span,
// primitive types are never mutable
ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) | ty::Str => false,
ty::Adt(ref adt, ref substs) => {
tys.insert(adt.did) && !ty.is_freeze(cx.tcx, cx.param_env, span)
tys.insert(adt.did) && !ty.is_freeze(cx.tcx.at(span), cx.param_env)
|| KNOWN_WRAPPER_TYS.iter().any(|path| match_def_path(cx, adt.did, path))
&& substs.types().any(|ty| is_mutable_ty(cx, ty, span, tys))
},
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/let_if_seq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetIfSeq {
let span = stmt.span.to(if_.span);

let has_interior_mutability = !cx.tables.node_type(canonical_id).is_freeze(
cx.tcx,
cx.tcx.at(span),
cx.param_env,
span
);
if has_interior_mutability { return; }

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/mut_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ fn is_mutable_type<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>, span: Spa
size.try_eval_usize(cx.tcx, cx.param_env).map_or(true, |u| u != 0) && is_mutable_type(cx, inner_ty, span)
},
Tuple(..) => ty.tuple_fields().any(|ty| is_mutable_type(cx, ty, span)),
Adt(..) => cx.tcx.layout_of(cx.param_env.and(ty)).is_ok() && !ty.is_freeze(cx.tcx, cx.param_env, span),
Adt(..) => cx.tcx.layout_of(cx.param_env.and(ty)).is_ok() && !ty.is_freeze(cx.tcx.at(span), cx.param_env),
_ => false,
}
}
2 changes: 1 addition & 1 deletion clippy_lints/src/non_copy_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl Source {
}

fn verify_ty_bound<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>, source: Source) {
if ty.is_freeze(cx.tcx, cx.param_env, DUMMY_SP) || is_copy(cx, ty) {
if ty.is_freeze(cx.tcx.at(DUMMY_SP), cx.param_env) || is_copy(cx, ty) {
// An `UnsafeCell` is `!Copy`, and an `UnsafeCell` is also the only type which
// is `!Freeze`, thus if our type is `Copy` we can be sure it must be `Freeze`
// as well.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/question_mark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl QuestionMark {
fn moves_by_default(cx: &LateContext<'_, '_>, expression: &Expr<'_>) -> bool {
let expr_ty = cx.tables.expr_ty(expression);

!expr_ty.is_copy_modulo_regions(cx.tcx, cx.param_env, expression.span)
!expr_ty.is_copy_modulo_regions(cx.tcx.at(expression.span), cx.param_env)
}

fn is_option(cx: &LateContext<'_, '_>, expression: &Expr<'_>) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ pub fn type_is_unsafe_function<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx
}

pub fn is_copy<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>) -> bool {
ty.is_copy_modulo_regions(cx.tcx, cx.param_env, DUMMY_SP)
ty.is_copy_modulo_regions(cx.tcx.at(DUMMY_SP), cx.param_env)
}

/// Checks if an expression is constructing a tuple-like enum variant or struct
Expand Down

0 comments on commit 4cc2fa9

Please sign in to comment.