Implement parsing const generic params
pub struct VSet<T, const ORDER: Order> {
diff --git a/src/generics.rs b/src/generics.rs
index 59c7c45..10fdb48 100644
--- a/src/generics.rs
+++ b/src/generics.rs
@@ -484,7 +484,8 @@
let lt_token: Token![<] = input.parse()?;
let mut params = Punctuated::new();
- let mut has_type_param = false;
+ let mut allow_lifetime_param = true;
+ let mut allow_type_param = true;
loop {
if input.peek(Token![>]) {
break;
@@ -492,17 +493,24 @@
let attrs = input.call(Attribute::parse_outer)?;
let lookahead = input.lookahead1();
- if !has_type_param && lookahead.peek(Lifetime) {
+ if allow_lifetime_param && lookahead.peek(Lifetime) {
params.push_value(GenericParam::Lifetime(LifetimeDef {
attrs: attrs,
..input.parse()?
}));
- } else if lookahead.peek(Ident) {
- has_type_param = true;
+ } else if allow_type_param && lookahead.peek(Ident) {
+ allow_lifetime_param = false;
params.push_value(GenericParam::Type(TypeParam {
attrs: attrs,
..input.parse()?
}));
+ } else if lookahead.peek(Token![const]) {
+ allow_lifetime_param = false;
+ allow_type_param = false;
+ params.push_value(GenericParam::Const(ConstParam {
+ attrs: attrs,
+ ..input.parse()?
+ }));
} else {
return Err(lookahead.error());
}
diff --git a/tests/clone.sh b/tests/clone.sh
index 3b1e443..78c2160 100755
--- a/tests/clone.sh
+++ b/tests/clone.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-REV=3f5152e200c0c02dfe0f79367948c98053d35855
+REV=dec4c5201f88efbc3020b04ba96a5ee2c3b6cfcd
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"