Closed
Description
For this error:
error[E0277]: the trait bound `std::option::Option<&Symbol>: std::ops::FnOnce<()>` is not satisfied
--> JackCompiler.rs:302:19
|
302 | let b = a.or_else(self.subroutine_symbols.get(name));
| ^^^^^^^ the trait `std::ops::FnOnce<()>` is not implemented for `std::option::Option<&Symbol>`
error: aborting due to previous error
The compiler can suggest adding a closure here. I'm honestly not sure what the issue is myself and I find optional and result chaining very difficult to use in Rust as compared to a language like Swift. However, changing it to a closure by adding "|| " fixed the error for me.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: An issue proposing an enhancement or a PR with one.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the compiler team, which will review and decide on the PR/issue.