Skip to content

Commit

Permalink
Fix parsing of angle brackets in writedoc expr argument
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 29, 2023
1 parent 024d2dc commit 2dbd0aa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub fn parse(input: &mut TokenIter) -> Result<Expr> {
JointColon,
DoubleColon,
Other,
JointOther,
}

let mut expr = TokenStream::new();
Expand All @@ -31,11 +32,14 @@ pub fn parse(input: &mut TokenIter) -> Result<Expr> {
angle_bracket_depth += 1;
Lookbehind::Other
}
'>' if angle_bracket_depth > 0 => {
'>' if angle_bracket_depth > 0 && lookbehind != Lookbehind::JointOther => {
angle_bracket_depth -= 1;
Lookbehind::Other
}
_ => Lookbehind::Other,
_ => match spacing {
Spacing::Joint => Lookbehind::JointOther,
Spacing::Alone => Lookbehind::Other,
},
};
}
Some(token) => expr.extend(iter::once(token)),
Expand Down

0 comments on commit 2dbd0aa

Please sign in to comment.