Skip to content

Commit 7e8358a

Browse files
authored
Merge pull request #1483 from dtolnay/identgeneric
Support single identifier as unbraced const generic argument
2 parents e523c36 + ed8d784 commit 7e8358a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/path.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@ pub(crate) mod parsing {
368368
return Ok(Expr::Lit(lit));
369369
}
370370

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

696+
Expr::Path(expr)
697+
if expr.attrs.is_empty()
698+
&& expr.qself.is_none()
699+
&& expr.path.get_ident().is_some() =>
700+
{
701+
expr.to_tokens(tokens);
702+
}
703+
697704
#[cfg(feature = "full")]
698705
Expr::Block(expr) => expr.to_tokens(tokens),
699706

0 commit comments

Comments
 (0)