about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-04-23 06:24:57 +0200
committerGitHub <noreply@github.com>2024-04-23 06:24:57 +0200
commit5800e2a6f9e6d70adfe225e9163d3e31f4236021 (patch)
tree0c4e3c813b9213a85cf937ee29da2f455173d272 /compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
parente9b0c91cdde55326f4c2e8d256254d49d963d812 (diff)
parent98332c108b8074954203fa4b0c82fbab876d3059 (diff)
downloadrust-5800e2a6f9e6d70adfe225e9163d3e31f4236021.tar.gz
rust-5800e2a6f9e6d70adfe225e9163d3e31f4236021.zip
Rollup merge of #124200 - scrabsha:sasha/->, r=compiler-errors,fmease
Improve handling of expr->field errors

The current message for "`->` used for field access" is the following:

```rust
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `->`
 --> src/main.rs:2:6
  |
2 |     a->b;
  |      ^^ expected one of 8 possible tokens
```

([playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=7f8b6f4433aa7866124123575456f54e))

This PR tries to address this by adding a dedicated error message and recovery. The proposed error message is:

```
error: `->` used for field access or method call
 --> ./tiny_test.rs:2:6
  |
2 |     a->b;
  |      ^^ help: try using `.` instead
  |
  = help: the `.` operator will dereference the value if needed
```

(feel free to bikeshed it as much as necessary)
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs')
0 files changed, 0 insertions, 0 deletions