about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/example/alloc_system.rs
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-11-17 23:56:08 +0800
committerGitHub <noreply@github.com>2024-11-17 23:56:08 +0800
commit2f62fd3d137395ffd7f31fdb7da3c61d70f1ba54 (patch)
treeb8aff69aa81b84d81b724d1cbf9e19f6ef57535b /compiler/rustc_codegen_gcc/example/alloc_system.rs
parent2d9690d2e75bac228e923670acc63a497d5e8b8d (diff)
parent6913194b8ea47ebe8e65b627e83f029d0968d8f8 (diff)
downloadrust-2f62fd3d137395ffd7f31fdb7da3c61d70f1ba54.tar.gz
rust-2f62fd3d137395ffd7f31fdb7da3c61d70f1ba54.zip
Rollup merge of #133051 - estebank:cond-misparse, r=jieyouxu
Increase accuracy of `if` condition misparse suggestion

Fix #132656.

Look at the expression that was parsed when trying to recover from a bad `if` condition to determine what was likely intended by the user beyond "maybe this was meant to be an `else` body".

```
error: expected `{`, found `map`
  --> $DIR/missing-dot-on-if-condition-expression-fixable.rs:4:30
   |
LL |     for _ in [1, 2, 3].iter()map(|x| x) {}
   |                              ^^^ expected `{`
   |
help: you might have meant to write a method call
   |
LL |     for _ in [1, 2, 3].iter().map(|x| x) {}
   |                              +
```

If a macro statement has been parsed after `else`, suggest a missing `if`:

```
error: expected `{`, found `falsy`
  --> $DIR/else-no-if.rs:47:12
   |
LL |     } else falsy! {} {
   |       ---- ^^^^^
   |       |
   |       expected an `if` or a block after this `else`
   |
help: add an `if` if this is the condition of a chained `else if` statement
   |
LL |     } else if falsy! {} {
   |            ++
```
Diffstat (limited to 'compiler/rustc_codegen_gcc/example/alloc_system.rs')
0 files changed, 0 insertions, 0 deletions