Skip to content

Commit 190e7bd

Browse files
committed
Define values and err as non mutable
1 parent 21805a6 commit 190e7bd

File tree

1 file changed

+7
-7
lines changed
  • compiler/rustc_trait_selection/src/traits/error_reporting

1 file changed

+7
-7
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1576,18 +1576,15 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
15761576
return;
15771577
}
15781578

1579-
let mut values = None;
1580-
15811579
self.probe(|_| {
15821580
let ocx = ObligationCtxt::new_in_snapshot(self);
1583-
let mut err = error.err;
15841581

15851582
// try to find the mismatched types to report the error with.
15861583
//
15871584
// this can fail if the problem was higher-ranked, in which
15881585
// cause I have no idea for a good error message.
15891586
let bound_predicate = predicate.kind();
1590-
if let ty::PredicateKind::Clause(ty::Clause::Projection(data)) =
1587+
let (values, err) = if let ty::PredicateKind::Clause(ty::Clause::Projection(data)) =
15911588
bound_predicate.skip_binder()
15921589
{
15931590
let data = self.replace_bound_vars_with_fresh_vars(
@@ -1628,10 +1625,13 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
16281625
normalized_ty,
16291626
expected_ty,
16301627
) {
1631-
values = Some((data, is_normalized_ty_expected, normalized_ty, expected_ty));
1632-
err = new_err;
1628+
(Some((data, is_normalized_ty_expected, normalized_ty, expected_ty)), new_err)
1629+
} else {
1630+
(None, error.err)
16331631
}
1634-
}
1632+
} else {
1633+
(None, error.err)
1634+
};
16351635

16361636
let msg = values
16371637
.and_then(|(predicate, _, normalized_ty, expected_ty)| {

0 commit comments

Comments
 (0)