-//! FIXME: write short doc here
-
use super::*;
pub(super) fn static_(p: &mut Parser, m: Marker) {
fn const_or_static(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) {
assert!(p.at(kw));
p.bump(kw);
- p.eat(T![mut]); // FIXME: validator to forbid const mut
+ p.eat(T![mut]);
// Allow `_` in place of an identifier in a `const`.
let is_const_underscore = kw == T![const] && p.eat(T![_]);
// test_err static_underscore
// static _: i32 = 5;
-
- types::ascription(p);
+ if p.at(T![:]) {
+ types::ascription(p);
+ } else {
+ p.error("missing type for `const` or `static`")
+ }
if p.eat(T![=]) {
expressions::expr(p);
}