|
| 1 | +// Regression test for #146586 |
| 2 | + |
| 3 | +//@ only-linux |
| 4 | +//@ compile-flags: --error-format=human --color=always |
| 5 | + |
| 6 | +enum Enum { |
| 7 | + Unit, |
| 8 | + Tuple(i32), |
| 9 | + Struct { x: i32 }, |
| 10 | +} |
| 11 | + |
| 12 | +fn foo(_: Enum) {} |
| 13 | + |
| 14 | +fn main() { |
| 15 | + foo(Enum::Unit); |
| 16 | + foo(Enum::Tuple); |
| 17 | + foo(Enum::Struct); // Highlight is wrong and suggestion is malformed |
| 18 | + foo(Enum::Unit()); |
| 19 | + foo(Enum::Tuple()); |
| 20 | + foo(Enum::Struct()); |
| 21 | + foo(Enum::Unit {}); |
| 22 | + foo(Enum::Tuple {}); |
| 23 | + foo(Enum::Struct {}); |
| 24 | + foo(Enum::Unit(0)); |
| 25 | + foo(Enum::Tuple(0)); |
| 26 | + foo(Enum::Struct(0)); |
| 27 | + foo(Enum::Unit { x: 0 }); |
| 28 | + foo(Enum::Tuple { x: 0 }); |
| 29 | + foo(Enum::Struct { x: 0 }); |
| 30 | + foo(Enum::Unit(0, 0)); |
| 31 | + foo(Enum::Tuple(0, 0)); |
| 32 | + foo(Enum::Struct(0, 0)); |
| 33 | + foo(Enum::Unit { x: 0, y: 0 }); |
| 34 | + foo(Enum::Tuple { x: 0, y: 0 }); |
| 35 | + foo(Enum::Struct { x: 0, y: 0 }); |
| 36 | + foo(Enum::unit); // Suggestion was malformed |
| 37 | + foo(Enum::tuple); // Suggestion could be enhanced |
| 38 | + foo(Enum::r#struct); // Suggestion was malformed |
| 39 | + foo(Enum::unit()); |
| 40 | + foo(Enum::tuple()); |
| 41 | + foo(Enum::r#struct()); |
| 42 | + foo(Enum::unit {}); // Suggestion could be enhanced |
| 43 | + foo(Enum::tuple {}); // Suggestion could be enhanced |
| 44 | + foo(Enum::r#struct {}); // Suggestion could be enhanced |
| 45 | + foo(Enum::unit(0)); |
| 46 | + foo(Enum::tuple(0)); |
| 47 | + foo(Enum::r#struct(0)); |
| 48 | + foo(Enum::unit { x: 0 }); // Suggestion could be enhanced |
| 49 | + foo(Enum::tuple { x: 0 }); // Suggestion could be enhanced |
| 50 | + foo(Enum::r#struct { x: 0 }); |
| 51 | + foo(Enum::unit(0, 0)); |
| 52 | + foo(Enum::tuple(0, 0)); |
| 53 | + foo(Enum::r#struct(0, 0)); |
| 54 | + foo(Enum::unit { x: 0, y: 0 }); // Suggestion could be enhanced |
| 55 | + foo(Enum::tuple { x: 0, y: 0 }); // Suggestion could be enhanced |
| 56 | + foo(Enum::r#struct { x: 0, y: 0 }); // Suggestion could be enhanced |
| 57 | +} |
0 commit comments