Skip to content

Commit

Permalink
Move expr parser's custom keywords into kw module
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed May 14, 2023
1 parent 2491bae commit dad8eba
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,9 @@ pub(crate) mod parsing {
use crate::path;
use std::cmp::Ordering;

crate::custom_keyword!(raw);
mod kw {
crate::custom_keyword!(raw);
}

// When we're parsing expressions which occur before blocks, like in an if
// statement's condition, we cannot parse a struct literal.
Expand Down Expand Up @@ -1361,12 +1363,13 @@ pub(crate) mod parsing {
let attrs = input.call(expr_attrs)?;
if input.peek(Token![&]) {
let and_token: Token![&] = input.parse()?;
let raw: Option<raw> =
if input.peek(raw) && (input.peek2(Token![mut]) || input.peek2(Token![const])) {
Some(input.parse()?)
} else {
None
};
let raw: Option<kw::raw> = if input.peek(kw::raw)
&& (input.peek2(Token![mut]) || input.peek2(Token![const]))
{
Some(input.parse()?)
} else {
None
};
let mutability: Option<Token![mut]> = input.parse()?;
if raw.is_some() && mutability.is_none() {
input.parse::<Token![const]>()?;
Expand Down

0 comments on commit dad8eba

Please sign in to comment.