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
We have Literal::string(&str) for string literals, Literal::character(char) for character literals, and Literal::byte_string(&[u8]) for byte string literals, but no Literal::byte_character(u8) for byte literals.
Byte literal chars are "just" sugar for u8, so I assume you'd be quite hard pressed to find a location where using one or the other is important (modulo a proc macro to specifically check for that). Additionally, you can always use <TokenStream as FromStr>
@CAD97's comments notwithstanding, I still don't get why this constructor is missing. It makes it impossible to construct a token stream that is a high-fidelity representation of the input (which can have implications for error message). It also has implications for round tripping.
Activity
wycats commentedon Oct 7, 2021
This seems important. Is there something we're missing?
CAD97 commentedon Oct 8, 2021
Byte literal chars are "just" sugar for
u8
, so I assume you'd be quite hard pressed to find a location where using one or the other is important (modulo a proc macro to specifically check for that). Additionally, you can always use<TokenStream as FromStr>
wycats commentedon Nov 16, 2021
@CAD97's comments notwithstanding, I still don't get why this constructor is missing. It makes it impossible to construct a token stream that is a high-fidelity representation of the input (which can have implications for error message). It also has implications for round tripping.
Auto merge of rust-lang#112711 - Emilgardis:lit_byte_char, r=dtolnay
Auto merge of rust-lang#112711 - Emilgardis:lit_byte_char, r=dtolnay
Auto merge of rust-lang#112711 - Emilgardis:lit_byte_char, r=dtolnay
Emilgardis commentedon Sep 24, 2023
This has been added as
Literal::byte_character
behind#![feature(proc_macro_byte_character)]
, tracked in #115268