-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
typeck: limit number of candidates shown for a single error #33338
Conversation
r? @Aatch (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -236,8 +236,10 @@ pub fn report_error<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, | |||
mut sources: Vec<CandidateSource>) { | |||
sources.sort(); | |||
sources.dedup(); | |||
// Dynamic limit to avoid hiding just one candidate, which is silly. | |||
let limit = if sources.len() == 11 { 11 } else { 10 }; |
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.
good idea
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.
good idea
LGTM. I'd like someone else (@jonathandturner?) to rubber-stamp the number 10 as well, though 😄 |
How difficult would it be to show an elision? Something like:
FWIW, I'm fine stopping at 10, but I think it'd be good to let the user know there were others, they just aren't shown. |
@jonathandturner it should already say "N more candidates not shown" at the end. I just found another example in rust/src/librustc/traits/error_reporting.rs Line 209 in 90318b8
|
Great, I missed that. If it has the message, I'm fine stopping even sooner than 10. 4 sounds good. |
sgtm either way. I'd like to switch to "and N others" though, let's keep things uniform. @bors delegate+ |
✌️ @birkenfeld can now approve this pull request |
@bors r=Manishearth |
📌 Commit 9508180 has been approved by |
⌛ Testing commit 9508180 with merge db2531f... |
@bors clean force |
@bors r- clean force (something's wrong with the queue) |
@bors r+ clean |
📌 Commit 9508180 has been approved by |
@bors: retry force clean |
Is the travis failure here legitimate? |
Yes; the diagnostics API changed on master. I'll fix it soon. |
☔ The latest upstream changes (presumably #33425) made this pull request unmergeable. Please resolve the merge conflicts. |
Limit of 4 taken consistent with limit for "similar impl candidates" in rustc::traits::error_reporting. Fixes: rust-lang#25356
Rebased. |
@bors r+ |
📌 Commit 6ab93d7 has been approved by |
typeck: limit number of candidates shown for a single error No idea if 10/11 is a good limit. Are there any other such limits in rustc currently? Fixes: #25356
No idea if 10/11 is a good limit. Are there any other such limits in rustc currently?
Fixes: #25356