Parse negative literals in const generic arguments
This commit is contained in:
parent
9ad04b9960
commit
451f128783
2 changed files with 5 additions and 2 deletions
|
@ -5796,8 +5796,7 @@ impl<'a> Parser<'a> {
|
||||||
} else {
|
} else {
|
||||||
// FIXME(const_generics): this currently conflicts with emplacement syntax
|
// FIXME(const_generics): this currently conflicts with emplacement syntax
|
||||||
// with negative integer literals.
|
// with negative integer literals.
|
||||||
let lit = self.parse_lit()?;
|
self.parse_literal_maybe_minus()?
|
||||||
self.mk_expr(lit.span, ExprKind::Lit(lit), ThinVec::new())
|
|
||||||
};
|
};
|
||||||
let value = AnonConst {
|
let value = AnonConst {
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
|
|
|
@ -14,6 +14,10 @@ fn foo_b() {
|
||||||
u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+`
|
u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn foo_c() {
|
||||||
|
u32_identity::< -1 >(); // ok
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
u32_identity::<5>(); // ok
|
u32_identity::<5>(); // ok
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue