mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
intenral: more local tests for statics
This commit is contained in:
parent
1feb8e89d5
commit
3474e3b3b1
9 changed files with 50 additions and 45 deletions
|
@ -1,5 +1,7 @@
|
|||
use super::*;
|
||||
|
||||
// test const_item
|
||||
// const C: u32 = 92;
|
||||
pub(super) fn konst(p: &mut Parser, m: Marker) {
|
||||
p.bump(T![const]);
|
||||
const_or_static(p, m, true)
|
||||
|
@ -13,14 +15,15 @@ pub(super) fn static_(p: &mut Parser, m: Marker) {
|
|||
fn const_or_static(p: &mut Parser, m: Marker, is_const: bool) {
|
||||
p.eat(T![mut]);
|
||||
|
||||
// Allow `_` in place of an identifier in a `const`.
|
||||
let is_const_underscore = is_const && p.eat(T![_]);
|
||||
if !is_const_underscore {
|
||||
if is_const && p.eat(T![_]) {
|
||||
// test anonymous_const
|
||||
// const _: u32 = 0;
|
||||
} else {
|
||||
// test_err anonymous_static
|
||||
// static _: i32 = 5;
|
||||
name(p);
|
||||
}
|
||||
|
||||
// test_err static_underscore
|
||||
// static _: i32 = 5;
|
||||
if p.at(T![:]) {
|
||||
types::ascription(p);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue