<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/tests/ui/parser/expr-rarrow-call.fixed, branch 1.83.0</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=1.83.0</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=1.83.0'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2024-04-22T15:47:35+00:00</updated>
<entry>
<title>Improve handling of expr-&gt;field errors</title>
<updated>2024-04-22T15:47:35+00:00</updated>
<author>
<name>Sasha Pourcelot</name>
<email>sasha.pourcelot@protonmail.com</email>
</author>
<published>2024-04-20T13:52:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=98332c108b8074954203fa4b0c82fbab876d3059'/>
<id>urn:sha1:98332c108b8074954203fa4b0c82fbab876d3059</id>
<content type='text'>
The current message for "`-&gt;` used for field access" is the following:

```rust
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `-&gt;`
 --&gt; src/main.rs:2:6
  |
2 |     a-&gt;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: `-&gt;` used for field access or method call
 --&gt; ./tiny_test.rs:2:6
  |
2 |     a-&gt;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&amp;mode=debug&amp;edition=2021&amp;gist=7f8b6f4433aa7866124123575456f54e

Signed-off-by: Sasha Pourcelot &lt;sasha.pourcelot@protonmail.com&gt;
</content>
</entry>
</feed>
