Skip to content

Commit 1d077f6

Browse files
authored
Rollup merge of rust-lang#73578 - RalfJung:ty-ctxt-at, r=jonas-schievink
Make is_freeze and is_copy_modulo_regions take TyCtxtAt Make is_freeze and is_copy_modulo_regions take TyCtxtAt instead of separately taking TyCtxt and Span. This is consistent with is_sized.
2 parents e11b873 + b92602b commit 1d077f6

File tree

6 files changed

+6
-7
lines changed

6 files changed

+6
-7
lines changed

clippy_lints/src/functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ fn is_mutable_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>, span: Span,
513513
// primitive types are never mutable
514514
ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) | ty::Str => false,
515515
ty::Adt(ref adt, ref substs) => {
516-
tys.insert(adt.did) && !ty.is_freeze(cx.tcx, cx.param_env, span)
516+
tys.insert(adt.did) && !ty.is_freeze(cx.tcx.at(span), cx.param_env)
517517
|| KNOWN_WRAPPER_TYS.iter().any(|path| match_def_path(cx, adt.did, path))
518518
&& substs.types().any(|ty| is_mutable_ty(cx, ty, span, tys))
519519
},

clippy_lints/src/let_if_seq.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetIfSeq {
7474
let span = stmt.span.to(if_.span);
7575

7676
let has_interior_mutability = !cx.tables.node_type(canonical_id).is_freeze(
77-
cx.tcx,
77+
cx.tcx.at(span),
7878
cx.param_env,
79-
span
8079
);
8180
if has_interior_mutability { return; }
8281

clippy_lints/src/mut_key.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn is_mutable_type<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>, span: Spa
118118
size.try_eval_usize(cx.tcx, cx.param_env).map_or(true, |u| u != 0) && is_mutable_type(cx, inner_ty, span)
119119
},
120120
Tuple(..) => ty.tuple_fields().any(|ty| is_mutable_type(cx, ty, span)),
121-
Adt(..) => cx.tcx.layout_of(cx.param_env.and(ty)).is_ok() && !ty.is_freeze(cx.tcx, cx.param_env, span),
121+
Adt(..) => cx.tcx.layout_of(cx.param_env.and(ty)).is_ok() && !ty.is_freeze(cx.tcx.at(span), cx.param_env),
122122
_ => false,
123123
}
124124
}

clippy_lints/src/non_copy_const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl Source {
110110
}
111111

112112
fn verify_ty_bound<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>, source: Source) {
113-
if ty.is_freeze(cx.tcx, cx.param_env, DUMMY_SP) || is_copy(cx, ty) {
113+
if ty.is_freeze(cx.tcx.at(DUMMY_SP), cx.param_env) || is_copy(cx, ty) {
114114
// An `UnsafeCell` is `!Copy`, and an `UnsafeCell` is also the only type which
115115
// is `!Freeze`, thus if our type is `Copy` we can be sure it must be `Freeze`
116116
// as well.

clippy_lints/src/question_mark.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl QuestionMark {
137137
fn moves_by_default(cx: &LateContext<'_, '_>, expression: &Expr<'_>) -> bool {
138138
let expr_ty = cx.tables.expr_ty(expression);
139139

140-
!expr_ty.is_copy_modulo_regions(cx.tcx, cx.param_env, expression.span)
140+
!expr_ty.is_copy_modulo_regions(cx.tcx.at(expression.span), cx.param_env)
141141
}
142142

143143
fn is_option(cx: &LateContext<'_, '_>, expression: &Expr<'_>) -> bool {

clippy_lints/src/utils/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ pub fn type_is_unsafe_function<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx
891891
}
892892

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

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

0 commit comments

Comments
 (0)