Skip to content
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

Add explanation to type mismatch involving type params and assoc types #63907

Merged
merged 1 commit into from
Sep 22, 2019

Conversation

estebank
Copy link
Contributor

CC #63711

@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 26, 2019
@estebank
Copy link
Contributor Author

@rust-lang/wg-diagnostics can I get some eyeballs on this? I would like feedback on the copy, verbosity and ideas.

- change `foo` to return an argument of type `T`:
```
impl<T> Trait<T> for X {
fn foo(&self, x: T) -> T { x }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one confused me since it hinges on changes to the trait def as well as the impl

db.note("you might be missing a type parameter or trait bound");
}
(ty::Param(_), _) | (_, ty::Param(_)) => {
db.help("given a type parameter `T` and a method `foo`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we gate the long explanations (both of them) under the teaching flag?

Copy link
Contributor Author

@estebank estebank Aug 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, but I'm getting more and more convinced that --teach will not be as useful as focusing on improving the existing default errors. I would like help editing and pruning down the error. We could even give this case a different error code to have somewhere to put these explanations. Then we could have --teach just embed the error code text below the error when they are flagged as not having special support for it... 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just think we need to keep in mind folks who have already learned the concept and don't want to be spammed down with very long messages (which are useful to beginners but not familiar folks).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.

I think it would be better if we just had a section in the book that we could link to explaining this case. Having at most two lines, including link, of text should be reasonable (and is my unofficial cutoff for these kind of messages).

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sgtm

@JohnCSimon JohnCSimon added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 7, 2019
@JohnCSimon
Copy link
Member

Ping from triage:
@estebank @fbstj
Hi! Can you please resolve the merge conflicts so that this can move forward?
Thank you!

@JohnCSimon
Copy link
Member

Pinging again from triage:
@estebank @fbstj
Can you please resolve the merge conflicts so that this can move forward?
Thank you!

@estebank
Copy link
Contributor Author

I'll be getting back to this over the weekend.

@estebank estebank changed the title [WIP] Add explanation to type mismatch involving type params and assoc types Add explanation to type mismatch involving type params and assoc types Sep 19, 2019
@estebank estebank added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 19, 2019
@oli-obk oli-obk assigned oli-obk and unassigned eddyb Sep 21, 2019
@oli-obk
Copy link
Contributor

oli-obk commented Sep 21, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Sep 21, 2019

📌 Commit 479ce39 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 21, 2019
Centril added a commit to Centril/rust that referenced this pull request Sep 21, 2019
…-obk

Add explanation to type mismatch involving type params and assoc types

CC rust-lang#63711
bors added a commit that referenced this pull request Sep 22, 2019
Rollup of 9 pull requests

Successful merges:

 - #63907 (Add explanation to type mismatch involving type params and assoc types)
 - #64615 (rustbuild: Turn down compression on exe installers)
 - #64617 (rustbuild: Turn down compression on msi installers)
 - #64618 (rustbuild: Improve output of `dist` step)
 - #64619 (Fixes #63962. Hint about missing tuple parentheses in patterns)
 - #64634 (Update to LLVM 9.0.0)
 - #64635 (Allow using fn pointers in const fn with unleash miri)
 - #64660 (unify errors for tuple/struct variants)
 - #64664 (fully remove AstBuilder)

Failed merges:

r? @ghost
@bors bors merged commit 479ce39 into rust-lang:master Sep 22, 2019
@estebank estebank deleted the assoc-type-mismatch branch November 9, 2023 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants