Skip to content

Commit a0a948d

Browse files
Rollup merge of rust-lang#133751 - lcnr:no-trait-solving-on-type, r=compiler-errors
remove `Ty::is_copy_modulo_regions` Using these functions is likely incorrect if an `InferCtxt` is available, I moved this function to `TyCtxt` (and added it to `LateContext`) and added a note to the documentation that one should prefer `Infer::type_is_copy_modulo_regions` instead. I didn't yet move `is_sized` and `is_freeze`, though I think we should move these as well. r? `@compiler-errors` cc rust-lang#132279
2 parents e66bd97 + b330d96 commit a0a948d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

clippy_lints/src/methods/manual_inspect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub(crate) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, arg: &Expr<'_>, name:
148148
_ => {},
149149
}
150150
}
151-
requires_copy |= !ty.is_copy_modulo_regions(cx.tcx, cx.typing_env());
151+
requires_copy |= !cx.type_is_copy_modulo_regions(ty);
152152
break;
153153
}
154154
},
@@ -158,7 +158,7 @@ pub(crate) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, arg: &Expr<'_>, name:
158158
}
159159

160160
if can_lint
161-
&& (!requires_copy || arg_ty.is_copy_modulo_regions(cx.tcx, cx.typing_env()))
161+
&& (!requires_copy || cx.type_is_copy_modulo_regions(arg_ty))
162162
// This case could be handled, but a fair bit of care would need to be taken.
163163
&& (!requires_deref || arg_ty.is_freeze(cx.tcx, cx.typing_env()))
164164
{

clippy_lints/src/question_mark.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ fn check_is_none_or_err_and_early_return<'tcx>(cx: &LateContext<'tcx>, expr: &Ex
251251
{
252252
let mut applicability = Applicability::MachineApplicable;
253253
let receiver_str = snippet_with_applicability(cx, caller.span, "..", &mut applicability);
254-
let by_ref = !caller_ty.is_copy_modulo_regions(cx.tcx, cx.typing_env())
254+
let by_ref = !cx.type_is_copy_modulo_regions(caller_ty)
255255
&& !matches!(caller.kind, ExprKind::Call(..) | ExprKind::MethodCall(..));
256256
let sugg = if let Some(else_inner) = r#else {
257257
if eq_expr_value(cx, caller, peel_blocks(else_inner)) {

clippy_utils/src/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub use type_certainty::expr_type_is_certain;
3838

3939
/// Checks if the given type implements copy.
4040
pub fn is_copy<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
41-
ty.is_copy_modulo_regions(cx.tcx, cx.typing_env())
41+
cx.type_is_copy_modulo_regions(ty)
4242
}
4343

4444
/// This checks whether a given type is known to implement Debug.

0 commit comments

Comments
 (0)