-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Change orphan hint from "only" to "any uncovered type inside..." #128391
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @spastorino (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
This comment has been minimized.
This comment has been minimized.
Argh, forgot the patch to the tests, will be home soon and add that. @rustbot author |
@rustbot review |
@@ -351,7 +351,7 @@ hir_analysis_only_current_traits_arbitrary = only traits defined in the current | |||
|
|||
hir_analysis_only_current_traits_foreign = this is not defined in the current crate because this is a foreign trait | |||
|
|||
hir_analysis_only_current_traits_label = impl doesn't use only types from inside the current crate | |||
hir_analysis_only_current_traits_label = impl doesn't use any uncovered types from inside the current crate |
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.
this is also not quite correct
the requirement is that given an impl impl<T0..TN> Trait<P1..Pn> for P0
, there exists an uncovered local type at position Pi
such that P0..Pi
does not contain any uncovered generic parameters
impl<T> Trait<Local> for T {}
also results in this error
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.
That's correct of course, I didn't want to increase the verbosity too much.
What do you think of appending "before any uncovered generic type parameters". This again isn't totally bullet proof as P0
is only logically before the other Pn
but is not before them in the source.
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.
maybe something like:
- "note: impl has uncovered type parameters before any local types"
- "note: for more information see "
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.
I think it's not so clear that "no local types" is also problematic when inverted like this. I prefer the original negated version. I do like the shortened "local type" instead of "types from inside the current crate", when we link to the reference anyways I think we can get away with it as it expands on what a "local type" is:
- "note: impl doesn't have any local type before any uncovered type parameters"
- "note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules"
I'm guessing that's the link you meant to add here? Is it ok to link to a fragment of the reference?
I'll see if I can figure out how to add multi line notes (multiple notes?).
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.
mutliple notes, yeah
your suggestion looks good to me
r? @lcnr (as you're already reviewing it), but this looks good to me with the last suggestion |
@@ -5,7 +5,8 @@ LL | impl<T> Remote for Pair<Cover<T>,T> { } | |||
| ^^^^^^^^^^^^^^^^^^^---------------- | |||
| | | | |||
| | `Pair` is not defined in the current crate | |||
| impl doesn't use any uncovered types from inside the current crate | |||
| impl doesn't have any local type before any uncovered type parameters | |||
| for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules |
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.
vibe: I feel like these two lines should be notes, not labels
one nit, apart from that r=me |
going through my list of active reviews today @rustbot author |
@cafce25 any updates on this? thanks |
@Dylan-DPC Thanks for checking in, dropped the ball a bit here. I've tried to just convert the labels to notes, but that leads to the notes being mixed with repeats of the span which seems suboptimal so I've also moved them to the |
@bors r+ rollup thanks |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#128391 (Change orphan hint from "only" to "any uncovered type inside...") - rust-lang#131583 (Setting up indirect access to external data for loongarch64-linux-{musl,ohos}) - rust-lang#131595 (rustdoc-JSON: Rename "object safe" to "dyn compatible") - rust-lang#131748 (cleanup canonical queries) - rust-lang#131798 (llvm: Tolerate propagated range metadata) - rust-lang#131815 (compiler: use `is_none_or` where it is clearly better) - rust-lang#131822 (extract `expr_assign_expected_bool_error`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#128391 - cafce25:issue-128390, r=lcnr Change orphan hint from "only" to "any uncovered type inside..." Fix rust-lang#128390
Fix #128390