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

Improve ?Sized diagnostics #69243

Closed
mgattozzi opened this issue Feb 17, 2020 · 2 comments · Fixed by #69942
Closed

Improve ?Sized diagnostics #69243

mgattozzi opened this issue Feb 17, 2020 · 2 comments · Fixed by #69942
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@mgattozzi
Copy link
Contributor

Context: https://twitter.com/mgattozzi/status/1229477994961494021

A way to improve the diagnostics when suggesting to relax trait bounds with ?Sized is to show how one would use it on a struct/fn with their code rather than just suggesting it, making it easier for newer people, or those first encountering the issue to more clearly understand how this works.

cc/ @estebank

@jonas-schievink jonas-schievink added A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 17, 2020
@LeSeulArtichaut
Copy link
Contributor

LeSeulArtichaut commented Feb 17, 2020

What about having a separate error code, so that --explain can give details and examples about DSTs?

@estebank
Copy link
Contributor

I think that we get 80% there by using span_suggestion_verbose instead of span_suggestion and an extra 10% by adding a note explaining a bit of this. The last 10% would be a specific error code, but we have shied away from replacing E0277s in the past.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 14, 2020
…hewjasper

Increase verbosity when suggesting subtle code changes

Do not suggest changes that are actually quite small inline, to minimize the likelihood of confusion.

Fix rust-lang#69243.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 22, 2020
…hewjasper

Increase verbosity when suggesting subtle code changes

Do not suggest changes that are actually quite small inline, to minimize the likelihood of confusion.

Fix rust-lang#69243.
@bors bors closed this as completed in 906b399 Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants