-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enum type instead of variant suggestion unification #56188
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks good to me, a few small nits.
(tight schedule this week; expect revision and/or reply Saturday the first) |
This comment has been minimized.
This comment has been minimized.
56027e9
to
373417a
Compare
Unfortunately, I fear that my estimates are systemically biased. 😰 Rebased and replied to comments above @davidtwco |
This comment has been minimized.
This comment has been minimized.
373417a
to
6fabc24
Compare
(force-pushed again to cope with |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
(most recent Travis error) Ugh, I don't know how that E0412 changed to a E0425: almost certainly just recent development on master (and really, the E0425 is probably better); can't cope with task-switching now but will cursorily investigate and re- |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last nit then r=me.
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 rust-lang#56028. In the matter of message wording, "you can" is redundant (and perhaps too informal); prefer the imperative.
The present author regrets not thinking of a more eloquent way to do this.
6fabc24
to
64ad3e2
Compare
@davidtwco thanks for reviewing! @bors r=davidtwco |
📌 Commit 64ad3e2 has been approved by |
⌛ Testing commit 64ad3e2 with merge ff677d5a829cd4972f7fb9f4fae6cd95a7afef86... |
💔 Test failed - status-travis |
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
…dtwco enum type instead of variant suggestion unification Fixes rust-lang#56028. 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 rust-lang#56028. In the matter of message wording, "you can" is redundant (and perhaps too informal); prefer the imperative. In a second commit, we do some unprincipled special-casing to correct and beautify suggestions for `Option` and `Result` (where the existing code was being confused by their being reexported in the prelude). r? @davidtwco
Rollup of 10 pull requests Successful merges: - #56188 (enum type instead of variant suggestion unification ) - #56916 (Fix mutable references in `static mut`) - #56917 (Simplify MIR generation for logical operations) - #56953 (Mark tuple structs as live if their constructors are used) - #56964 (Remove `TokenStream::JointTree`.) - #56966 (Correct strings for raw pointer deref and array access suggestions) - #56999 (AST/HIR: Introduce `ExprKind::Err` for better error recovery in the front-end) - #57020 (Point to cause of `fn` expected return type) - #57032 (fix deprecation warnings in liballoc benches) - #57053 (Fix alignment for array indexing) Failed merges: r? @ghost
…dtwco enum type instead of variant suggestion unification Fixes rust-lang#56028. 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 rust-lang#56028. In the matter of message wording, "you can" is redundant (and perhaps too informal); prefer the imperative. In a second commit, we do some unprincipled special-casing to correct and beautify suggestions for `Option` and `Result` (where the existing code was being confused by their being reexported in the prelude). r? @davidtwco
…dtwco enum type instead of variant suggestion unification Fixes rust-lang#56028. 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 rust-lang#56028. In the matter of message wording, "you can" is redundant (and perhaps too informal); prefer the imperative. In a second commit, we do some unprincipled special-casing to correct and beautify suggestions for `Option` and `Result` (where the existing code was being confused by their being reexported in the prelude). r? @davidtwco
⌛ Testing commit 64ad3e2 with merge 7af2108c65678702fff2a9646b999d1a3e7afa21... |
💔 Test failed - status-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Rollup of 14 pull requests Successful merges: - #56188 (enum type instead of variant suggestion unification ) - #56342 (Improve docs for collecting into `Option`s) - #56916 (Fix mutable references in `static mut`) - #56917 (Simplify MIR generation for logical operations) - #56939 (Pin stabilization) - #56953 (Mark tuple structs as live if their constructors are used) - #56964 (Remove `TokenStream::JointTree`.) - #56966 (Correct strings for raw pointer deref and array access suggestions) - #57020 (Point to cause of `fn` expected return type) - #57032 (fix deprecation warnings in liballoc benches) - #57053 (Fix alignment for array indexing) - #57062 (Fix a comment) - #57067 (Stabilize min_const_unsafe_fn in 1.33) - #57078 (Ignore two tests on s390x) Failed merges: r? @ghost
Fixes #56028.
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 thehas_unexpected_resolution
argument toerror_code
).Since
import_candidate_to_paths
has no other callers, we are free to stop returning the span and rename the function. By usingspan_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.
In a second commit, we do some unprincipled special-casing to correct and beautify suggestions for
Option
andResult
(where the existing code was being confused by their being reexported in the prelude).r? @davidtwco