Add StrStyle to ast::LitKind::ByteStr.

This is required to distinguish between cooked and raw byte string
literals in an `ast::LitKind`, without referring to an adjacent
`token::Lit`. It's a prerequisite for the next commit.
This commit is contained in:
Nicholas Nethercote 2022-11-29 13:35:44 +11:00
parent e658144586
commit a7f35c42d4
18 changed files with 39 additions and 28 deletions

View file

@ -526,7 +526,8 @@ impl server::TokenStream for Rustc<'_, '_> {
Ok(tokenstream::TokenStream::token_alone(token::Literal(*token_lit), expr.span))
}
ast::ExprKind::IncludedBytes(bytes) => {
let lit = ast::LitKind::ByteStr(bytes.clone()).synthesize_token_lit();
let lit = ast::LitKind::ByteStr(bytes.clone(), ast::StrStyle::Cooked)
.synthesize_token_lit();
Ok(tokenstream::TokenStream::token_alone(token::TokenKind::Literal(lit), expr.span))
}
ast::ExprKind::Unary(ast::UnOp::Neg, e) => match &e.kind {