-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Reword "Required because of the requirements on the impl of ..." #98807
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
@bors rollup=never |
@bors r- i like this but maybe let's tweak this further. give me some time to do some thinking. |
@compiler-errors it wasnt approved, just marked never for rollup 😂 |
☔ The latest upstream changes (presumably #91743) made this pull request unmergeable. Please resolve the merge conflicts. |
@Dylan-DPC -- ack, this is why I should fully wake up before I start to review emails. sorry for the mistake. |
Anyways, @cbeuw, maybe let's try some wording that still mentions this is a requirement that results from another: maybe something along the lines of "required because of the the impl of |
I feel like this is ambiguous as to whether an impl of |
@cbeuw, this is an ImplDerivedObligation, so this requirement should always be due to an impl's where-clause requirements (or implied bounds). The old messaging also mentioned that this was due to an Can you find me an example where mentioning that this is due to an |
When the trait is supposed to be derived. For example, this test rust/src/test/ui/consts/const-blocks/fn-call-in-non-const.rs Lines 1 to 16 in 0e21a27
The current message says "required because of the requirements on the impl of And in cases where the error could be resolved with an explicit rust/src/test/ui/integral-indexing.stderr Lines 1 to 9 in 0e21a27
I would be nice if As I pointed out above, this could also be misread in the opposite direction: that an |
So the fact that this is an
I guess what we disagree on is the fact that the impl exists. Side-note that I totally agree with "required because of the requirements" is a bit roundabout, but that's a bit unrelated with my concerns about this rewording. While it's true that I guess we could be more explicit, and say something like "required due to the impl of The problem I have with your proposed wording is that loses the fact that this is a derived bound, and one that results from an |
Given this sample code: struct Foo;
trait Bar {}
trait Qux {}
impl<T> Bar for Option<T> where T: Qux {}
fn needs_bar(t: impl Bar) {}
fn main() {
needs_bar(Some(Foo));
} We currently say:
I think that the proposed rewording is a bit awkward specifically when we're actually able to point out the
|
Side-note, we could probably specify two different messages depending on if the If we have a impl that is associated with a span we can point out (i.e. not and if we don't, we could probably go with a slightly modified wording of "required for Thoughts? |
I agree that I think having a different message when a span is immediately printed below is a good idea, and I like the "required for X to do Y" wording On another note, in your example, it said
but not really. Maybe it should point out the relevant unsatisfied predicate, i.e. "the trait |
Ping from triage: FYI: when a PR is ready for review, send a message containing |
1fefe39
to
6fa6e2d
Compare
Sorry for leaving this for a while. I've now changed it to "required for I tried to refine it to "required for this impl to satisfy @rustbot ready |
☔ The latest upstream changes (presumably #99860) made this pull request unmergeable. Please resolve the merge conflicts. |
Ugh, this is bitrotty of course. Please rebase this, then r=me (i.e. write @bors delegate+ p=1 |
📌 Commit 6fa6e2dc675035b782c292d939f309de2ab734d5 has been approved by `compiler-errors`` It is now in the queue for this repository. |
oops haha @bors r- |
6fa6e2d
to
84a1993
Compare
@bors r=compiler-errors |
@cbeuw: 🔑 Insufficient privileges: Not in reviewers |
@rustbot ready |
I am dumb and forgot to delegate, sorry. @bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (0b79f75): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
Rephrases the awkward "Required because of the requirements on the impl of
{trait}
for{type}
" to "required for{type}
to implement{trait}
"