rust/tests/ui/enum
Esteban Küber ec7a188f16 More accurate suggestions when writing wrong style of enum variant literal
```
error[E0533]: expected value, found struct variant `E::Empty3`
  --> $DIR/empty-struct-braces-expr.rs:18:14
   |
LL |     let e3 = E::Empty3;
   |              ^^^^^^^^^ not a value
   |
help: you might have meant to create a new value of the struct
   |
LL |     let e3 = E::Empty3 {};
   |                        ++
```
```
error[E0533]: expected value, found struct variant `E::V`
  --> $DIR/struct-literal-variant-in-if.rs:10:13
   |
LL |     if x == E::V { field } {}
   |             ^^^^ not a value
   |
help: you might have meant to create a new value of the struct
   |
LL |     if x == (E::V { field }) {}
   |             +              +
```
```
error[E0618]: expected function, found enum variant `Enum::Unit`
  --> $DIR/suggestion-highlights.rs:15:5
   |
LL |     Unit,
   |     ---- enum variant `Enum::Unit` defined here
...
LL |     Enum::Unit();
   |     ^^^^^^^^^^--
   |     |
   |     call expression requires function
   |
help: `Enum::Unit` is a unit enum variant, and does not take parentheses to be constructed
   |
LL -     Enum::Unit();
LL +     Enum::Unit;
   |
```
```
error[E0599]: no variant or associated item named `tuple` found for enum `Enum` in the current scope
  --> $DIR/suggestion-highlights.rs:36:11
   |
LL | enum Enum {
   | --------- variant or associated item `tuple` not found for this enum
...
LL |     Enum::tuple;
   |           ^^^^^ variant or associated item not found in `Enum`
   |
help: there is a variant with a similar name
   |
LL |     Enum::Tuple(/* i32 */);
   |           ~~~~~~~~~~~~~~~~;
   |
```
2024-07-18 18:20:35 +00:00
..
auxiliary
enum-and-module-in-same-scope.rs
enum-and-module-in-same-scope.stderr
enum-discrim-autosizing.rs
enum-discrim-autosizing.stderr
enum-discrim-too-small2.rs
enum-discrim-too-small2.stderr
enum-discrim-too-small.rs
enum-discrim-too-small.stderr
enum-in-scope.rs
enum-in-scope.stderr
enum-size-variance.rs
enum-size-variance.stderr
enum-to-float-cast-2.rs
enum-to-float-cast-2.stderr
enum-to-float-cast.rs
enum-to-float-cast.stderr
enum-variant-type-2.rs
enum-variant-type-2.stderr
error-variant-with-turbofishes.rs
error-variant-with-turbofishes.stderr More accurate suggestions when writing wrong style of enum variant literal 2024-07-18 18:20:35 +00:00
issue-1821.rs
issue-19340-1.rs
issue-19340-2.rs
issue-23304-1.rs
issue-23304-2.rs
issue-42747.rs
issue-67945-1.rs
issue-67945-1.stderr
issue-67945-2.rs
issue-67945-2.stderr
nested-enum.rs
nested-enum.stderr
suggest-default-attribute.rs
suggest-default-attribute.stderr
union-in-enum.rs