Commit Graph

5 Commits

Author SHA1 Message Date
Esteban Küber
f5b5e67f0f More targeted parentheses suggestion for match statement intended as expression
```
error[E0308]: mismatched types
  --> $DIR/expr-as-stmt.rs:69:5
   |
LL |     match () { () => 1 } + match () { () => 1 }
   |     ^^^^^^^^^^^^^^^^^^^^ expected `()`, found integer
   |
help: parentheses are required to parse this as an expression
   |
LL |     (match () { () => 1 }) + match () { () => 1 }
   |     +                    +
```
2025-08-31 01:43:57 +00:00
Esteban Küber
a7e32a5319 Provide suggestion when encountering match () { () => 1 } + match () { () => 1 }
```
error[E0308]: mismatched types
  --> $DIR/expr-as-stmt.rs:69:5
   |
LL |     match () { () => 1 } + match () { () => 1 }
   |     ^^^^^^^^^^^^^^^^^^^^ expected `()`, found integer
   |
help: consider using a semicolon here
   |
LL |     match () { () => 1 }; + match () { () => 1 }
   |                         +
help: alternatively, parentheses are required to parse this as an expression
   |
LL |     (match () { () => 1 }) + match () { () => 1 }
   |     +                    +
```

Parentheses are needed for the `match` to be unambiguously parsed as an expression and not a statement when chaining with binops that are also unops.
2025-08-31 00:42:58 +00:00
Esteban Küber
7302dc660b Make E0614 a structured error
```
error[E0614]: type `(..., ..., ..., ...)` cannot be dereferenced
  --> $DIR/long-E0614.rs:10:5
   |
LL |     *x;
   |     ^^ can't be dereferenced
   |
   = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt'
   = note: consider using `--verbose` to print the full type name to the console
```
2025-02-25 16:56:04 +00:00
Ralf Jung
c4ec12f4b7 adjust how closure/generator types and rvalues are printed 2023-09-21 22:20:58 +02:00
Albert Larsan
cf2dff2b1e Move /src/test to /tests 2023-01-11 09:32:08 +00:00