rust/tests/ui/rfcs/rfc-2005-default-binding-mode
Esteban Küber 71b0755a98 Provide more context when mutably borrowing an imutable borrow
Point at statics and consts being mutable borrowed or written to:

```
error[E0594]: cannot assign to immutable static item `NUM`
  --> $DIR/E0594.rs:4:5
   |
LL | static NUM: i32 = 18;
   | --------------- this `static` cannot be written to
...
LL |     NUM = 20;
   |     ^^^^^^^^ cannot assign
```

Point at the expression that couldn't be mutably borrowed from a pattern:

```
error[E0596]: cannot borrow data in a `&` reference as mutable
  --> $DIR/mut-pattern-of-immutable-borrow.rs:19:14
   |
LL |     match &arg.field {
   |           ---------- this cannot be borrowed as mutable
LL |         Some(ref mut s) => s.push('a'),
   |              ^^^^^^^^^ cannot borrow as mutable
```
2025-11-09 22:14:48 +00:00
..
borrowck-issue-49631.rs
borrowck-issue-49631.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
box.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
const.rs
const.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
constref.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
enum-ok.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
enum.rs
enum.stderr Provide more context when mutably borrowing an imutable borrow 2025-11-09 22:14:48 +00:00
explicit-mut.rs
explicit-mut.stderr Provide more context when mutably borrowing an imutable borrow 2025-11-09 22:14:48 +00:00
for-ok.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
for.rs
for.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
general.rs Diagnose liveness on MIR. 2025-10-11 20:50:21 +00:00
general.stderr Diagnose liveness on MIR. 2025-10-11 20:50:21 +00:00
issue-44912-or.rs
issue-44912-or.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
lit-ok.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
lit.rs
lit.stderr recurse into refs when comparing tys for diagnostics 2023-12-07 23:00:46 -05:00
no-double-error.rs
no-double-error.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
range.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
ref-region.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
reset-mode.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
slice-ok.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
slice.rs
slice.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
struct.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
tuple-struct.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
tuple.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00