rust/tests/ui/trivial-bounds
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
..
everybody-copies.rs Consider parent predicates in ImpossiblePredicates pass. 2025-07-20 22:45:07 +00:00
issue-73021-impossible-inline.inline.stderr
issue-73021-impossible-inline.no-opt.stderr
issue-73021-impossible-inline.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
trivial-bounds-inconsistent-associated-functions.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
trivial-bounds-inconsistent-copy-reborrow.rs
trivial-bounds-inconsistent-copy-reborrow.stderr Provide more context when mutably borrowing an imutable borrow 2025-11-09 22:14:48 +00:00
trivial-bounds-inconsistent-copy.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
trivial-bounds-inconsistent-copy.stderr
trivial-bounds-inconsistent-projection-error.rs
trivial-bounds-inconsistent-projection-error.stderr
trivial-bounds-inconsistent-projection.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
trivial-bounds-inconsistent-projection.stderr
trivial-bounds-inconsistent-sized.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
trivial-bounds-inconsistent-sized.stderr
trivial-bounds-inconsistent-well-formed.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
trivial-bounds-inconsistent-well-formed.stderr
trivial-bounds-inconsistent.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
trivial-bounds-inconsistent.stderr Improve the impl and diag output of lint type_alias_bounds 2024-07-23 01:48:03 +02:00
trivial-bounds-leak-copy.rs
trivial-bounds-leak-copy.stderr Suggest .clone() in some move errors 2024-04-11 16:41:41 +00:00
trivial-bounds-leak.rs
trivial-bounds-leak.stderr
trivial-bounds-lint.rs
trivial-bounds-lint.stderr
trivial-bounds-object.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
two-sized-strs.rs Consider parent predicates in ImpossiblePredicates pass. 2025-07-20 22:45:07 +00:00