-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 diagnostics for specific cases for const/type mismatch err #82055
Conversation
This comment has been minimized.
This comment has been minimized.
7051772
to
ce12661
Compare
ce12661
to
be1ed00
Compare
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.
Thank you for tackling this! It'll make this feature so much nicer to use :)
error[E0747]: type provided when a constant was expected | ||
--> $DIR/diagnostics.rs:7:16 | ||
| | ||
LL | impl Foo for A<N> {} | ||
| ^ |
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 one should probably be silenced when the one above is emitted.
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 don't know how to detect when the above is emitted, as from the path resolution alone I cannot tell, but I've changed the message to be more pertinent.
LL | impl Foo for A<N> {} | ||
| ^ help: a struct with a similar name exists: `A` |
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.
Ideally this would suggest "you meant to add a const N
here and write this as A<{ N }>
".
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 hard to tell if a Res::Err
is this case or the other case where the path was not given enough generic args
6a3e497
to
cfae4a8
Compare
This comment has been minimized.
This comment has been minimized.
cfae4a8
to
c86676d
Compare
c86676d
to
2d08ec7
Compare
2d08ec7
to
73f2996
Compare
This comment has been minimized.
This comment has been minimized.
73f2996
to
6fb5b6e
Compare
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.
Left a few nitpicks, we're close to landing this I think :)
Just a note, it's currently implemented where it will also emit the ordering help just for demonstration purposes, should I take it out? |
6fb5b6e
to
e2d1d34
Compare
This comment has been minimized.
This comment has been minimized.
e2d1d34
to
b97951b
Compare
Ideally we would not emit that suggestion, but I guess it is fine for now and can be dealt with in a separate PR :-/ @bors r+ |
📌 Commit b97951b has been approved by |
r? @estebank |
@JulianKnodt could you file tickets for the two outstanding issues (silencing the reorder suggestion and handle the |
ah sure, but why shouldn't I just silence the reordering here since I know where to put it? |
Oh, if you can, go ahead. |
@bors r- |
37fbd71
to
f520295
Compare
@bors r+ |
📌 Commit f520295 has been approved by |
Add diagnostics for specific cases for const/type mismatch err For now, this adds at least more information so better diagnostics can be emitted for const mismatch errors. I'm not sure what exactly we want to emit, so I've left notes there temporarily, also to see if this is the right approach r? `@lcnr` cc: `@estebank`
Add diagnostics for specific cases for const/type mismatch err For now, this adds at least more information so better diagnostics can be emitted for const mismatch errors. I'm not sure what exactly we want to emit, so I've left notes there temporarily, also to see if this is the right approach r? ``@lcnr`` cc: ``@estebank``
Rollup of 8 pull requests Successful merges: - rust-lang#82055 (Add diagnostics for specific cases for const/type mismatch err) - rust-lang#82155 (Use !Sync std::lazy::OnceCell in usefulness checking) - rust-lang#82202 (add specs for riscv32/riscv64 musl targets) - rust-lang#82203 (Move some tests to more reasonable directories - 4) - rust-lang#82211 (make `suggest_setup` help messages better) - rust-lang#82212 (Remove redundant rustc_data_structures path component) - rust-lang#82240 (remove useless ?s (clippy::needless_question_marks)) - rust-lang#82243 (Add more intra-doc links to std::io) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
For now, this adds at least more information so better diagnostics can be emitted for const mismatch errors.
I'm not sure what exactly we want to emit, so I've left notes there temporarily, also to see if this is the right approach
r? @lcnr
cc: @estebank