about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
diff options
context:
space:
mode:
authorSasha Pourcelot <sasha.pourcelot@protonmail.com>2024-04-20 15:52:22 +0200
committerSasha Pourcelot <sasha.pourcelot@protonmail.com>2024-04-22 17:47:35 +0200
commit98332c108b8074954203fa4b0c82fbab876d3059 (patch)
treeee646e83b043313a3ddc1efedb31d9f919d5aa9e /compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
parenta61b14d15e4a742fb9d117d089626f5275a286c4 (diff)
downloadrust-98332c108b8074954203fa4b0c82fbab876d3059.tar.gz
rust-98332c108b8074954203fa4b0c82fbab876d3059.zip
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[1])

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)

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

Signed-off-by: Sasha Pourcelot <sasha.pourcelot@protonmail.com>
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs')
0 files changed, 0 insertions, 0 deletions