Skip to content

Commit d556b6e

Browse files
committed
Fix issue with &&mut T
``` error[E0596]: cannot borrow `*self.infcx` as mutable, as it is behind a `&` reference --> compiler/rustc_infer/src/infer/canonical/query_response.rs:642:9 | 641 | fn infcx(&self) -> &mut InferCtxt<'cx, 'tcx> { | ----- help: consider changing this to be a mutable reference: `&mut self` 642 | self.infcx | ^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable ```
1 parent b8eace2 commit d556b6e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rustc_infer/src/infer/canonical/query_response.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ struct QueryTypeRelatingDelegate<'a, 'cx, 'tcx> {
638638
}
639639

640640
impl<'a, 'cx, 'tcx> TypeRelatingDelegate<'cx, 'tcx> for QueryTypeRelatingDelegate<'a, 'cx, 'tcx> {
641-
fn infcx(&self) -> &mut InferCtxt<'cx, 'tcx> {
641+
fn infcx(&mut self) -> &mut InferCtxt<'cx, 'tcx> {
642642
self.infcx
643643
}
644644

compiler/rustc_infer/src/infer/nll_relate/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ where
7272
}
7373

7474
pub trait TypeRelatingDelegate<'cx, 'tcx> {
75-
fn infcx(&self) -> &mut InferCtxt<'cx, 'tcx>;
75+
fn infcx(&mut self) -> &mut InferCtxt<'cx, 'tcx>;
7676

7777
/// Push a constraint `sup: sub` -- this constraint must be
7878
/// satisfied for the two types to be related. `sub` and `sup` may

0 commit comments

Comments
 (0)