-
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
Only shown relevant type params in E0283 label #90709
Conversation
r? @nagisa (rust-highfive has picked a reviewer for you, use r? to override) |
// Replace not yet inferred const params with their def name. | ||
self.tcx().mk_const_param(0, Symbol::intern("N"), c.ty).into() |
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.
Is this comment correct?
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.
A test where multiple parameters are not inferred would be nice too. Of particular interest would be a function that returns an array where both the value type and const length could not be inferred.
compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
Outdated
Show resolved
Hide resolved
ty::Infer(_) => t, | ||
// We don't want to hide the outermost type, only its type params. | ||
_ if self.level == 1 => t.super_fold_with(self), | ||
// Hide this type |
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'm slightly worried about the handling of ty::Error
s that come in as part of the input as they become indistinguishable from those that are produced by this TypeFolder
, but its probably fine…
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 would think that any naturally ocurring ty::Error
should be displayed as _
anyways. Worst case scenario on the next wave of errors the user will be told to fill it in.
compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
Outdated
Show resolved
Hide resolved
5c807b1
to
0f668ff
Compare
This comment has been minimized.
This comment has been minimized.
help: consider specifying the type arguments in the function call | ||
| | ||
LL | let foo = foo::<T, K, W, Z>(1, ""); | ||
| ++++++++++++++ |
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.
Outstanding: changing this to also use _
for the first two params here. Can be done as a follow up.
☔ The latest upstream changes (presumably #90352) made this pull request unmergeable. Please resolve the merge conflicts. |
3ce5b5e
to
e462819
Compare
@bors r+ |
@bors r=nagisa The bot seems to have been taking a nap. |
📌 Commit e462819 has been approved by |
…=nagisa Only shown relevant type params in E0283 label When we point at a binding to suggest giving it a type, erase all the type for ADTs that have been resolved, leaving only the ones that could not be inferred. For small shallow types this is not a problem, but for big nested types with lots of params, this can otherwise cause a lot of unnecessary visual output.
…=nagisa Only shown relevant type params in E0283 label When we point at a binding to suggest giving it a type, erase all the type for ADTs that have been resolved, leaving only the ones that could not be inferred. For small shallow types this is not a problem, but for big nested types with lots of params, this can otherwise cause a lot of unnecessary visual output.
Failed in a rollup, maybe just needs a small rebase and fixup..? |
e462819
to
b988151
Compare
@bors r=nagisa |
⌛ Testing commit b988151 with merge 21f0c7aafcdf0c6622a2f03305a57efcfb2cbf79... |
💔 Test failed - checks-actions |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #91539) made this pull request unmergeable. Please resolve the merge conflicts. |
When we point at a binding to suggest giving it a type, erase all the type for ADTs that have been resolved, leaving only the ones that could not be inferred. For small shallow types this is not a problem, but for big nested types with lots of params, this can otherwise cause a lot of unnecessary visual output.
When the value of a const param isn't inferred, replace it with the param name from the definition.
b988151
to
7271d1f
Compare
@bors r=nagisa |
📌 Commit 7271d1f has been approved by |
…=nagisa Only shown relevant type params in E0283 label When we point at a binding to suggest giving it a type, erase all the type for ADTs that have been resolved, leaving only the ones that could not be inferred. For small shallow types this is not a problem, but for big nested types with lots of params, this can otherwise cause a lot of unnecessary visual output.
…=nagisa Only shown relevant type params in E0283 label When we point at a binding to suggest giving it a type, erase all the type for ADTs that have been resolved, leaving only the ones that could not be inferred. For small shallow types this is not a problem, but for big nested types with lots of params, this can otherwise cause a lot of unnecessary visual output.
…=nagisa Only shown relevant type params in E0283 label When we point at a binding to suggest giving it a type, erase all the type for ADTs that have been resolved, leaving only the ones that could not be inferred. For small shallow types this is not a problem, but for big nested types with lots of params, this can otherwise cause a lot of unnecessary visual output.
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#90709 (Only shown relevant type params in E0283 label) - rust-lang#91551 (Allow for failure of subst_normalize_erasing_regions in const_eval) - rust-lang#91570 (Evaluate inline const pat early and report error if too generic) - rust-lang#91571 (Remove unneeded access to pretty printer's `s` field in favor of deref) - rust-lang#91610 (Link to rustdoc_json_types docs instead of rustdoc-json RFC) - rust-lang#91619 (Update cargo) - rust-lang#91630 (Add missing whitespace before disabled HTML attribute) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…=nagisa Only shown relevant type params in E0283 label When we point at a binding to suggest giving it a type, erase all the type for ADTs that have been resolved, leaving only the ones that could not be inferred. For small shallow types this is not a problem, but for big nested types with lots of params, this can otherwise cause a lot of unnecessary visual output.
When we point at a binding to suggest giving it a type, erase all the
type for ADTs that have been resolved, leaving only the ones that could
not be inferred. For small shallow types this is not a problem, but for
big nested types with lots of params, this can otherwise cause a lot of
unnecessary visual output.