mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-10 12:26:53 +00:00
Correctly parse negated literals as const args
This commit is contained in:
parent
49b219b103
commit
caee3a2eeb
3 changed files with 40 additions and 0 deletions
|
@ -59,6 +59,15 @@ fn generic_arg(p: &mut Parser) {
|
|||
expressions::literal(p);
|
||||
m.complete(p, CONST_ARG);
|
||||
}
|
||||
// test const_generic_negated_literal
|
||||
// fn f() { S::<-1> }
|
||||
T![-] => {
|
||||
let lm = p.start();
|
||||
p.bump(T![-]);
|
||||
expressions::literal(p);
|
||||
lm.complete(p, PREFIX_EXPR);
|
||||
m.complete(p, CONST_ARG);
|
||||
}
|
||||
_ => {
|
||||
types::type_(p);
|
||||
m.complete(p, TYPE_ARG);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue