Skip to content

Fix ICE when reporting closure and proc mismatch #13657

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

Merged
merged 1 commit into from
Apr 22, 2014

Conversation

edwardw
Copy link
Contributor

@edwardw edwardw commented Apr 21, 2014

Closes #13599

let _xs = nums.map(proc(n) {n * 2}); //~ ERROR mismatched types

spawn(|| {}); //~ ERROR mismatched types
}
Copy link
Member

Choose a reason for hiding this comment

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

Could you expand these error messages a bit more to have some more of the message itself? I've also found it useful to minimize test cases to just this one file (as little dependence on libstd) if possible (but not necessary)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, fixed.

@edwardw
Copy link
Contributor Author

edwardw commented Apr 21, 2014

r?

//~^ ERROR mismatched types: expected `||` but found `proc()` (expected closure, found proc)

expect_proc(|| {});
//~^ ERROR mismatched types: expected `proc()` but found `once ||` (expected proc, found closure)
Copy link
Member

Choose a reason for hiding this comment

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

This error seems a bit misleading because I think most aren't aware that once || is even a thing (it's feature gated anyway). Perhaps we could remove the expected_onceness argument (in check_expr_fn above)? That looks like it may print the right thing at that point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is a little bit more complicated than that. Fixed.

bors added a commit that referenced this pull request Apr 22, 2014
@bors bors closed this Apr 22, 2014
@bors bors merged commit 741142e into rust-lang:master Apr 22, 2014
@edwardw edwardw deleted the ppaux-ice branch April 22, 2014 15:37
flip1995 added a commit to flip1995/rust that referenced this pull request Nov 7, 2024
…s-to-early

collect attribute spans early for disallowed macros
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE for closure / proc confusion
4 participants