about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-07-08 10:44:30 +0900
committerGitHub <noreply@github.com>2021-07-08 10:44:30 +0900
commit165b520b89e9e2f27442a3af793c6d65e76e0981 (patch)
tree97a89bf075041462d6449adda57b31dfdaf2b55b /src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs
parentc2d3f5f7725a15fb3ad8ec88fbf89596f3ce9aea (diff)
parentc692896ba27adc1c14941593349c76bd27e189f5 (diff)
downloadrust-165b520b89e9e2f27442a3af793c6d65e76e0981.tar.gz
rust-165b520b89e9e2f27442a3af793c6d65e76e0981.zip
Rollup merge of #86812 - FabianWolff:recover-dyn-mut, r=petrochenkov
Recover from `&dyn mut ...` parse errors

Consider this example:
```rust
fn main() {
    let r: &dyn mut Trait;
}
```
This currently leads to:
```
error: expected one of `!`, `(`, `;`, `=`, `?`, `for`, lifetime, or path, found keyword `mut`
 --> src/main.rs:2:17
  |
2 |     let r: &dyn mut Trait;
  |                 ^^^ expected one of 8 possible tokens

error: aborting due to previous error
```
However, especially for beginners, I think it is easy to get `&dyn mut` and `&mut dyn` confused. With my changes, I get a help message, and the parser even recovers:
```
error: `mut` must precede `dyn`
 --> test.rs:2:12
  |
2 |     let r: &dyn mut Trait;
  |            ^^^^^^^^ help: place `mut` before `dyn`: `&mut dyn`

error[E0405]: cannot find trait `Trait` in this scope
 --> test.rs:2:21
  |
2 |     let r: &dyn mut Trait;
  |                     ^^^^^ not found in this scope

error: aborting due to 2 previous errors
```
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs')
0 files changed, 0 insertions, 0 deletions