resolve: improve "try using tuple struct" message

This commit improves the tuple struct case added in rust-lang/rust#77341
so that the context is mentioned in more of the message.

Signed-off-by: David Wood <david@davidtw.co>
This commit is contained in:
David Wood 2020-10-12 16:52:51 +01:00
parent adf31e95e4
commit f897162f3e
No known key found for this signature in database
GPG key ID: 2592E76C87381FD9
3 changed files with 20 additions and 20 deletions

View file

@ -2,7 +2,7 @@ error[E0423]: expected function, tuple struct or tuple variant, found enum `Opti
--> $DIR/issue-43871-enum-instead-of-variant.rs:19:13
|
LL | let x = Option(1);
| ^^^^^^ help: try using one of the enum's variants: `std::option::Option::Some`
| ^^^^^^ help: try to construct one of the enum's variants: `std::option::Option::Some`
|
= help: you might have meant to construct the enum's non-tuple variant
@ -10,7 +10,7 @@ error[E0532]: expected tuple struct or tuple variant, found enum `Option`
--> $DIR/issue-43871-enum-instead-of-variant.rs:21:12
|
LL | if let Option(_) = x {
| ^^^^^^ help: try using one of the enum's variants: `std::option::Option::Some`
| ^^^^^^ help: try to match against one of the enum's variants: `std::option::Option::Some`
|
= help: you might have meant to match against the enum's non-tuple variant
@ -18,7 +18,7 @@ error[E0532]: expected tuple struct or tuple variant, found enum `Example`
--> $DIR/issue-43871-enum-instead-of-variant.rs:27:12
|
LL | if let Example(_) = y {
| ^^^^^^^ help: try using one of the enum's variants: `Example::Ex`
| ^^^^^^^ help: try to match against one of the enum's variants: `Example::Ex`
|
= help: you might have meant to match against the enum's non-tuple variant
note: the enum is defined here

View file

@ -118,7 +118,7 @@ LL | | Tuple(),
LL | | Unit,
LL | | }
| |_^
help: try using one of the enum's variants
help: try to construct one of the enum's variants
|
LL | let x = A::TupleWithFields(3);
| ^^^^^^^^^^^^^^^^^^
@ -143,7 +143,7 @@ LL | | Tuple(),
LL | | Unit,
LL | | }
| |_^
help: try using one of the enum's variants
help: try to match against one of the enum's variants
|
LL | if let A::TupleWithFields(3) = x { }
| ^^^^^^^^^^^^^^^^^^