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

diagnostics: use rustc_on_unimplemented to recommend [].iter() #94746

Merged

Conversation

notriddle
Copy link
Contributor

To make this work, the #[rustc_on_unimplemented] data needs to be used to
report method resolution errors, which is most of what this commit does.

Fixes #94581

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 8, 2022
@rust-highfive
Copy link
Collaborator

r? @davidtwco

(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 Mar 8, 2022
@rust-log-analyzer

This comment has been minimized.

@notriddle notriddle force-pushed the notriddle/method-rustc-on-unimplemented branch from 98d9d80 to f8dd9d8 Compare March 8, 2022 19:35
@rust-log-analyzer

This comment has been minimized.

@notriddle notriddle force-pushed the notriddle/method-rustc-on-unimplemented branch from f8dd9d8 to 81e9fad Compare March 8, 2022 19:47
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

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

This looks good to me - diagnostics are much improved.

@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Mar 9, 2022

📌 Commit 81e9fad has been approved by davidtwco

@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 Mar 9, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Mar 9, 2022
…-unimplemented, r=davidtwco

diagnostics: use rustc_on_unimplemented to recommend `[].iter()`

To make this work, the `#[rustc_on_unimplemented]` data needs to be used to
report method resolution errors, which is most of what this commit does.

Fixes rust-lang#94581
@bors
Copy link
Contributor

bors commented Mar 9, 2022

⌛ Testing commit 81e9fad with merge 98b46a5f9d617746a362517cb83438c64faf213b...

@Dylan-DPC
Copy link
Member

@bors r- retry
failed in rollup

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 9, 2022
@Dylan-DPC
Copy link
Member

@bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 9, 2022
@rust-log-analyzer

This comment has been minimized.

To make this work, the `#[rustc_on_unimplemented]` data needs to be used to
report method resolution errors, which is most of what this commit does.

Fixes rust-lang#94581
@notriddle notriddle force-pushed the notriddle/method-rustc-on-unimplemented branch from 81e9fad to 32d7f81 Compare March 9, 2022 16:55
@notriddle
Copy link
Contributor Author

@Dylan-DPC

Okay, the change I pushed should restore the old error message ordering, by making sure all the extra annotations are pushed to the DiagnosticBuilder after the primary error span. This should ensure that the primary file always goes first, instead of sometimes going first and non-deterministically swapping the primary file with some other file.

@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Mar 10, 2022

📌 Commit 32d7f81 has been approved by davidtwco

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 10, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 10, 2022
…askrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#92150 (Improve suggestion when casting usize to (possibly) wide pointer)
 - rust-lang#94635 (Merge `#[deprecated]` and `#[rustc_deprecated]`)
 - rust-lang#94657 (Constify `Index{,Mut}` for `[T]`, `str`, and `[T; N]`)
 - rust-lang#94746 (diagnostics: use rustc_on_unimplemented to recommend `[].iter()`)
 - rust-lang#94788 (Account for suggestions for complete removal of lines)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e7281d0 into rust-lang:master Mar 10, 2022
@rustbot rustbot added this to the 1.61.0 milestone Mar 10, 2022
@notriddle notriddle deleted the notriddle/method-rustc-on-unimplemented branch March 10, 2022 15:26
notriddle added a commit to notriddle/rust that referenced this pull request Mar 11, 2022
Fixes a minor regression caused by rust-lang#94746, where iter::Filter is
spurriously declared "not an iterator."
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 12, 2022
…, r=oli-obk

diagnostics: do not spurriously claim something is "not an iterator"

Fixes a minor regression caused by rust-lang#94746, where `iter::Filter` is spurriously declared "not an iterator."
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better error message when forgetting iter() on slices
8 participants