Skip to content

Commit

Permalink
Merge pull request #1483 from dtolnay/identgeneric
Browse files Browse the repository at this point in the history
Support single identifier as unbraced const generic argument
  • Loading branch information
dtolnay committed Jul 9, 2023
2 parents e523c36 + ed8d784 commit 7e8358a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/path.rs
Expand Up @@ -368,7 +368,6 @@ pub(crate) mod parsing {
return Ok(Expr::Lit(lit));
}

#[cfg(feature = "full")]
if input.peek(Ident) {
let ident: Ident = input.parse()?;
return Ok(Expr::Path(ExprPath {
Expand Down Expand Up @@ -694,6 +693,14 @@ pub(crate) mod printing {
GenericArgument::Const(expr) => match expr {
Expr::Lit(expr) => expr.to_tokens(tokens),

Expr::Path(expr)
if expr.attrs.is_empty()
&& expr.qself.is_none()
&& expr.path.get_ident().is_some() =>
{
expr.to_tokens(tokens);
}

#[cfg(feature = "full")]
Expr::Block(expr) => expr.to_tokens(tokens),

Expand Down

0 comments on commit 7e8358a

Please sign in to comment.