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

Report an error if resolution of closure call functions failed #86249

Merged
merged 2 commits into from
Jul 12, 2021

Conversation

FabianWolff
Copy link
Contributor

This pull request fixes #86238. The current implementation seems to assume that resolution of closure call functions (I'm not sure what the proper term is; I mean call of Fn etc.) can never fail:

None => {
span_bug!(
self.call_expr.span,
"failed to find an overloaded call trait for closure call"
);
}

But actually, it can, if the fn/fn_mut/fn_once lang items are not defined, or don't have an associated call/call_mut/call_once function, leading to the ICE described in #86238. I have therefore turned the span_bug!() into an error message, which prevents the ICE.

@rust-highfive
Copy link
Contributor

r? @varkor

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 12, 2021
Comment on lines 598 to 599
"make sure the `fn`/`fn_mut`/`fn_once` lang items are defined \
and have an associated `call`/`call_mut`/`call_once` function",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"make sure the `fn`/`fn_mut`/`fn_once` lang items are defined \
and have an associated `call`/`call_mut`/`call_once` function",
"make sure the `fn`/`fn_mut`/`fn_once` lang items are defined \
and have associated `call`/`call_mut`/`call_once` functions",

Just to make sure the plurals match up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thanks for the review!

@varkor
Copy link
Member

varkor commented Jun 30, 2021

This looks good. r=me after tweaking the wording. Sorry for taking so long to get to this.

@varkor varkor added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 30, 2021
@varkor
Copy link
Member

varkor commented Jul 11, 2021

Thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 11, 2021

📌 Commit dab25ab has been approved by varkor

@bors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 11, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jul 11, 2021
Report an error if resolution of closure call functions failed

This pull request fixes rust-lang#86238. The current implementation seems to assume that resolution of closure call functions (I'm not sure what the proper term is; I mean `call` of `Fn` etc.) can never fail:
https://github.com/rust-lang/rust/blob/60f1a2fc4b535ead9c85ce085fdce49b1b097531/compiler/rustc_typeck/src/check/callee.rs#L590-L595

But actually, it can, if the `fn`/`fn_mut`/`fn_once` lang items are not defined, or don't have an associated `call`/`call_mut`/`call_once` function, leading to the ICE described in rust-lang#86238. I have therefore turned the `span_bug!()` into an error message, which prevents the ICE.
@bors
Copy link
Collaborator

bors commented Jul 11, 2021

⌛ Testing commit dab25ab with merge 54aaca8...

@bors
Copy link
Collaborator

bors commented Jul 12, 2021

☀️ Test successful - checks-actions
Approved by: varkor
Pushing 54aaca8 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 12, 2021
@bors bors merged commit 54aaca8 into rust-lang:master Jul 12, 2021
@rustbot rustbot added this to the 1.55.0 milestone Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
5 participants