165b520b89
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 ``` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |