Rollup merge of #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 #132279
This commit is contained in:
commit
a0a948ddaa
3 changed files with 4 additions and 4 deletions
|
|
@ -148,7 +148,7 @@ pub(crate) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, arg: &Expr<'_>, name:
|
|||
_ => {},
|
||||
}
|
||||
}
|
||||
requires_copy |= !ty.is_copy_modulo_regions(cx.tcx, cx.typing_env());
|
||||
requires_copy |= !cx.type_is_copy_modulo_regions(ty);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
|
@ -158,7 +158,7 @@ pub(crate) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, arg: &Expr<'_>, name:
|
|||
}
|
||||
|
||||
if can_lint
|
||||
&& (!requires_copy || arg_ty.is_copy_modulo_regions(cx.tcx, cx.typing_env()))
|
||||
&& (!requires_copy || cx.type_is_copy_modulo_regions(arg_ty))
|
||||
// This case could be handled, but a fair bit of care would need to be taken.
|
||||
&& (!requires_deref || arg_ty.is_freeze(cx.tcx, cx.typing_env()))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ fn check_is_none_or_err_and_early_return<'tcx>(cx: &LateContext<'tcx>, expr: &Ex
|
|||
{
|
||||
let mut applicability = Applicability::MachineApplicable;
|
||||
let receiver_str = snippet_with_applicability(cx, caller.span, "..", &mut applicability);
|
||||
let by_ref = !caller_ty.is_copy_modulo_regions(cx.tcx, cx.typing_env())
|
||||
let by_ref = !cx.type_is_copy_modulo_regions(caller_ty)
|
||||
&& !matches!(caller.kind, ExprKind::Call(..) | ExprKind::MethodCall(..));
|
||||
let sugg = if let Some(else_inner) = r#else {
|
||||
if eq_expr_value(cx, caller, peel_blocks(else_inner)) {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ pub use type_certainty::expr_type_is_certain;
|
|||
|
||||
/// Checks if the given type implements copy.
|
||||
pub fn is_copy<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
ty.is_copy_modulo_regions(cx.tcx, cx.typing_env())
|
||||
cx.type_is_copy_modulo_regions(ty)
|
||||
}
|
||||
|
||||
/// This checks whether a given type is known to implement Debug.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue