Skip to content

Confusing error messages with ||-closures vs binary "||" #2783

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

Closed
bblum opened this issue Jul 2, 2012 · 0 comments
Closed

Confusing error messages with ||-closures vs binary "||" #2783

bblum opened this issue Jul 2, 2012 · 0 comments
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@bblum
Copy link
Contributor

bblum commented Jul 2, 2012

fn foo(f: fn()) { f() }
fn main() {
    foo || {}; 
}

produces:

shit.rs:4:4: 4:13 error: binary operation || cannot be applied to type `extern fn(fn())

It'd be nice if it checked if the thing on the left had type "fn(fn * -> *) -> *", and said "Did you mean do foo || ... ?"

mitsuhiko added a commit to mitsuhiko/rust that referenced this issue Jul 2, 2012
mitsuhiko added a commit to mitsuhiko/rust that referenced this issue Jul 3, 2012
This fixes rust-lang#2783 for the case where an empty double pipe
symbol is being used without a do keyword.
@brson brson closed this as completed in 5bd9d6e Jul 3, 2012
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Co-authored-by: Remi Delmas <[email protected]>
Co-authored-by: Adrian Palacios <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants