rust/tests/ui/thread-local
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
..
auxiliary [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
long-docs.rs Support #[rustc_align_static] inside thread_local! 2025-09-26 13:51:09 -04:00
name-collision.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
no-unstable.rs Support #[rustc_align_static] inside thread_local! 2025-09-26 13:51:09 -04:00
no-unstable.stderr Hoist non-platform-specific code out of thread_local_inner! 2025-09-27 17:05:39 -04:00
non-static.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
non-static.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
spawn-hook-atexit.rs Mark test as only-unix. 2025-03-27 14:11:11 +01:00
thread-local-issue-37508.rs Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
thread-local-mutation.rs Move some UI tests into subdirectories 2023-04-02 19:42:30 -04:00
thread-local-mutation.stderr Provide more context when mutably borrowing an imutable borrow 2025-11-09 22:14:48 +00:00
thread-local-static-ref-use-after-free.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
thread-local-static-reference-70673.rs Add test batch 5 2025-10-12 00:33:20 -04:00
thread-local-static.rs stabilize const_swap 2024-12-25 10:36:32 +01:00
thread-local-static.stderr stabilize const_swap 2024-12-25 10:36:32 +01:00
thread-local-with-attributes-30756.rs Rehome tests/ui/issues/ tests [4/?] 2025-08-10 11:54:15 -04:00
tls-dylib-access.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
tls.rs compiletest: Add a //@ needs-threads directive 2024-03-06 12:35:07 -08:00