-
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
Don't suggest types whose inner type is erroneous #91450
Conversation
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
eb9392d
to
4607123
Compare
☔ The latest upstream changes (presumably #91354) made this pull request unmergeable. Please resolve the merge conflicts. |
Could you add the code from the issue as a test case? |
r=me with a test and resolved merge conflict (please squash your changes to a single commit on top of recent master). |
4607123
to
f8b8a5c
Compare
// This test ensures that the compiler does not suggest `Foo<[type error]>` in diagnostic messages. | ||
|
||
fn foo() -> Option<_> {} //~ ERROR: [E0308] | ||
//~^ ERROR: the type placeholder `_` is not allowed |
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 wanted to add a "negative" test of "help: replace with the correct return type: Foo<[type error]>
" here to detect any regressions in the future but IIRC there isn't such annotation ;)
I don't think I have the permission to do it but let me try |
@hkmatsumoto: 🔑 Insufficient privileges: Not in reviewers |
Fair enough, @estebank could you take another look? |
@bors r+ |
📌 Commit f8b8a5c96ad2fc7231d5da8e98d2eb130460f9c3 has been approved by |
☔ The latest upstream changes (presumably #91491) made this pull request unmergeable. Please resolve the merge conflicts. |
f8b8a5c
to
c952863
Compare
This comment has been minimized.
This comment has been minimized.
Currently, we check if the returned type equals to `tcx.ty_error()` not to emit erroneous types, but this has a pitfall; for example, `Option<[type error]> != tcx.ty_error()` holds.
c952863
to
9b77a1e
Compare
@bors r=estebank |
📌 Commit 9b77a1e has been approved by |
…askrgr Rollup of 4 pull requests Successful merges: - rust-lang#90529 (Skip reborrows in AbstractConstBuilder) - rust-lang#91437 (Pretty print empty blocks as {}) - rust-lang#91450 (Don't suggest types whose inner type is erroneous) - rust-lang#91535 (Stabilize `-Z emit-future-incompat` as `--json future-incompat`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Currently, we check if the returned type equals to
tcx.ty_error()
not to emiterroneous types, but this has a pitfall; for example,
Option<[type error]> != tcx.ty_error()
holds.Fixes #91371.