rust/tests
Matthias Krüger 199d3bf3e4
Rollup merge of #125301 - jwong101:fix-static-coro-suggest, r=compiler-errors
fix suggestion in E0373 for !Unpin coroutines

Coroutines can be prefixed with the `static` keyword to make them
`!Unpin`.
However, given the following function:

```rust

fn check() -> impl Sized {
    let x = 0;
    #[coroutine]
    static || {
        yield;
        x
    }
}
```

We currently suggest prefixing `move` before `static`, which is
syntactically incorrect:

```
error[E0373]: coroutine may outlive the current function, but it borrows
...
 --> src/main.rs:6:5
  |
6 |     static || {
  |     ^^^^^^^^^ may outlive borrowed value `x`
7 |         yield;
8 |         x
  |         - `x` is borrowed here
  |
note: coroutine is returned here
 --> src/main.rs:6:5
  |
6 | /     static || {
7 | |         yield;
8 | |         x
9 | |     }
  | |_____^
help: to force the coroutine to take ownership of `x` (and any other
referenced variables), use the `move` keyword
  |     // this is syntactically incorrect, it should be `static move ||`
6 |     move static || {
  |     ++++

```

This PR suggests adding `move` after `static` for these coroutines.

I also added a UI test for this case.
2024-05-20 08:31:42 +02:00
..
assembly test: Add assembly tests for x86_64-unknown-linux-none target 2024-05-12 01:25:11 +02:00
auxiliary
codegen Rollup merge of #125184 - scottmcm:fix-thin-ptr-ice, r=jieyouxu 2024-05-18 18:44:14 +02:00
codegen-units Fix some minor issues from the ui-test auto-porting 2024-05-11 19:58:35 -04:00
coverage Auto merge of #124223 - Zalathar:conditional-let, r=compiler-errors 2024-05-07 22:28:51 +00:00
coverage-run-rustdoc
crashes crashes: add more 2024-05-18 23:56:57 +02:00
debuginfo lldb-formatters: Use StdSliceSyntheticProvider for &str 2024-05-11 12:11:55 -07:00
incremental
mir-opt Rename Unsafe to Safety 2024-05-17 18:33:37 -03:00
pretty Rollup merge of #124269 - scrabsha:sasha/fix-124206, r=dtolnay 2024-04-29 18:03:22 +01:00
run-make Migrate run-make/rustdoc-scrape-examples-test to new rmake.rs 2024-05-19 15:02:30 +02:00
run-make-fulldeps
run-pass-valgrind
rustdoc rustdoc: Negative impls are not notable 2024-05-14 20:40:59 -04:00
rustdoc-gui Rollup merge of #124738 - notriddle:notriddle/search-form-js, r=GuillaumeGomez 2024-05-07 18:12:54 +02:00
rustdoc-js
rustdoc-js-std
rustdoc-json
rustdoc-ui Always hide private fields in aliased type 2024-05-11 13:11:46 +02:00
ui Rollup merge of #125301 - jwong101:fix-static-coro-suggest, r=compiler-errors 2024-05-20 08:31:42 +02:00
ui-fulldeps Add ErrorGuaranteed to Recovered::Yes and use it more. 2024-05-09 20:12:07 +10:00
COMPILER_TESTS.md