-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Give helpful suggestions for code containing {integer} and other non-concrete types #97677
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
sodiboo
added
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Jun 3, 2022
We could probably suppress this suggestion easily, but that's somewhat sad -- instead, I've been meaning to rework @rustbot claim |
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this issue
Jun 11, 2022
…dy, r=cjgillot Tidy up miscellaneous bounds suggestions Just some small fixes to suggestions - Generalizes `Ty::is_suggestable` into a `TypeVisitor`, so that it can be called on things other than `Ty` - Makes `impl Trait` in arg position no longer suggestible (generalizing the fix in rust-lang#97640) - Fixes `impl Trait` not being replaced with fresh type param when it's deeply nested in function signature (fixes rust-lang#97760) - Fixes some poor handling of `where` clauses with no predicates (also rust-lang#97760) - Uses `InferCtxt::resolve_numeric_literals_with_default` so we suggest `i32` instead of `{integer}` (fixes rust-lang#97677) Sorry there aren't many tests the fixes. Most of them would just be duplicates of other tests with empty `where` clauses or `impl Trait` in arg position instead of generic params. Let me know if you'd want more test coverage.
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
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following initial code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=37a16d044452d822d2e20198fe11f2bc
The output of this code is acceptable and helpful.
Ideally the compiler would suggest
Output = N
instead ofOutput = {integer}
, and infer that from the function body, i guess? I don't know, really, and it's not the main point of this issueThe problem is with the code that is suggested, which if copied verbatim, looks like this: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=304fea0cb18adf21f14c2d39a327b652
And for this code, the current output is:
Ideally the output should look like:
Ideally, this help message should also appear if a constant
{integer}
does exist but causes an error.The text was updated successfully, but these errors were encountered: