Closed Schyrsivochter closed 3 years ago
hold on, I’m stupid. this was already implemented in #24 the other day
which is
&'static str
by default
Wait I got this bit wrong, and assumed it was ()
:grimacing:
It looks like the default changed in 0.14 from ()
to &'static str
:
https://github.com/lalrpop/lalrpop/blob/6fd067fb4a14243b2dc396c6d4487958460e01e4/RELEASES.md#version-014
It's sad the book isn't kept up to date. I used the last snippet in http://lalrpop.github.io/lalrpop/tutorial/002_paren_numbers.html to get the defaults.
Currently, when using fallible actions, the plugin erroneously treats the action code as if returning the nonterminal’s return type directly, rather than a
Result
. This leads to perfectly valid code being marked as ‘mismatched types’.Adjust the Rust code injection so that action code of a rule marked with
=>?
rather than=>
returns notT
, butResult<T, Error>
whereError
is the grammar’s user error type, which is&'static str
by default but can be overriden (extern { type Error = ... }
)