Skip to content

Commit 3474e3b

Browse files
committed
intenral: more local tests for statics
1 parent 1feb8e8 commit 3474e3b

File tree

9 files changed

+50
-45
lines changed

9 files changed

+50
-45
lines changed

crates/parser/src/grammar/items/consts.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use super::*;
22

3+
// test const_item
4+
// const C: u32 = 92;
35
pub(super) fn konst(p: &mut Parser, m: Marker) {
46
p.bump(T![const]);
57
const_or_static(p, m, true)
@@ -13,14 +15,15 @@ pub(super) fn static_(p: &mut Parser, m: Marker) {
1315
fn const_or_static(p: &mut Parser, m: Marker, is_const: bool) {
1416
p.eat(T![mut]);
1517

16-
// Allow `_` in place of an identifier in a `const`.
17-
let is_const_underscore = is_const && p.eat(T![_]);
18-
if !is_const_underscore {
18+
if is_const && p.eat(T![_]) {
19+
// test anonymous_const
20+
// const _: u32 = 0;
21+
} else {
22+
// test_err anonymous_static
23+
// static _: i32 = 5;
1924
name(p);
2025
}
2126

22-
// test_err static_underscore
23-
// static _: i32 = 5;
2427
if p.at(T![:]) {
2528
types::ascription(p);
2629
} else {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const C: u32 = 92;
Lines changed: 19 additions & 0 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const _: u32 = 0;
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
const _: u32 = 0;
2-
const FOO: u32 = 92;

0 commit comments

Comments
 (0)