Skip to content

Commit

Permalink
Parse const generics on methods with feature(full)
Browse files Browse the repository at this point in the history
  • Loading branch information
yodaldevoid authored and dtolnay committed May 25, 2020
1 parent 3a71d97 commit a046ae9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2000,7 +2000,16 @@ pub(crate) mod parsing {

#[cfg(feature = "full")]
fn generic_method_argument(input: ParseStream) -> Result<GenericMethodArgument> {
// TODO parse const generics as well
if input.peek(Lit) {
let lit = input.parse()?;
return Ok(GenericMethodArgument::Const(Expr::Lit(lit)));
}

if input.peek(token::Brace) {
let block = input.call(expr::parsing::expr_block)?;
return Ok(GenericMethodArgument::Const(Expr::Block(block)));
}

input.parse().map(GenericMethodArgument::Type)
}

Expand Down

0 comments on commit a046ae9

Please sign in to comment.