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

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

Open
wants to merge 1 commit into
base: master
from

Conversation

@estebank
Copy link
Contributor

commented Aug 26, 2019

CC #63711

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Aug 26, 2019

r? @eddyb

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

@estebank

This comment has been minimized.

Copy link
Contributor Author

commented Aug 26, 2019

@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 }

This comment has been minimized.

Copy link
@fbstj

fbstj Aug 26, 2019

Contributor

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`:

This comment has been minimized.

Copy link
@Centril

Centril Aug 26, 2019

Member

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

This comment has been minimized.

Copy link
@estebank

estebank Aug 26, 2019

Author Contributor

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... 🤔

This comment has been minimized.

Copy link
@Centril

Centril Aug 26, 2019

Member

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).

This comment has been minimized.

Copy link
@estebank

estebank Sep 17, 2019

Author Contributor

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?

This comment has been minimized.

Copy link
@Centril
@JohnCSimon

This comment has been minimized.

Copy link

commented Sep 7, 2019

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

@JohnCSimon

This comment has been minimized.

Copy link

commented Sep 14, 2019

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

@estebank

This comment has been minimized.

Copy link
Contributor Author

commented Sep 17, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.