diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2025-02-14 18:42:06 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2025-03-06 17:58:33 -0300 |
| commit | aa58439f87f58aa9c7b1ccfb5d52ae5d3d0f1106 (patch) | |
| tree | 6cc3037bd14b09f37916c8d6199b3d587e1ef14e /compiler/rustc_borrowck/src | |
| parent | 6eb6ff62f78560720f6902421dcd482cb70482ed (diff) | |
| download | rust-aa58439f87f58aa9c7b1ccfb5d52ae5d3d0f1106.tar.gz rust-aa58439f87f58aa9c7b1ccfb5d52ae5d3d0f1106.zip | |
Fail gracefully if mutating on a use closure and the closure it not declared mut
Diffstat (limited to 'compiler/rustc_borrowck/src')
| -rw-r--r-- | compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index be4a7736b1c..145137f9236 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -823,7 +823,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { ) => { capture_reason = format!("mutable borrow of `{upvar}`"); } - ty::UpvarCapture::ByValue => { + ty::UpvarCapture::ByValue | ty::UpvarCapture::ByUse => { capture_reason = format!("possible mutation of `{upvar}`"); } _ => bug!("upvar `{upvar}` borrowed, but not mutably"), |
