-
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
Improve suggestion for calling fn-like expr on type mismatch #98280
Merged
bors
merged 1 commit into
rust-lang:master
from
compiler-errors:better-call-closure-on-type-err
Jun 24, 2022
Merged
Improve suggestion for calling fn-like expr on type mismatch #98280
bors
merged 1 commit into
rust-lang:master
from
compiler-errors:better-call-closure-on-type-err
Jun 24, 2022
+143
−125
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rustbot
added
the
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
label
Jun 20, 2022
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Jun 20, 2022
compiler-errors
commented
Jun 20, 2022
lcnr
reviewed
Jun 20, 2022
let sig = self.tcx.bound_item_bounds(def_id).subst(self.tcx, substs).iter().find_map(|pred| { | ||
if let ty::PredicateKind::Projection(proj) = pred.kind().skip_binder() | ||
&& Some(proj.projection_ty.item_def_id) == self.tcx.lang_items().fn_once_output() | ||
&& let ty::Tuple(args) = proj.projection_ty.substs.type_at(1).kind() // args tuple will always be substs[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.
Suggested change
&& let ty::Tuple(args) = proj.projection_ty.substs.type_at(1).kind() // args tuple will always be substs[1] | |
// args tuple will always be substs[1] | |
&& let ty::Tuple(args) = proj.projection_ty.substs.type_at(1).kind() |
r=me after addressing the comment comment :) |
compiler-errors
force-pushed
the
better-call-closure-on-type-err
branch
from
June 22, 2022 01:12
b85719a
to
d15fed7
Compare
@bors r=estebank |
📌 Commit d15fed7 has been approved by |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Jun 22, 2022
compiler-errors
added a commit
to compiler-errors/rust
that referenced
this pull request
Jun 23, 2022
…-on-type-err, r=estebank Improve suggestion for calling fn-like expr on type mismatch 1.) Suggest calling values of with RPIT types (and probably TAIT) when we expect `Ty` and have `impl Fn() -> Ty` 2.) Suggest calling closures even when they're not assigned to a local variable first 3.) Drive-by fix of a pretty-printing bug (`impl Fn()-> Ty` => `impl Fn() -> Ty`) r? `@estebank`
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this pull request
Jun 24, 2022
…-on-type-err, r=estebank Improve suggestion for calling fn-like expr on type mismatch 1.) Suggest calling values of with RPIT types (and probably TAIT) when we expect `Ty` and have `impl Fn() -> Ty` 2.) Suggest calling closures even when they're not assigned to a local variable first 3.) Drive-by fix of a pretty-printing bug (`impl Fn()-> Ty` => `impl Fn() -> Ty`) r? ``@estebank``
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 24, 2022
Rollup of 9 pull requests Successful merges: - rust-lang#91264 (Add macro support in jump to definition feature) - rust-lang#96955 (Remove (transitive) reliance on sorting by DefId in pretty-printer) - rust-lang#97633 (Session object: Set OS/ABI) - rust-lang#98039 (Fix `panic` message for `BTreeSet`'s `range` API and document `panic` cases) - rust-lang#98214 (rustc_target: Remove some redundant target properties) - rust-lang#98280 (Improve suggestion for calling fn-like expr on type mismatch) - rust-lang#98394 (Fixup missing renames from `#[main]` to `#[rustc_main]`) - rust-lang#98411 (Update tendril) - rust-lang#98419 (Remove excess rib while resolving closures) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1.) Suggest calling values of with RPIT types (and probably TAIT) when we expect
Ty
and haveimpl Fn() -> Ty
2.) Suggest calling closures even when they're not assigned to a local variable first
3.) Drive-by fix of a pretty-printing bug (
impl Fn()-> Ty
=>impl Fn() -> Ty
)r? @estebank