Rust Editions

The edition of rust used by grmtools updates as the rust language evolves. We try to keep code generated by CTParserBuilder and CTLexerBuilder building with older versions of rust, so that downstream users can use the edition that suits their requirements.

Controlling edition used during code generation

CTLexerBuilder and CTParserBuilder both have functions, rust_edition() that accept a lrpar::RustEdition and lrlex::RustEdition respectively.

Known edition incompatibility in the book

While there is a preference for keeping the code in this manual working with all editions, exceptions may be made when for clarity.

  • In An AST evaluator, with the rust_2018_idioms lint deprecates some behavior which was previously accepted by the 2015 edition. The eval function has an elided lifetime that must be given explicitly as lexer: &dyn NonStreamingLexer<'_, DefaultLexeme, u32>.