Auto merge of #132301 - compiler-errors:adjust, r=lcnr
Remove region from adjustments It's not necessary to store this region, because it's only used in THIR and MemCat/ExprUse, both of which already basically only deal with erased regions anyways.
This commit is contained in:
commit
9f89421036
@ -418,7 +418,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
let (required_refs, msg) = if can_auto_borrow {
|
||||
(1, if deref_count == 1 { borrow_msg } else { deref_msg })
|
||||
} else if let Some(&Adjustment {
|
||||
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutability)),
|
||||
kind: Adjust::Borrow(AutoBorrow::Ref(mutability)),
|
||||
..
|
||||
}) = next_adjust
|
||||
&& matches!(mutability, AutoBorrowMutability::Mut { .. })
|
||||
|
@ -53,7 +53,7 @@ pub(super) fn check(cx: &LateContext<'_>, self_arg: &Expr<'_>, call_expr: &Expr<
|
||||
[] => AdjustKind::None,
|
||||
&[
|
||||
Adjustment {
|
||||
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutbl)),
|
||||
kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)),
|
||||
..
|
||||
},
|
||||
] => AdjustKind::borrow(mutbl),
|
||||
@ -62,7 +62,7 @@ pub(super) fn check(cx: &LateContext<'_>, self_arg: &Expr<'_>, call_expr: &Expr<
|
||||
kind: Adjust::Deref(_), ..
|
||||
},
|
||||
Adjustment {
|
||||
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutbl)),
|
||||
kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)),
|
||||
target,
|
||||
},
|
||||
] => {
|
||||
|
@ -199,7 +199,7 @@ fn is_ref_iterable<'tcx>(
|
||||
kind: Adjust::Deref(_), ..
|
||||
},
|
||||
Adjustment {
|
||||
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutbl)),
|
||||
kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)),
|
||||
target,
|
||||
},
|
||||
..,
|
||||
@ -236,7 +236,7 @@ fn is_ref_iterable<'tcx>(
|
||||
},
|
||||
&[
|
||||
Adjustment {
|
||||
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutbl)),
|
||||
kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)),
|
||||
target,
|
||||
},
|
||||
..,
|
||||
|
@ -137,7 +137,7 @@ pub(crate) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, arg: &Expr<'_>, name:
|
||||
_ if matches!(
|
||||
typeck.expr_adjustments(prev_expr).first(),
|
||||
Some(Adjustment {
|
||||
kind: Adjust::Borrow(AutoBorrow::Ref(_, AutoBorrowMutability::Not))
|
||||
kind: Adjust::Borrow(AutoBorrow::Ref(AutoBorrowMutability::Not))
|
||||
| Adjust::Deref(_),
|
||||
..
|
||||
})
|
||||
@ -230,7 +230,7 @@ fn check_use<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> (UseKind<'tcx>,
|
||||
if use_cx
|
||||
.adjustments
|
||||
.first()
|
||||
.is_some_and(|a| matches!(a.kind, Adjust::Borrow(AutoBorrow::Ref(_, AutoBorrowMutability::Not)))) =>
|
||||
.is_some_and(|a| matches!(a.kind, Adjust::Borrow(AutoBorrow::Ref(AutoBorrowMutability::Not)))) =>
|
||||
{
|
||||
UseKind::AutoBorrowed
|
||||
},
|
||||
|
@ -110,7 +110,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
) || cx.typeck_results().expr_adjustments(expr).first().map_or(false, |a| {
|
||||
matches!(
|
||||
a.kind,
|
||||
Adjust::Borrow(AutoBorrow::Ref(_, AutoBorrowMutability::Mut { .. }))
|
||||
Adjust::Borrow(AutoBorrow::Ref(AutoBorrowMutability::Mut { .. }))
|
||||
)
|
||||
}) || (matches!(
|
||||
cx.typeck_results().expr_ty(indexed).ref_mutability(),
|
||||
|
Loading…
Reference in New Issue
Block a user