mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 07:22:42 +00:00
Cleanup parser modifiers tests
This commit is contained in:
parent
f73a6419d4
commit
f8bfd77e84
@ -132,6 +132,8 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker) -> Result<(), Marker> {
|
||||
}
|
||||
}
|
||||
|
||||
// test existential_type
|
||||
// existential type Foo: Fn() -> usize;
|
||||
if p.at(IDENT) && p.at_contextual_kw("existential") && p.nth(1) == T![type] {
|
||||
p.bump_remap(T![existential]);
|
||||
has_mods = true;
|
||||
@ -139,79 +141,31 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker) -> Result<(), Marker> {
|
||||
|
||||
// items
|
||||
match p.current() {
|
||||
// test async_fn
|
||||
// async fn foo() {}
|
||||
|
||||
// test extern_fn
|
||||
// extern fn foo() {}
|
||||
|
||||
// test const_fn
|
||||
// const fn foo() {}
|
||||
|
||||
// test const_unsafe_fn
|
||||
// const unsafe fn foo() {}
|
||||
|
||||
// test unsafe_extern_fn
|
||||
// unsafe extern "C" fn foo() {}
|
||||
|
||||
// test unsafe_fn
|
||||
// unsafe fn foo() {}
|
||||
|
||||
// test combined_fns
|
||||
// async unsafe fn foo() {}
|
||||
// const unsafe fn bar() {}
|
||||
|
||||
// test_err wrong_order_fns
|
||||
// unsafe async fn foo() {}
|
||||
// unsafe const fn bar() {}
|
||||
// test fn
|
||||
// fn foo() {}
|
||||
T![fn] => {
|
||||
fn_def(p);
|
||||
m.complete(p, FN);
|
||||
}
|
||||
|
||||
// test unsafe_trait
|
||||
// unsafe trait T {}
|
||||
|
||||
// test auto_trait
|
||||
// auto trait T {}
|
||||
|
||||
// test unsafe_auto_trait
|
||||
// unsafe auto trait T {}
|
||||
// test trait
|
||||
// trait T {}
|
||||
T![trait] => {
|
||||
traits::trait_def(p);
|
||||
m.complete(p, TRAIT);
|
||||
}
|
||||
|
||||
// test unsafe_impl
|
||||
// unsafe impl Foo {}
|
||||
|
||||
// test default_impl
|
||||
// default impl Foo {}
|
||||
|
||||
// test_err default_fn_type
|
||||
// trait T {
|
||||
// default type T = Bar;
|
||||
// default fn foo() {}
|
||||
// }
|
||||
|
||||
// test default_fn_type
|
||||
// impl T for Foo {
|
||||
// default type T = Bar;
|
||||
// default fn foo() {}
|
||||
// }
|
||||
T![const] => {
|
||||
consts::const_def(p, m);
|
||||
}
|
||||
|
||||
// test unsafe_default_impl
|
||||
// unsafe default impl Foo {}
|
||||
// test impl
|
||||
// impl T for S {}
|
||||
T![impl] => {
|
||||
traits::impl_def(p);
|
||||
m.complete(p, IMPL);
|
||||
}
|
||||
|
||||
// test existential_type
|
||||
// existential type Foo: Fn() -> usize;
|
||||
T![type] => {
|
||||
type_def(p, m);
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
SOURCE_FILE@0..18
|
||||
TRAIT@0..17
|
||||
UNSAFE_KW@0..6 "unsafe"
|
||||
WHITESPACE@6..7 " "
|
||||
TRAIT_KW@7..12 "trait"
|
||||
WHITESPACE@12..13 " "
|
||||
NAME@13..14
|
||||
IDENT@13..14 "T"
|
||||
WHITESPACE@14..15 " "
|
||||
ASSOC_ITEM_LIST@15..17
|
||||
L_CURLY@15..16 "{"
|
||||
R_CURLY@16..17 "}"
|
||||
WHITESPACE@17..18 "\n"
|
@ -1 +0,0 @@
|
||||
unsafe trait T {}
|
@ -1,21 +0,0 @@
|
||||
SOURCE_FILE@0..30
|
||||
FN@0..29
|
||||
UNSAFE_KW@0..6 "unsafe"
|
||||
WHITESPACE@6..7 " "
|
||||
ABI@7..17
|
||||
EXTERN_KW@7..13 "extern"
|
||||
WHITESPACE@13..14 " "
|
||||
STRING@14..17 "\"C\""
|
||||
WHITESPACE@17..18 " "
|
||||
FN_KW@18..20 "fn"
|
||||
WHITESPACE@20..21 " "
|
||||
NAME@21..24
|
||||
IDENT@21..24 "foo"
|
||||
PARAM_LIST@24..26
|
||||
L_PAREN@24..25 "("
|
||||
R_PAREN@25..26 ")"
|
||||
WHITESPACE@26..27 " "
|
||||
BLOCK_EXPR@27..29
|
||||
L_CURLY@27..28 "{"
|
||||
R_CURLY@28..29 "}"
|
||||
WHITESPACE@29..30 "\n"
|
@ -1 +0,0 @@
|
||||
unsafe extern "C" fn foo() {}
|
@ -1,18 +0,0 @@
|
||||
SOURCE_FILE@0..27
|
||||
IMPL@0..26
|
||||
UNSAFE_KW@0..6 "unsafe"
|
||||
WHITESPACE@6..7 " "
|
||||
DEFAULT_KW@7..14 "default"
|
||||
WHITESPACE@14..15 " "
|
||||
IMPL_KW@15..19 "impl"
|
||||
WHITESPACE@19..20 " "
|
||||
PATH_TYPE@20..23
|
||||
PATH@20..23
|
||||
PATH_SEGMENT@20..23
|
||||
NAME_REF@20..23
|
||||
IDENT@20..23 "Foo"
|
||||
WHITESPACE@23..24 " "
|
||||
ASSOC_ITEM_LIST@24..26
|
||||
L_CURLY@24..25 "{"
|
||||
R_CURLY@25..26 "}"
|
||||
WHITESPACE@26..27 "\n"
|
@ -1 +0,0 @@
|
||||
unsafe default impl Foo {}
|
@ -1,16 +0,0 @@
|
||||
SOURCE_FILE@0..18
|
||||
FN@0..17
|
||||
CONST_KW@0..5 "const"
|
||||
WHITESPACE@5..6 " "
|
||||
FN_KW@6..8 "fn"
|
||||
WHITESPACE@8..9 " "
|
||||
NAME@9..12
|
||||
IDENT@9..12 "foo"
|
||||
PARAM_LIST@12..14
|
||||
L_PAREN@12..13 "("
|
||||
R_PAREN@13..14 ")"
|
||||
WHITESPACE@14..15 " "
|
||||
BLOCK_EXPR@15..17
|
||||
L_CURLY@15..16 "{"
|
||||
R_CURLY@16..17 "}"
|
||||
WHITESPACE@17..18 "\n"
|
@ -1 +0,0 @@
|
||||
const fn foo() {}
|
@ -1,16 +0,0 @@
|
||||
SOURCE_FILE@0..19
|
||||
IMPL@0..18
|
||||
UNSAFE_KW@0..6 "unsafe"
|
||||
WHITESPACE@6..7 " "
|
||||
IMPL_KW@7..11 "impl"
|
||||
WHITESPACE@11..12 " "
|
||||
PATH_TYPE@12..15
|
||||
PATH@12..15
|
||||
PATH_SEGMENT@12..15
|
||||
NAME_REF@12..15
|
||||
IDENT@12..15 "Foo"
|
||||
WHITESPACE@15..16 " "
|
||||
ASSOC_ITEM_LIST@16..18
|
||||
L_CURLY@16..17 "{"
|
||||
R_CURLY@17..18 "}"
|
||||
WHITESPACE@18..19 "\n"
|
@ -1 +0,0 @@
|
||||
unsafe impl Foo {}
|
@ -1,17 +0,0 @@
|
||||
SOURCE_FILE@0..19
|
||||
FN@0..18
|
||||
ABI@0..6
|
||||
EXTERN_KW@0..6 "extern"
|
||||
WHITESPACE@6..7 " "
|
||||
FN_KW@7..9 "fn"
|
||||
WHITESPACE@9..10 " "
|
||||
NAME@10..13
|
||||
IDENT@10..13 "foo"
|
||||
PARAM_LIST@13..15
|
||||
L_PAREN@13..14 "("
|
||||
R_PAREN@14..15 ")"
|
||||
WHITESPACE@15..16 " "
|
||||
BLOCK_EXPR@16..18
|
||||
L_CURLY@16..17 "{"
|
||||
R_CURLY@17..18 "}"
|
||||
WHITESPACE@18..19 "\n"
|
@ -1 +0,0 @@
|
||||
extern fn foo() {}
|
@ -1,13 +0,0 @@
|
||||
SOURCE_FILE@0..16
|
||||
TRAIT@0..15
|
||||
AUTO_KW@0..4 "auto"
|
||||
WHITESPACE@4..5 " "
|
||||
TRAIT_KW@5..10 "trait"
|
||||
WHITESPACE@10..11 " "
|
||||
NAME@11..12
|
||||
IDENT@11..12 "T"
|
||||
WHITESPACE@12..13 " "
|
||||
ASSOC_ITEM_LIST@13..15
|
||||
L_CURLY@13..14 "{"
|
||||
R_CURLY@14..15 "}"
|
||||
WHITESPACE@15..16 "\n"
|
@ -1 +0,0 @@
|
||||
auto trait T {}
|
@ -1,15 +0,0 @@
|
||||
SOURCE_FILE@0..23
|
||||
TRAIT@0..22
|
||||
UNSAFE_KW@0..6 "unsafe"
|
||||
WHITESPACE@6..7 " "
|
||||
AUTO_KW@7..11 "auto"
|
||||
WHITESPACE@11..12 " "
|
||||
TRAIT_KW@12..17 "trait"
|
||||
WHITESPACE@17..18 " "
|
||||
NAME@18..19
|
||||
IDENT@18..19 "T"
|
||||
WHITESPACE@19..20 " "
|
||||
ASSOC_ITEM_LIST@20..22
|
||||
L_CURLY@20..21 "{"
|
||||
R_CURLY@21..22 "}"
|
||||
WHITESPACE@22..23 "\n"
|
@ -1 +0,0 @@
|
||||
unsafe auto trait T {}
|
@ -1,16 +0,0 @@
|
||||
SOURCE_FILE@0..20
|
||||
IMPL@0..19
|
||||
DEFAULT_KW@0..7 "default"
|
||||
WHITESPACE@7..8 " "
|
||||
IMPL_KW@8..12 "impl"
|
||||
WHITESPACE@12..13 " "
|
||||
PATH_TYPE@13..16
|
||||
PATH@13..16
|
||||
PATH_SEGMENT@13..16
|
||||
NAME_REF@13..16
|
||||
IDENT@13..16 "Foo"
|
||||
WHITESPACE@16..17 " "
|
||||
ASSOC_ITEM_LIST@17..19
|
||||
L_CURLY@17..18 "{"
|
||||
R_CURLY@18..19 "}"
|
||||
WHITESPACE@19..20 "\n"
|
@ -1 +0,0 @@
|
||||
default impl Foo {}
|
@ -1,18 +0,0 @@
|
||||
SOURCE_FILE@0..25
|
||||
FN@0..24
|
||||
CONST_KW@0..5 "const"
|
||||
WHITESPACE@5..6 " "
|
||||
UNSAFE_KW@6..12 "unsafe"
|
||||
WHITESPACE@12..13 " "
|
||||
FN_KW@13..15 "fn"
|
||||
WHITESPACE@15..16 " "
|
||||
NAME@16..19
|
||||
IDENT@16..19 "foo"
|
||||
PARAM_LIST@19..21
|
||||
L_PAREN@19..20 "("
|
||||
R_PAREN@20..21 ")"
|
||||
WHITESPACE@21..22 " "
|
||||
BLOCK_EXPR@22..24
|
||||
L_CURLY@22..23 "{"
|
||||
R_CURLY@23..24 "}"
|
||||
WHITESPACE@24..25 "\n"
|
@ -1 +0,0 @@
|
||||
const unsafe fn foo() {}
|
@ -1,16 +0,0 @@
|
||||
SOURCE_FILE@0..19
|
||||
FN@0..18
|
||||
UNSAFE_KW@0..6 "unsafe"
|
||||
WHITESPACE@6..7 " "
|
||||
FN_KW@7..9 "fn"
|
||||
WHITESPACE@9..10 " "
|
||||
NAME@10..13
|
||||
IDENT@10..13 "foo"
|
||||
PARAM_LIST@13..15
|
||||
L_PAREN@13..14 "("
|
||||
R_PAREN@14..15 ")"
|
||||
WHITESPACE@15..16 " "
|
||||
BLOCK_EXPR@16..18
|
||||
L_CURLY@16..17 "{"
|
||||
R_CURLY@17..18 "}"
|
||||
WHITESPACE@18..19 "\n"
|
@ -1 +0,0 @@
|
||||
unsafe fn foo() {}
|
@ -1,16 +0,0 @@
|
||||
SOURCE_FILE@0..18
|
||||
FN@0..17
|
||||
ASYNC_KW@0..5 "async"
|
||||
WHITESPACE@5..6 " "
|
||||
FN_KW@6..8 "fn"
|
||||
WHITESPACE@8..9 " "
|
||||
NAME@9..12
|
||||
IDENT@9..12 "foo"
|
||||
PARAM_LIST@12..14
|
||||
L_PAREN@12..13 "("
|
||||
R_PAREN@13..14 ")"
|
||||
WHITESPACE@14..15 " "
|
||||
BLOCK_EXPR@15..17
|
||||
L_CURLY@15..16 "{"
|
||||
R_CURLY@16..17 "}"
|
||||
WHITESPACE@17..18 "\n"
|
@ -1 +0,0 @@
|
||||
async fn foo() {}
|
@ -1,35 +0,0 @@
|
||||
SOURCE_FILE@0..50
|
||||
FN@0..24
|
||||
ASYNC_KW@0..5 "async"
|
||||
WHITESPACE@5..6 " "
|
||||
UNSAFE_KW@6..12 "unsafe"
|
||||
WHITESPACE@12..13 " "
|
||||
FN_KW@13..15 "fn"
|
||||
WHITESPACE@15..16 " "
|
||||
NAME@16..19
|
||||
IDENT@16..19 "foo"
|
||||
PARAM_LIST@19..21
|
||||
L_PAREN@19..20 "("
|
||||
R_PAREN@20..21 ")"
|
||||
WHITESPACE@21..22 " "
|
||||
BLOCK_EXPR@22..24
|
||||
L_CURLY@22..23 "{"
|
||||
R_CURLY@23..24 "}"
|
||||
WHITESPACE@24..25 "\n"
|
||||
FN@25..49
|
||||
CONST_KW@25..30 "const"
|
||||
WHITESPACE@30..31 " "
|
||||
UNSAFE_KW@31..37 "unsafe"
|
||||
WHITESPACE@37..38 " "
|
||||
FN_KW@38..40 "fn"
|
||||
WHITESPACE@40..41 " "
|
||||
NAME@41..44
|
||||
IDENT@41..44 "bar"
|
||||
PARAM_LIST@44..46
|
||||
L_PAREN@44..45 "("
|
||||
R_PAREN@45..46 ")"
|
||||
WHITESPACE@46..47 " "
|
||||
BLOCK_EXPR@47..49
|
||||
L_CURLY@47..48 "{"
|
||||
R_CURLY@48..49 "}"
|
||||
WHITESPACE@49..50 "\n"
|
@ -1,2 +0,0 @@
|
||||
async unsafe fn foo() {}
|
||||
const unsafe fn bar() {}
|
14
crates/ra_syntax/test_data/parser/inline/ok/0151_fn.rast
Normal file
14
crates/ra_syntax/test_data/parser/inline/ok/0151_fn.rast
Normal file
@ -0,0 +1,14 @@
|
||||
SOURCE_FILE@0..12
|
||||
FN@0..11
|
||||
FN_KW@0..2 "fn"
|
||||
WHITESPACE@2..3 " "
|
||||
NAME@3..6
|
||||
IDENT@3..6 "foo"
|
||||
PARAM_LIST@6..8
|
||||
L_PAREN@6..7 "("
|
||||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..11
|
||||
L_CURLY@9..10 "{"
|
||||
R_CURLY@10..11 "}"
|
||||
WHITESPACE@11..12 "\n"
|
1
crates/ra_syntax/test_data/parser/inline/ok/0151_fn.rs
Normal file
1
crates/ra_syntax/test_data/parser/inline/ok/0151_fn.rs
Normal file
@ -0,0 +1 @@
|
||||
fn foo() {}
|
22
crates/ra_syntax/test_data/parser/inline/ok/0152_impl.rast
Normal file
22
crates/ra_syntax/test_data/parser/inline/ok/0152_impl.rast
Normal file
@ -0,0 +1,22 @@
|
||||
SOURCE_FILE@0..16
|
||||
IMPL@0..15
|
||||
IMPL_KW@0..4 "impl"
|
||||
WHITESPACE@4..5 " "
|
||||
PATH_TYPE@5..6
|
||||
PATH@5..6
|
||||
PATH_SEGMENT@5..6
|
||||
NAME_REF@5..6
|
||||
IDENT@5..6 "T"
|
||||
WHITESPACE@6..7 " "
|
||||
FOR_KW@7..10 "for"
|
||||
WHITESPACE@10..11 " "
|
||||
PATH_TYPE@11..12
|
||||
PATH@11..12
|
||||
PATH_SEGMENT@11..12
|
||||
NAME_REF@11..12
|
||||
IDENT@11..12 "S"
|
||||
WHITESPACE@12..13 " "
|
||||
ASSOC_ITEM_LIST@13..15
|
||||
L_CURLY@13..14 "{"
|
||||
R_CURLY@14..15 "}"
|
||||
WHITESPACE@15..16 "\n"
|
1
crates/ra_syntax/test_data/parser/inline/ok/0152_impl.rs
Normal file
1
crates/ra_syntax/test_data/parser/inline/ok/0152_impl.rs
Normal file
@ -0,0 +1 @@
|
||||
impl T for S {}
|
11
crates/ra_syntax/test_data/parser/inline/ok/0153_trait.rast
Normal file
11
crates/ra_syntax/test_data/parser/inline/ok/0153_trait.rast
Normal file
@ -0,0 +1,11 @@
|
||||
SOURCE_FILE@0..11
|
||||
TRAIT@0..10
|
||||
TRAIT_KW@0..5 "trait"
|
||||
WHITESPACE@5..6 " "
|
||||
NAME@6..7
|
||||
IDENT@6..7 "T"
|
||||
WHITESPACE@7..8 " "
|
||||
ASSOC_ITEM_LIST@8..10
|
||||
L_CURLY@8..9 "{"
|
||||
R_CURLY@9..10 "}"
|
||||
WHITESPACE@10..11 "\n"
|
@ -0,0 +1 @@
|
||||
trait T {}
|
@ -1,56 +0,0 @@
|
||||
SOURCE_FILE@0..71
|
||||
FN@0..19
|
||||
ABI@0..6
|
||||
EXTERN_KW@0..6 "extern"
|
||||
WHITESPACE@6..7 " "
|
||||
FN_KW@7..9 "fn"
|
||||
WHITESPACE@9..10 " "
|
||||
NAME@10..13
|
||||
IDENT@10..13 "foo"
|
||||
PARAM_LIST@13..15
|
||||
L_PAREN@13..14 "("
|
||||
R_PAREN@14..15 ")"
|
||||
WHITESPACE@15..16 " "
|
||||
BLOCK_EXPR@16..19
|
||||
L_CURLY@16..17 "{"
|
||||
WHITESPACE@17..18 "\n"
|
||||
R_CURLY@18..19 "}"
|
||||
WHITESPACE@19..21 "\n\n"
|
||||
FN@21..44
|
||||
ABI@21..31
|
||||
EXTERN_KW@21..27 "extern"
|
||||
WHITESPACE@27..28 " "
|
||||
STRING@28..31 "\"C\""
|
||||
WHITESPACE@31..32 " "
|
||||
FN_KW@32..34 "fn"
|
||||
WHITESPACE@34..35 " "
|
||||
NAME@35..38
|
||||
IDENT@35..38 "bar"
|
||||
PARAM_LIST@38..40
|
||||
L_PAREN@38..39 "("
|
||||
R_PAREN@39..40 ")"
|
||||
WHITESPACE@40..41 " "
|
||||
BLOCK_EXPR@41..44
|
||||
L_CURLY@41..42 "{"
|
||||
WHITESPACE@42..43 "\n"
|
||||
R_CURLY@43..44 "}"
|
||||
WHITESPACE@44..46 "\n\n"
|
||||
FN@46..70
|
||||
ABI@46..57
|
||||
EXTERN_KW@46..52 "extern"
|
||||
WHITESPACE@52..53 " "
|
||||
RAW_STRING@53..57 "r\"D\""
|
||||
WHITESPACE@57..58 " "
|
||||
FN_KW@58..60 "fn"
|
||||
WHITESPACE@60..61 " "
|
||||
NAME@61..64
|
||||
IDENT@61..64 "baz"
|
||||
PARAM_LIST@64..66
|
||||
L_PAREN@64..65 "("
|
||||
R_PAREN@65..66 ")"
|
||||
WHITESPACE@66..67 " "
|
||||
BLOCK_EXPR@67..70
|
||||
L_CURLY@67..68 "{"
|
||||
WHITESPACE@68..69 "\n"
|
||||
R_CURLY@69..70 "}"
|
||||
WHITESPACE@70..71 "\n"
|
@ -1,8 +0,0 @@
|
||||
extern fn foo() {
|
||||
}
|
||||
|
||||
extern "C" fn bar() {
|
||||
}
|
||||
|
||||
extern r"D" fn baz() {
|
||||
}
|
218
crates/ra_syntax/test_data/parser/ok/0068_item_modifiers.rast
Normal file
218
crates/ra_syntax/test_data/parser/ok/0068_item_modifiers.rast
Normal file
@ -0,0 +1,218 @@
|
||||
SOURCE_FILE@0..304
|
||||
FN@0..17
|
||||
ASYNC_KW@0..5 "async"
|
||||
WHITESPACE@5..6 " "
|
||||
FN_KW@6..8 "fn"
|
||||
WHITESPACE@8..9 " "
|
||||
NAME@9..12
|
||||
IDENT@9..12 "foo"
|
||||
PARAM_LIST@12..14
|
||||
L_PAREN@12..13 "("
|
||||
R_PAREN@13..14 ")"
|
||||
WHITESPACE@14..15 " "
|
||||
BLOCK_EXPR@15..17
|
||||
L_CURLY@15..16 "{"
|
||||
R_CURLY@16..17 "}"
|
||||
WHITESPACE@17..18 "\n"
|
||||
FN@18..36
|
||||
ABI@18..24
|
||||
EXTERN_KW@18..24 "extern"
|
||||
WHITESPACE@24..25 " "
|
||||
FN_KW@25..27 "fn"
|
||||
WHITESPACE@27..28 " "
|
||||
NAME@28..31
|
||||
IDENT@28..31 "foo"
|
||||
PARAM_LIST@31..33
|
||||
L_PAREN@31..32 "("
|
||||
R_PAREN@32..33 ")"
|
||||
WHITESPACE@33..34 " "
|
||||
BLOCK_EXPR@34..36
|
||||
L_CURLY@34..35 "{"
|
||||
R_CURLY@35..36 "}"
|
||||
WHITESPACE@36..37 "\n"
|
||||
FN@37..54
|
||||
CONST_KW@37..42 "const"
|
||||
WHITESPACE@42..43 " "
|
||||
FN_KW@43..45 "fn"
|
||||
WHITESPACE@45..46 " "
|
||||
NAME@46..49
|
||||
IDENT@46..49 "foo"
|
||||
PARAM_LIST@49..51
|
||||
L_PAREN@49..50 "("
|
||||
R_PAREN@50..51 ")"
|
||||
WHITESPACE@51..52 " "
|
||||
BLOCK_EXPR@52..54
|
||||
L_CURLY@52..53 "{"
|
||||
R_CURLY@53..54 "}"
|
||||
WHITESPACE@54..55 "\n"
|
||||
FN@55..79
|
||||
CONST_KW@55..60 "const"
|
||||
WHITESPACE@60..61 " "
|
||||
UNSAFE_KW@61..67 "unsafe"
|
||||
WHITESPACE@67..68 " "
|
||||
FN_KW@68..70 "fn"
|
||||
WHITESPACE@70..71 " "
|
||||
NAME@71..74
|
||||
IDENT@71..74 "foo"
|
||||
PARAM_LIST@74..76
|
||||
L_PAREN@74..75 "("
|
||||
R_PAREN@75..76 ")"
|
||||
WHITESPACE@76..77 " "
|
||||
BLOCK_EXPR@77..79
|
||||
L_CURLY@77..78 "{"
|
||||
R_CURLY@78..79 "}"
|
||||
WHITESPACE@79..80 "\n"
|
||||
FN@80..109
|
||||
UNSAFE_KW@80..86 "unsafe"
|
||||
WHITESPACE@86..87 " "
|
||||
ABI@87..97
|
||||
EXTERN_KW@87..93 "extern"
|
||||
WHITESPACE@93..94 " "
|
||||
STRING@94..97 "\"C\""
|
||||
WHITESPACE@97..98 " "
|
||||
FN_KW@98..100 "fn"
|
||||
WHITESPACE@100..101 " "
|
||||
NAME@101..104
|
||||
IDENT@101..104 "foo"
|
||||
PARAM_LIST@104..106
|
||||
L_PAREN@104..105 "("
|
||||
R_PAREN@105..106 ")"
|
||||
WHITESPACE@106..107 " "
|
||||
BLOCK_EXPR@107..109
|
||||
L_CURLY@107..108 "{"
|
||||
R_CURLY@108..109 "}"
|
||||
WHITESPACE@109..110 "\n"
|
||||
FN@110..128
|
||||
UNSAFE_KW@110..116 "unsafe"
|
||||
WHITESPACE@116..117 " "
|
||||
FN_KW@117..119 "fn"
|
||||
WHITESPACE@119..120 " "
|
||||
NAME@120..123
|
||||
IDENT@120..123 "foo"
|
||||
PARAM_LIST@123..125
|
||||
L_PAREN@123..124 "("
|
||||
R_PAREN@124..125 ")"
|
||||
WHITESPACE@125..126 " "
|
||||
BLOCK_EXPR@126..128
|
||||
L_CURLY@126..127 "{"
|
||||
R_CURLY@127..128 "}"
|
||||
WHITESPACE@128..129 "\n"
|
||||
FN@129..153
|
||||
ASYNC_KW@129..134 "async"
|
||||
WHITESPACE@134..135 " "
|
||||
UNSAFE_KW@135..141 "unsafe"
|
||||
WHITESPACE@141..142 " "
|
||||
FN_KW@142..144 "fn"
|
||||
WHITESPACE@144..145 " "
|
||||
NAME@145..148
|
||||
IDENT@145..148 "foo"
|
||||
PARAM_LIST@148..150
|
||||
L_PAREN@148..149 "("
|
||||
R_PAREN@149..150 ")"
|
||||
WHITESPACE@150..151 " "
|
||||
BLOCK_EXPR@151..153
|
||||
L_CURLY@151..152 "{"
|
||||
R_CURLY@152..153 "}"
|
||||
WHITESPACE@153..154 "\n"
|
||||
FN@154..178
|
||||
CONST_KW@154..159 "const"
|
||||
WHITESPACE@159..160 " "
|
||||
UNSAFE_KW@160..166 "unsafe"
|
||||
WHITESPACE@166..167 " "
|
||||
FN_KW@167..169 "fn"
|
||||
WHITESPACE@169..170 " "
|
||||
NAME@170..173
|
||||
IDENT@170..173 "bar"
|
||||
PARAM_LIST@173..175
|
||||
L_PAREN@173..174 "("
|
||||
R_PAREN@174..175 ")"
|
||||
WHITESPACE@175..176 " "
|
||||
BLOCK_EXPR@176..178
|
||||
L_CURLY@176..177 "{"
|
||||
R_CURLY@177..178 "}"
|
||||
WHITESPACE@178..180 "\n\n"
|
||||
TRAIT@180..197
|
||||
UNSAFE_KW@180..186 "unsafe"
|
||||
WHITESPACE@186..187 " "
|
||||
TRAIT_KW@187..192 "trait"
|
||||
WHITESPACE@192..193 " "
|
||||
NAME@193..194
|
||||
IDENT@193..194 "T"
|
||||
WHITESPACE@194..195 " "
|
||||
ASSOC_ITEM_LIST@195..197
|
||||
L_CURLY@195..196 "{"
|
||||
R_CURLY@196..197 "}"
|
||||
WHITESPACE@197..198 "\n"
|
||||
TRAIT@198..213
|
||||
AUTO_KW@198..202 "auto"
|
||||
WHITESPACE@202..203 " "
|
||||
TRAIT_KW@203..208 "trait"
|
||||
WHITESPACE@208..209 " "
|
||||
NAME@209..210
|
||||
IDENT@209..210 "T"
|
||||
WHITESPACE@210..211 " "
|
||||
ASSOC_ITEM_LIST@211..213
|
||||
L_CURLY@211..212 "{"
|
||||
R_CURLY@212..213 "}"
|
||||
WHITESPACE@213..214 "\n"
|
||||
TRAIT@214..236
|
||||
UNSAFE_KW@214..220 "unsafe"
|
||||
WHITESPACE@220..221 " "
|
||||
AUTO_KW@221..225 "auto"
|
||||
WHITESPACE@225..226 " "
|
||||
TRAIT_KW@226..231 "trait"
|
||||
WHITESPACE@231..232 " "
|
||||
NAME@232..233
|
||||
IDENT@232..233 "T"
|
||||
WHITESPACE@233..234 " "
|
||||
ASSOC_ITEM_LIST@234..236
|
||||
L_CURLY@234..235 "{"
|
||||
R_CURLY@235..236 "}"
|
||||
WHITESPACE@236..238 "\n\n"
|
||||
IMPL@238..256
|
||||
UNSAFE_KW@238..244 "unsafe"
|
||||
WHITESPACE@244..245 " "
|
||||
IMPL_KW@245..249 "impl"
|
||||
WHITESPACE@249..250 " "
|
||||
PATH_TYPE@250..253
|
||||
PATH@250..253
|
||||
PATH_SEGMENT@250..253
|
||||
NAME_REF@250..253
|
||||
IDENT@250..253 "Foo"
|
||||
WHITESPACE@253..254 " "
|
||||
ASSOC_ITEM_LIST@254..256
|
||||
L_CURLY@254..255 "{"
|
||||
R_CURLY@255..256 "}"
|
||||
WHITESPACE@256..257 "\n"
|
||||
IMPL@257..276
|
||||
DEFAULT_KW@257..264 "default"
|
||||
WHITESPACE@264..265 " "
|
||||
IMPL_KW@265..269 "impl"
|
||||
WHITESPACE@269..270 " "
|
||||
PATH_TYPE@270..273
|
||||
PATH@270..273
|
||||
PATH_SEGMENT@270..273
|
||||
NAME_REF@270..273
|
||||
IDENT@270..273 "Foo"
|
||||
WHITESPACE@273..274 " "
|
||||
ASSOC_ITEM_LIST@274..276
|
||||
L_CURLY@274..275 "{"
|
||||
R_CURLY@275..276 "}"
|
||||
WHITESPACE@276..277 "\n"
|
||||
IMPL@277..303
|
||||
UNSAFE_KW@277..283 "unsafe"
|
||||
WHITESPACE@283..284 " "
|
||||
DEFAULT_KW@284..291 "default"
|
||||
WHITESPACE@291..292 " "
|
||||
IMPL_KW@292..296 "impl"
|
||||
WHITESPACE@296..297 " "
|
||||
PATH_TYPE@297..300
|
||||
PATH@297..300
|
||||
PATH_SEGMENT@297..300
|
||||
NAME_REF@297..300
|
||||
IDENT@297..300 "Foo"
|
||||
WHITESPACE@300..301 " "
|
||||
ASSOC_ITEM_LIST@301..303
|
||||
L_CURLY@301..302 "{"
|
||||
R_CURLY@302..303 "}"
|
||||
WHITESPACE@303..304 "\n"
|
16
crates/ra_syntax/test_data/parser/ok/0068_item_modifiers.rs
Normal file
16
crates/ra_syntax/test_data/parser/ok/0068_item_modifiers.rs
Normal file
@ -0,0 +1,16 @@
|
||||
async fn foo() {}
|
||||
extern fn foo() {}
|
||||
const fn foo() {}
|
||||
const unsafe fn foo() {}
|
||||
unsafe extern "C" fn foo() {}
|
||||
unsafe fn foo() {}
|
||||
async unsafe fn foo() {}
|
||||
const unsafe fn bar() {}
|
||||
|
||||
unsafe trait T {}
|
||||
auto trait T {}
|
||||
unsafe auto trait T {}
|
||||
|
||||
unsafe impl Foo {}
|
||||
default impl Foo {}
|
||||
unsafe default impl Foo {}
|
Loading…
Reference in New Issue
Block a user