Skip to content

Commit 15a9f4e

Browse files
yodaldevoidvarkor
authored andcommitted
Attempt to parse const params first so const is not mistaken for an ident
Signed-off-by: Gabriel Smith <[email protected]>
1 parent 7cc81d0 commit 15a9f4e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5097,14 +5097,14 @@ impl<'a> Parser<'a> {
50975097
kind: ast::GenericParamKind::Lifetime,
50985098
});
50995099
enforce_param_order(&self, &mut max_param, ParamKindOrd::Lifetime);
5100-
} else if self.check_ident() {
5101-
// Parse type parameter.
5102-
params.push(self.parse_ty_param(attrs)?);
5103-
enforce_param_order(&self, &mut max_param, ParamKindOrd::Type);
51045100
} else if self.check_const_param() {
51055101
// Parse const parameter.
51065102
params.push(self.parse_const_param(attrs)?);
51075103
enforce_param_order(&self, &mut max_param, ParamKindOrd::Const);
5104+
} else if self.check_ident() {
5105+
// Parse type parameter.
5106+
params.push(self.parse_ty_param(attrs)?);
5107+
enforce_param_order(&self, &mut max_param, ParamKindOrd::Type);
51085108
} else {
51095109
// Check for trailing attributes and stop parsing.
51105110
if !attrs.is_empty() {

0 commit comments

Comments
 (0)