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

Fix ICE when calling non-functions within closures #46780

Merged
merged 5 commits into from Dec 22, 2017

Conversation

Projects
None yet
7 participants
@varkor
Contributor

varkor commented Dec 17, 2017

The visitor for walking function bodies did not previously properly
handle error-cases for function calls. These are now ignored,
preventing the panic. This fixes #46771.

@rust-highfive

This comment has been minimized.

Show comment
Hide comment
@rust-highfive

rust-highfive Dec 17, 2017

Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

Collaborator

rust-highfive commented Dec 17, 2017

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

fn main() {
struct Foo;
(1 .. 2).find(|_| Foo(0) == 0); //~ ERROR expected function, found `main::Foo`
}

This comment has been minimized.

@bjorn3

bjorn3 Dec 17, 2017

Contributor

Missing trailing newline

@bjorn3

bjorn3 Dec 17, 2017

Contributor

Missing trailing newline

This comment has been minimized.

@varkor

varkor Dec 17, 2017

Contributor

Whoops, that's what I get for late-night commits. Fixed.

@varkor

varkor Dec 17, 2017

Contributor

Whoops, that's what I get for late-night commits. Fixed.

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Dec 18, 2017

Contributor

Your code does not compile libcore, and I suspect it allows such aberrant code as

fn foo<F: FnMut()>(f: &F) {
    (*f)();
}
Contributor

arielb1 commented Dec 18, 2017

Your code does not compile libcore, and I suspect it allows such aberrant code as

fn foo<F: FnMut()>(f: &F) {
    (*f)();
}

varkor added some commits Dec 17, 2017

Fix ICE when calling non-functions within closures
The visitor for walking function bodies did not previously properly
handle error-cases for function calls. These are now ignored,
preventing the panic.
@varkor

This comment has been minimized.

Show comment
Hide comment
@varkor

varkor Dec 18, 2017

Contributor

Not quite sure what happened, but that previous commit was entirely wrong. Sorry, it should be fixed now.

Contributor

varkor commented Dec 18, 2017

Not quite sure what happened, but that previous commit was entirely wrong. Sorry, it should be fixed now.

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Dec 18, 2017

Contributor

r=me with comment addressed

Contributor

arielb1 commented Dec 18, 2017

r=me with comment addressed

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Dec 18, 2017

Contributor

[00:03:23] tidy error: /checkout/src/librustc/middle/expr_use_visitor.rs:582: line longer than 100 chars

Contributor

arielb1 commented Dec 18, 2017

[00:03:23] tidy error: /checkout/src/librustc/middle/expr_use_visitor.rs:582: line longer than 100 chars

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Dec 18, 2017

Contributor

I'll r+ when travis is green

Contributor

arielb1 commented Dec 18, 2017

I'll r+ when travis is green

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Dec 18, 2017

Contributor

@bors r+

Contributor

arielb1 commented Dec 18, 2017

@bors r+

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Dec 18, 2017

Contributor

📌 Commit 5741dcd has been approved by arielb1

Contributor

bors commented Dec 18, 2017

📌 Commit 5741dcd has been approved by arielb1

kennytm added a commit to kennytm/rust that referenced this pull request Dec 21, 2017

Rollup merge of rust-lang#46780 - varkor:contrib-5, r=arielb1
Fix ICE when calling non-functions within closures

The visitor for walking function bodies did not previously properly
handle error-cases for function calls. These are now ignored,
preventing the panic. This fixes rust-lang#46771.

bors added a commit that referenced this pull request Dec 21, 2017

Auto merge of #46922 - kennytm:rollup, r=kennytm
Rollup of 15 pull requests

- Successful merges: #46636, #46780, #46784, #46809, #46814, #46820, #46839, #46847, #46858, #46878, #46884, #46890, #46898, #46916, #46918
- Failed merges:

bors added a commit that referenced this pull request Dec 21, 2017

Auto merge of #46922 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests

- Successful merges: #46636, #46780, #46784, #46809, #46814, #46820, #46839, #46847, #46858, #46878, #46884, #46890, #46898, #46918
- Failed merges:

@bors bors merged commit 5741dcd into rust-lang:master Dec 22, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@varkor varkor deleted the varkor:contrib-5 branch Dec 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment