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 Move some tests 2024-04-21 15:43:43 -03:00
enum-and-module-in-same-scope.rs Continue to borrowck even if there were previous errors 2024-02-08 08:10:43 +00:00
enum-and-module-in-same-scope.stderr Continue to borrowck even if there were previous errors 2024-02-08 08:10:43 +00:00
enum-discrim-autosizing.rs
enum-discrim-autosizing.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
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 Show number in error message even for one error 2023-11-24 19:15:52 +01:00
enum-size-variance.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
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 Show number in error message even for one error 2023-11-24 19:15:52 +01:00
error-variant-with-turbofishes.rs Add test 2024-04-15 18:48:12 -04:00
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 [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-19340-1.rs Move some tests 2024-04-21 15:43:43 -03:00
issue-19340-2.rs Move some tests 2024-04-21 15:43:43 -03:00
issue-23304-1.rs Move some tests 2024-04-21 15:43:43 -03:00
issue-23304-2.rs Move some tests 2024-04-21 15:43:43 -03:00
issue-42747.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-67945-1.rs
issue-67945-1.stderr Improve the diagnostics for unused generic parameters 2024-02-01 16:18:03 +01:00
issue-67945-2.rs
issue-67945-2.stderr Improve the diagnostics for unused generic parameters 2024-02-01 16:18:03 +01:00
nested-enum.rs Tweak tests to avoid confusing suggestion output 2024-07-12 03:02:57 +00:00
nested-enum.stderr Tweak tests to avoid confusing suggestion output 2024-07-12 03:02:57 +00:00
suggest-default-attribute.rs
suggest-default-attribute.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
union-in-enum.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00