Skip to content

Commit

Permalink
Rollup merge of rust-lang#102927 - compiler-errors:let, r=davidtwco
Browse files Browse the repository at this point in the history
Fix `let` keyword removal suggestion in structs

(1.) Fixes a bug where, given this code:
```rust
struct Foo {
  let x: i32,
}
```

We were parsing the field name as `let` instead of `x`, which causes issues later on in the type-checking phase.

(2.) Also, suggestions for `let: i32` as a field regressed, displaying this extra `help:` which is removed by this PR

```
help: remove the let, the `let` keyword is not allowed in struct field definitions
  |
2 -     let: i32,
2 +     : i32,
```

(3.) Makes the suggestion text a bit more succinct, since we don't need to re-explain that `let` is not allowed in this position (since it's in a note that follows). This causes the suggestion to render inline as well.

cc `@gimbles,` this addresses a few nits I mentioned in your PR.
  • Loading branch information
Dylan-DPC authored Oct 12, 2022
2 parents 9183a72 + f186abe commit 78d2aef
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 78d2aef

Please sign in to comment.