diff options
| author | Zack M. Davis <code@zackmdavis.net> | 2018-11-18 22:21:38 -0800 |
|---|---|---|
| committer | Zack M. Davis <code@zackmdavis.net> | 2018-12-22 17:40:48 -0800 |
| commit | 3986c964481a048100565c8d30b1937ec2eb516d (patch) | |
| tree | 89e89d7ca0def45c4bdd824e8b8c07186e5a72b9 /src/test/ui/variants | |
| parent | 2d3e909e4e68259e15ca2908ff9e854f0a68bbec (diff) | |
| download | rust-3986c964481a048100565c8d30b1937ec2eb516d.tar.gz rust-3986c964481a048100565c8d30b1937ec2eb516d.zip | |
enum type instead of variant suggestion unification
Weirdly, we were deciding between a help note and a structured suggestion based on whether the import candidate span was a dummy—but we weren't using that span in any case! The dummy-ness of the span (which appears to be a matter of this-crate vs. other-crate definition) isn't the right criterion by which we should decide whether it's germane to mention that "there is an enum variant"; instead, let's use the someness of `def` (which is used as the `has_unexpected_resolution` argument to `error_code`). Since `import_candidate_to_paths` has no other callers, we are free to stop returning the span and rename the function. By using `span_suggestions_`, we leverage the max-suggestions output limit already built in to the emitter, thus resolving #56028. In the matter of message wording, "you can" is redundant (and perhaps too informal); prefer the imperative.
Diffstat (limited to 'src/test/ui/variants')
| -rw-r--r-- | src/test/ui/variants/variant-used-as-type.stderr | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/test/ui/variants/variant-used-as-type.stderr b/src/test/ui/variants/variant-used-as-type.stderr index 972fe8a8a61..c72729923ef 100644 --- a/src/test/ui/variants/variant-used-as-type.stderr +++ b/src/test/ui/variants/variant-used-as-type.stderr @@ -3,28 +3,24 @@ error[E0573]: expected type, found variant `Ty::A` | LL | B(Ty::A), | ^^^^^ not a type -help: you can try using the variant's enum - | -LL | B(Ty), - | ^^ -help: you can try using the variant's enum +help: try using the variant's enum | LL | B(E), | ^ +LL | B(Ty), + | ^^ error[E0573]: expected type, found variant `E::A` --> $DIR/variant-used-as-type.rs:27:6 | LL | impl E::A {} | ^^^^ not a type -help: you can try using the variant's enum - | -LL | impl Ty {} - | ^^ -help: you can try using the variant's enum +help: try using the variant's enum | LL | impl E {} | ^ +LL | impl Ty {} + | ^^ error: aborting due to 2 previous errors |
