You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/sdl2/timer.rs:33:43: 33:60 error: expected a path on the left-hand side of `+`, not `(FnMut() -> uint)` [E0178]
src/sdl2/timer.rs:33 pub fn new(delay: uint, callback: Box<(FnMut() -> uint) + 'a>, remove_on_drop: bool) -> Timer<'a> {
^~~~~~~~~~~~~~~~~
src/sdl2/timer.rs:33:43: 33:60 note: perhaps you forgot parentheses? (per RFC 438)
src/sdl2/timer.rs:33 pub fn new(delay: uint, callback: Box<(FnMut() -> uint) + 'a>, remove_on_drop: bool) -> Timer<'a> {
^~~~~~~~~~~~~~~~~
If I understand correctly the syntax is trait + lifetime, so I'd expect those parentheses to be fine (and imho they make the code more clear). The note about forgetting parentheses is also puzzling.
The text was updated successfully, but these errors were encountered:
@petrochenkov if I understand it correctly, this is accepted today, but #40043 fixes the parser, so rejecting the parentheses is the correct behavior, and this is not a bug after all (and can be closed).
@pmarcelll
Indeed.
I wasn't aware of this issue.
Confusing diagnostics perhaps you forgot parentheses? are fixed in #40043 as well.
Closing as a duplicate of #39318.
The following code works:
But this doesn't:
rustc
complains thatIf I understand correctly the syntax is
trait + lifetime
, so I'd expect those parentheses to be fine (and imho they make the code more clear). The note about forgetting parentheses is also puzzling.The text was updated successfully, but these errors were encountered: