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

Confusing error message for use of old lambda syntax #2867

Closed
catamorphism opened this issue Jul 10, 2012 · 1 comment
Closed

Confusing error message for use of old lambda syntax #2867

catamorphism opened this issue Jul 10, 2012 · 1 comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) A-type-system Area: Type system

Comments

@catamorphism
Copy link
Contributor

fn f(v: ~[int]) {
  for v.each {|z| log(error, z); };
}

I used the old lambda syntax and got this error message:

/Users/TimChevalier/Scratch/f.rs:3:8: 3:34 error: mismatched types: expected `fn(&&int)` but found `fn()` (incorrect number of function parameters)
/Users/TimChevalier/Scratch/f.rs:3   for v.each {|z| log(error, z); };
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/TimChevalier/Scratch/f.rs:3:8: 3:34 error: mismatched types: expected `fn(&&int) -> bool` but found `fn() -> bool` (incorrect number of function parameters)
/Users/TimChevalier/Scratch/f.rs:3   for v.each {|z| log(error, z); };
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~

It took me a good 5 minutes to figure out what I was doing wrong there. Surely there could be a better error message for this.

@ghost ghost assigned catamorphism Nov 24, 2012
@graydon
Copy link
Contributor

graydon commented Mar 12, 2013

I'm not sure what it would do here; the old syntax happens to parse as something completely different in the new syntax. I don't think there's much we can do to help if you put the || inside the { like this.

I'm going to close this one as WONTFIX but if you feel strongly, reopen.

@graydon graydon closed this as completed Mar 12, 2013
@catamorphism catamorphism removed their assignment Jun 16, 2014
RalfJung pushed a commit to RalfJung/rust that referenced this issue May 11, 2023
Simplify event selection in TB diagnostics

As discussed previously, getting the range from `RangeMap` can make the filtering of events much simpler without any user-visible diff.

See minor exception in [<9d8fc00>](rust-lang/miri@9d8fc00) and decide how to resolve it
- add a boolean flag not to record events produced by deallocations ?
- add a `help: deallocation counts as an implicit write` ? (Note: could be generalized to also include `help: reborrow counts as an implicit read`)
- not bother and keep as-is ?
- something else ?
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
This allows `kani::cover` to be used in the body of const fns under
verification.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.
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) A-type-system Area: Type system
Projects
None yet
Development

No branches or pull requests

2 participants