diff options
Diffstat (limited to 'crates/syntax')
18 files changed, 204 insertions, 70 deletions
diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml index ad8b797fe..52394b337 100644 --- a/crates/syntax/Cargo.toml +++ b/crates/syntax/Cargo.toml | |||
@@ -12,7 +12,7 @@ doctest = false | |||
12 | 12 | ||
13 | [dependencies] | 13 | [dependencies] |
14 | itertools = "0.10.0" | 14 | itertools = "0.10.0" |
15 | rowan = "0.10.1" | 15 | rowan = "0.10.3" |
16 | rustc_lexer = { version = "697.0.0", package = "rustc-ap-rustc_lexer" } | 16 | rustc_lexer = { version = "697.0.0", package = "rustc-ap-rustc_lexer" } |
17 | rustc-hash = "1.1.0" | 17 | rustc-hash = "1.1.0" |
18 | arrayvec = "0.5.1" | 18 | arrayvec = "0.5.1" |
diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs index 1d722db3c..5baa54a3f 100644 --- a/crates/syntax/src/ast/generated/nodes.rs +++ b/crates/syntax/src/ast/generated/nodes.rs | |||
@@ -11,6 +11,7 @@ pub struct Name { | |||
11 | } | 11 | } |
12 | impl Name { | 12 | impl Name { |
13 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } | 13 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } |
14 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
14 | } | 15 | } |
15 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 16 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
16 | pub struct NameRef { | 17 | pub struct NameRef { |
@@ -238,7 +239,6 @@ impl ExternCrate { | |||
238 | pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } | 239 | pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } |
239 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | 240 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } |
240 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 241 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
241 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
242 | pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } | 242 | pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } |
243 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 243 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
244 | } | 244 | } |
@@ -406,9 +406,6 @@ pub struct Visibility { | |||
406 | impl Visibility { | 406 | impl Visibility { |
407 | pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) } | 407 | pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) } |
408 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 408 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
409 | pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) } | ||
410 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
411 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | ||
412 | pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } | 409 | pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } |
413 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 410 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
414 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 411 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
@@ -492,11 +489,11 @@ pub struct SelfParam { | |||
492 | pub(crate) syntax: SyntaxNode, | 489 | pub(crate) syntax: SyntaxNode, |
493 | } | 490 | } |
494 | impl ast::AttrsOwner for SelfParam {} | 491 | impl ast::AttrsOwner for SelfParam {} |
492 | impl ast::NameOwner for SelfParam {} | ||
495 | impl SelfParam { | 493 | impl SelfParam { |
496 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | 494 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
497 | pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } | 495 | pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } |
498 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 496 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
499 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
500 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 497 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
501 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | 498 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
502 | } | 499 | } |
@@ -1075,6 +1072,13 @@ impl InferType { | |||
1075 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | 1072 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } |
1076 | } | 1073 | } |
1077 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1074 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1075 | pub struct MacroType { | ||
1076 | pub(crate) syntax: SyntaxNode, | ||
1077 | } | ||
1078 | impl MacroType { | ||
1079 | pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } | ||
1080 | } | ||
1081 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1078 | pub struct NeverType { | 1082 | pub struct NeverType { |
1079 | pub(crate) syntax: SyntaxNode, | 1083 | pub(crate) syntax: SyntaxNode, |
1080 | } | 1084 | } |
@@ -1303,6 +1307,7 @@ pub enum Type { | |||
1303 | ForType(ForType), | 1307 | ForType(ForType), |
1304 | ImplTraitType(ImplTraitType), | 1308 | ImplTraitType(ImplTraitType), |
1305 | InferType(InferType), | 1309 | InferType(InferType), |
1310 | MacroType(MacroType), | ||
1306 | NeverType(NeverType), | 1311 | NeverType(NeverType), |
1307 | ParenType(ParenType), | 1312 | ParenType(ParenType), |
1308 | PathType(PathType), | 1313 | PathType(PathType), |
@@ -2561,6 +2566,17 @@ impl AstNode for InferType { | |||
2561 | } | 2566 | } |
2562 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2567 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2563 | } | 2568 | } |
2569 | impl AstNode for MacroType { | ||
2570 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_TYPE } | ||
2571 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2572 | if Self::can_cast(syntax.kind()) { | ||
2573 | Some(Self { syntax }) | ||
2574 | } else { | ||
2575 | None | ||
2576 | } | ||
2577 | } | ||
2578 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2579 | } | ||
2564 | impl AstNode for NeverType { | 2580 | impl AstNode for NeverType { |
2565 | fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } | 2581 | fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } |
2566 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2582 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2892,6 +2908,9 @@ impl From<ImplTraitType> for Type { | |||
2892 | impl From<InferType> for Type { | 2908 | impl From<InferType> for Type { |
2893 | fn from(node: InferType) -> Type { Type::InferType(node) } | 2909 | fn from(node: InferType) -> Type { Type::InferType(node) } |
2894 | } | 2910 | } |
2911 | impl From<MacroType> for Type { | ||
2912 | fn from(node: MacroType) -> Type { Type::MacroType(node) } | ||
2913 | } | ||
2895 | impl From<NeverType> for Type { | 2914 | impl From<NeverType> for Type { |
2896 | fn from(node: NeverType) -> Type { Type::NeverType(node) } | 2915 | fn from(node: NeverType) -> Type { Type::NeverType(node) } |
2897 | } | 2916 | } |
@@ -2917,8 +2936,8 @@ impl AstNode for Type { | |||
2917 | fn can_cast(kind: SyntaxKind) -> bool { | 2936 | fn can_cast(kind: SyntaxKind) -> bool { |
2918 | match kind { | 2937 | match kind { |
2919 | ARRAY_TYPE | DYN_TRAIT_TYPE | FN_PTR_TYPE | FOR_TYPE | IMPL_TRAIT_TYPE | INFER_TYPE | 2938 | ARRAY_TYPE | DYN_TRAIT_TYPE | FN_PTR_TYPE | FOR_TYPE | IMPL_TRAIT_TYPE | INFER_TYPE |
2920 | | NEVER_TYPE | PAREN_TYPE | PATH_TYPE | PTR_TYPE | REF_TYPE | SLICE_TYPE | 2939 | | MACRO_TYPE | NEVER_TYPE | PAREN_TYPE | PATH_TYPE | PTR_TYPE | REF_TYPE |
2921 | | TUPLE_TYPE => true, | 2940 | | SLICE_TYPE | TUPLE_TYPE => true, |
2922 | _ => false, | 2941 | _ => false, |
2923 | } | 2942 | } |
2924 | } | 2943 | } |
@@ -2930,6 +2949,7 @@ impl AstNode for Type { | |||
2930 | FOR_TYPE => Type::ForType(ForType { syntax }), | 2949 | FOR_TYPE => Type::ForType(ForType { syntax }), |
2931 | IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }), | 2950 | IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }), |
2932 | INFER_TYPE => Type::InferType(InferType { syntax }), | 2951 | INFER_TYPE => Type::InferType(InferType { syntax }), |
2952 | MACRO_TYPE => Type::MacroType(MacroType { syntax }), | ||
2933 | NEVER_TYPE => Type::NeverType(NeverType { syntax }), | 2953 | NEVER_TYPE => Type::NeverType(NeverType { syntax }), |
2934 | PAREN_TYPE => Type::ParenType(ParenType { syntax }), | 2954 | PAREN_TYPE => Type::ParenType(ParenType { syntax }), |
2935 | PATH_TYPE => Type::PathType(PathType { syntax }), | 2955 | PATH_TYPE => Type::PathType(PathType { syntax }), |
@@ -2949,6 +2969,7 @@ impl AstNode for Type { | |||
2949 | Type::ForType(it) => &it.syntax, | 2969 | Type::ForType(it) => &it.syntax, |
2950 | Type::ImplTraitType(it) => &it.syntax, | 2970 | Type::ImplTraitType(it) => &it.syntax, |
2951 | Type::InferType(it) => &it.syntax, | 2971 | Type::InferType(it) => &it.syntax, |
2972 | Type::MacroType(it) => &it.syntax, | ||
2952 | Type::NeverType(it) => &it.syntax, | 2973 | Type::NeverType(it) => &it.syntax, |
2953 | Type::ParenType(it) => &it.syntax, | 2974 | Type::ParenType(it) => &it.syntax, |
2954 | Type::PathType(it) => &it.syntax, | 2975 | Type::PathType(it) => &it.syntax, |
@@ -4085,6 +4106,11 @@ impl std::fmt::Display for InferType { | |||
4085 | std::fmt::Display::fmt(self.syntax(), f) | 4106 | std::fmt::Display::fmt(self.syntax(), f) |
4086 | } | 4107 | } |
4087 | } | 4108 | } |
4109 | impl std::fmt::Display for MacroType { | ||
4110 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4111 | std::fmt::Display::fmt(self.syntax(), f) | ||
4112 | } | ||
4113 | } | ||
4088 | impl std::fmt::Display for NeverType { | 4114 | impl std::fmt::Display for NeverType { |
4089 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4115 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4090 | std::fmt::Display::fmt(self.syntax(), f) | 4116 | std::fmt::Display::fmt(self.syntax(), f) |
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index b8ce71d27..738c92a5b 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs | |||
@@ -198,6 +198,13 @@ impl ast::Path { | |||
198 | pub fn parent_path(&self) -> Option<ast::Path> { | 198 | pub fn parent_path(&self) -> Option<ast::Path> { |
199 | self.syntax().parent().and_then(ast::Path::cast) | 199 | self.syntax().parent().and_then(ast::Path::cast) |
200 | } | 200 | } |
201 | |||
202 | pub fn as_single_segment(&self) -> Option<ast::PathSegment> { | ||
203 | match self.qualifier() { | ||
204 | Some(_) => None, | ||
205 | None => self.segment(), | ||
206 | } | ||
207 | } | ||
201 | } | 208 | } |
202 | 209 | ||
203 | impl ast::UseTreeList { | 210 | impl ast::UseTreeList { |
@@ -448,16 +455,22 @@ pub enum VisibilityKind { | |||
448 | 455 | ||
449 | impl ast::Visibility { | 456 | impl ast::Visibility { |
450 | pub fn kind(&self) -> VisibilityKind { | 457 | pub fn kind(&self) -> VisibilityKind { |
451 | if let Some(path) = support::children(self.syntax()).next() { | 458 | match self.path() { |
452 | VisibilityKind::In(path) | 459 | Some(path) => { |
453 | } else if self.crate_token().is_some() { | 460 | if let Some(segment) = |
454 | VisibilityKind::PubCrate | 461 | path.as_single_segment().filter(|it| it.coloncolon_token().is_none()) |
455 | } else if self.super_token().is_some() { | 462 | { |
456 | VisibilityKind::PubSuper | 463 | if segment.crate_token().is_some() { |
457 | } else if self.self_token().is_some() { | 464 | return VisibilityKind::PubCrate; |
458 | VisibilityKind::PubSelf | 465 | } else if segment.super_token().is_some() { |
459 | } else { | 466 | return VisibilityKind::PubSuper; |
460 | VisibilityKind::Pub | 467 | } else if segment.self_token().is_some() { |
468 | return VisibilityKind::PubSelf; | ||
469 | } | ||
470 | } | ||
471 | VisibilityKind::In(path) | ||
472 | } | ||
473 | None => VisibilityKind::Pub, | ||
461 | } | 474 | } |
462 | } | 475 | } |
463 | } | 476 | } |
diff --git a/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast b/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast index faf87d6e5..ae4dd2f3b 100644 --- a/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast +++ b/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast | |||
@@ -50,7 +50,10 @@ [email protected] | |||
50 | [email protected] | 50 | [email protected] |
51 | [email protected] "pub" | 51 | [email protected] "pub" |
52 | [email protected] "(" | 52 | [email protected] "(" |
53 | [email protected] "crate" | 53 | [email protected] |
54 | [email protected] | ||
55 | [email protected] | ||
56 | [email protected] "crate" | ||
54 | [email protected] ")" | 57 | [email protected] ")" |
55 | [email protected] " " | 58 | [email protected] " " |
56 | [email protected] "type" | 59 | [email protected] "type" |
@@ -69,7 +72,10 @@ [email protected] | |||
69 | [email protected] | 72 | [email protected] |
70 | [email protected] "pub" | 73 | [email protected] "pub" |
71 | [email protected] "(" | 74 | [email protected] "(" |
72 | [email protected] "crate" | 75 | [email protected] |
76 | [email protected] | ||
77 | [email protected] | ||
78 | [email protected] "crate" | ||
73 | [email protected] ")" | 79 | [email protected] ")" |
74 | [email protected] " " | 80 | [email protected] " " |
75 | [email protected] "const" | 81 | [email protected] "const" |
diff --git a/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast b/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast index 8048f5fad..f0d152d33 100644 --- a/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast +++ b/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast | |||
@@ -19,7 +19,8 @@ [email protected] | |||
19 | [email protected] | 19 | [email protected] |
20 | [email protected] "(" | 20 | [email protected] "(" |
21 | [email protected] | 21 | [email protected] |
22 | [email protected] "self" | 22 | [email protected] |
23 | [email protected] "self" | ||
23 | [email protected] ")" | 24 | [email protected] ")" |
24 | [email protected] " " | 25 | [email protected] " " |
25 | [email protected] | 26 | [email protected] |
@@ -35,7 +36,8 @@ [email protected] | |||
35 | [email protected] "(" | 36 | [email protected] "(" |
36 | [email protected] | 37 | [email protected] |
37 | [email protected] "&" | 38 | [email protected] "&" |
38 | [email protected] "self" | 39 | [email protected] |
40 | [email protected] "self" | ||
39 | [email protected] "," | 41 | [email protected] "," |
40 | [email protected] ")" | 42 | [email protected] ")" |
41 | [email protected] " " | 43 | [email protected] " " |
@@ -55,7 +57,8 @@ [email protected] | |||
55 | [email protected] | 57 | [email protected] |
56 | [email protected] "\'a" | 58 | [email protected] "\'a" |
57 | [email protected] " " | 59 | [email protected] " " |
58 | [email protected] "self" | 60 | [email protected] |
61 | [email protected] "self" | ||
59 | [email protected] "," | 62 | [email protected] "," |
60 | [email protected] ")" | 63 | [email protected] ")" |
61 | [email protected] " " | 64 | [email protected] " " |
@@ -77,7 +80,8 @@ [email protected] | |||
77 | [email protected] " " | 80 | [email protected] " " |
78 | [email protected] "mut" | 81 | [email protected] "mut" |
79 | [email protected] " " | 82 | [email protected] " " |
80 | [email protected] "self" | 83 | [email protected] |
84 | [email protected] "self" | ||
81 | [email protected] "," | 85 | [email protected] "," |
82 | [email protected] " " | 86 | [email protected] " " |
83 | [email protected] | 87 | [email protected] |
@@ -107,7 +111,8 @@ [email protected] | |||
107 | [email protected] | 111 | [email protected] |
108 | [email protected] "mut" | 112 | [email protected] "mut" |
109 | [email protected] " " | 113 | [email protected] " " |
110 | [email protected] "self" | 114 | [email protected] |
115 | [email protected] "self" | ||
111 | [email protected] ")" | 116 | [email protected] ")" |
112 | [email protected] " " | 117 | [email protected] " " |
113 | [email protected] | 118 | [email protected] |
diff --git a/crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rast b/crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rast index ddbd66588..df59f37a2 100644 --- a/crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rast +++ b/crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rast | |||
@@ -19,7 +19,8 @@ [email protected] | |||
19 | [email protected] | 19 | [email protected] |
20 | [email protected] "(" | 20 | [email protected] "(" |
21 | [email protected] | 21 | [email protected] |
22 | [email protected] "self" | 22 | [email protected] |
23 | [email protected] "self" | ||
23 | [email protected] ":" | 24 | [email protected] ":" |
24 | [email protected] " " | 25 | [email protected] " " |
25 | [email protected] | 26 | [email protected] |
@@ -45,7 +46,8 @@ [email protected] | |||
45 | [email protected] | 46 | [email protected] |
46 | [email protected] "mut" | 47 | [email protected] "mut" |
47 | [email protected] " " | 48 | [email protected] " " |
48 | [email protected] "self" | 49 | [email protected] |
50 | [email protected] "self" | ||
49 | [email protected] ":" | 51 | [email protected] ":" |
50 | [email protected] " " | 52 | [email protected] " " |
51 | [email protected] | 53 | [email protected] |
diff --git a/crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rast b/crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rast index ca0702aba..dc7f6295b 100644 --- a/crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rast +++ b/crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rast | |||
@@ -67,7 +67,8 @@ [email protected] | |||
67 | [email protected] "(" | 67 | [email protected] "(" |
68 | [email protected] | 68 | [email protected] |
69 | [email protected] "&" | 69 | [email protected] "&" |
70 | [email protected] "self" | 70 | [email protected] |
71 | [email protected] "self" | ||
71 | [email protected] ")" | 72 | [email protected] ")" |
72 | [email protected] " " | 73 | [email protected] " " |
73 | [email protected] | 74 | [email protected] |
diff --git a/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rast b/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rast index 50742cbcf..f2ead8a62 100644 --- a/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rast +++ b/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rast | |||
@@ -1,9 +1,12 @@ | |||
1 | SOURCE_FILE@0..81 | 1 | SOURCE_FILE@0..62 |
2 | [email protected] | 2 | [email protected] |
3 | [email protected] | 3 | [email protected] |
4 | [email protected] "pub" | 4 | [email protected] "pub" |
5 | [email protected] "(" | 5 | [email protected] "(" |
6 | [email protected] "crate" | 6 | [email protected] |
7 | [email protected] | ||
8 | [email protected] | ||
9 | [email protected] "crate" | ||
7 | [email protected] ")" | 10 | [email protected] ")" |
8 | [email protected] " " | 11 | [email protected] " " |
9 | [email protected] "struct" | 12 | [email protected] "struct" |
@@ -16,7 +19,10 @@ [email protected] | |||
16 | [email protected] | 19 | [email protected] |
17 | [email protected] "pub" | 20 | [email protected] "pub" |
18 | [email protected] "(" | 21 | [email protected] "(" |
19 | [email protected] "self" | 22 | [email protected] |
23 | [email protected] | ||
24 | [email protected] | ||
25 | [email protected] "self" | ||
20 | [email protected] ")" | 26 | [email protected] ")" |
21 | [email protected] " " | 27 | [email protected] " " |
22 | [email protected] "struct" | 28 | [email protected] "struct" |
@@ -25,29 +31,19 @@ [email protected] | |||
25 | [email protected] "S" | 31 | [email protected] "S" |
26 | [email protected] ";" | 32 | [email protected] ";" |
27 | [email protected] "\n" | 33 | [email protected] "\n" |
28 | [email protected]0 | 34 | [email protected]1 |
29 | [email protected]0 | 35 | [email protected]1 |
30 | [email protected] "pub" | 36 | [email protected] "pub" |
31 | [email protected] "(" | 37 | [email protected] "(" |
32 | [email protected] "self" | 38 | [email protected] |
33 | [email protected] ")" | 39 | [email protected] |
34 | [email protected] " " | 40 | [email protected] |
35 | [email protected] "struct" | 41 | [email protected] "super" |
36 | [email protected] " " | 42 | [email protected] ")" |
37 | [email protected] | 43 | [email protected] " " |
38 | [email protected] "S" | 44 | [email protected] "struct" |
39 | [email protected] ";" | 45 | [email protected] " " |
40 | [email protected] "\n" | 46 | [email protected] |
41 | [email protected] | 47 | [email protected] "S" |
42 | [email protected] | 48 | [email protected] ";" |
43 | [email protected] "pub" | 49 | [email protected] "\n" |
44 | [email protected] "(" | ||
45 | [email protected] "self" | ||
46 | [email protected] ")" | ||
47 | [email protected] " " | ||
48 | [email protected] "struct" | ||
49 | [email protected] " " | ||
50 | [email protected] | ||
51 | [email protected] "S" | ||
52 | [email protected] ";" | ||
53 | [email protected] "\n" | ||
diff --git a/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rs b/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rs index faeefde94..a790a485f 100644 --- a/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rs +++ b/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rs | |||
@@ -1,4 +1,3 @@ | |||
1 | pub(crate) struct S; | 1 | pub(crate) struct S; |
2 | pub(self) struct S; | 2 | pub(self) struct S; |
3 | pub(self) struct S; | 3 | pub(super) struct S; |
4 | pub(self) struct S; | ||
diff --git a/crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast b/crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast index d3219f0b2..c54e64e3f 100644 --- a/crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast +++ b/crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast | |||
@@ -16,7 +16,8 @@ [email protected] | |||
16 | [email protected] "must_use" | 16 | [email protected] "must_use" |
17 | [email protected] "]" | 17 | [email protected] "]" |
18 | [email protected] " " | 18 | [email protected] " " |
19 | [email protected] "self" | 19 | [email protected] |
20 | [email protected] "self" | ||
20 | [email protected] ")" | 21 | [email protected] ")" |
21 | [email protected] " " | 22 | [email protected] " " |
22 | [email protected] | 23 | [email protected] |
diff --git a/crates/syntax/test_data/parser/inline/ok/0160_crate_visibility_in.rast b/crates/syntax/test_data/parser/inline/ok/0160_crate_visibility_in.rast new file mode 100644 index 000000000..3d855fc6b --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0160_crate_visibility_in.rast | |||
@@ -0,0 +1,42 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] | ||
4 | [email protected] "pub" | ||
5 | [email protected] "(" | ||
6 | [email protected] "in" | ||
7 | [email protected] " " | ||
8 | [email protected] | ||
9 | [email protected] | ||
10 | [email protected] | ||
11 | [email protected] | ||
12 | [email protected] "super" | ||
13 | [email protected] "::" | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] "A" | ||
17 | [email protected] ")" | ||
18 | [email protected] " " | ||
19 | [email protected] "struct" | ||
20 | [email protected] " " | ||
21 | [email protected] | ||
22 | [email protected] "S" | ||
23 | [email protected] ";" | ||
24 | [email protected] "\n" | ||
25 | [email protected] | ||
26 | [email protected] | ||
27 | [email protected] "pub" | ||
28 | [email protected] "(" | ||
29 | [email protected] "in" | ||
30 | [email protected] " " | ||
31 | [email protected] | ||
32 | [email protected] | ||
33 | [email protected] | ||
34 | [email protected] "crate" | ||
35 | [email protected] ")" | ||
36 | [email protected] " " | ||
37 | [email protected] "struct" | ||
38 | [email protected] " " | ||
39 | [email protected] | ||
40 | [email protected] "S" | ||
41 | [email protected] ";" | ||
42 | [email protected] "\n" | ||
diff --git a/crates/syntax/test_data/parser/inline/ok/0160_crate_visibility_in.rs b/crates/syntax/test_data/parser/inline/ok/0160_crate_visibility_in.rs new file mode 100644 index 000000000..2856dbd84 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0160_crate_visibility_in.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | pub(in super::A) struct S; | ||
2 | pub(in crate) struct S; | ||
diff --git a/crates/syntax/test_data/parser/inline/ok/0161_impl_def_const.rast b/crates/syntax/test_data/parser/inline/ok/0161_impl_def_const.rast new file mode 100644 index 000000000..dcd39535b --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0161_impl_def_const.rast | |||
@@ -0,0 +1,24 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "impl" | ||
4 | [email protected] " " | ||
5 | [email protected] "const" | ||
6 | [email protected] " " | ||
7 | [email protected] | ||
8 | [email protected] | ||
9 | [email protected] | ||
10 | [email protected] | ||
11 | [email protected] "Send" | ||
12 | [email protected] " " | ||
13 | [email protected] "for" | ||
14 | [email protected] " " | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] "X" | ||
20 | [email protected] " " | ||
21 | [email protected] | ||
22 | [email protected] "{" | ||
23 | [email protected] "}" | ||
24 | [email protected] "\n" | ||
diff --git a/crates/syntax/test_data/parser/inline/ok/0161_impl_def_const.rs b/crates/syntax/test_data/parser/inline/ok/0161_impl_def_const.rs new file mode 100644 index 000000000..8d6886469 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0161_impl_def_const.rs | |||
@@ -0,0 +1 @@ | |||
impl const Send for X {} | |||
diff --git a/crates/syntax/test_data/parser/ok/0007_extern_crate.rast b/crates/syntax/test_data/parser/ok/0007_extern_crate.rast index 594c2f8f2..4babdba92 100644 --- a/crates/syntax/test_data/parser/ok/0007_extern_crate.rast +++ b/crates/syntax/test_data/parser/ok/0007_extern_crate.rast | |||
@@ -28,7 +28,8 @@ [email protected] | |||
28 | [email protected] " " | 28 | [email protected] " " |
29 | [email protected] "crate" | 29 | [email protected] "crate" |
30 | [email protected] " " | 30 | [email protected] " " |
31 | [email protected] "self" | 31 | [email protected] |
32 | [email protected] "self" | ||
32 | [email protected] " " | 33 | [email protected] " " |
33 | [email protected] | 34 | [email protected] |
34 | [email protected] "as" | 35 | [email protected] "as" |
diff --git a/crates/syntax/test_data/parser/ok/0012_visibility.rast b/crates/syntax/test_data/parser/ok/0012_visibility.rast index 83a93b5a9..c5dbfb702 100644 --- a/crates/syntax/test_data/parser/ok/0012_visibility.rast +++ b/crates/syntax/test_data/parser/ok/0012_visibility.rast | |||
@@ -32,7 +32,10 @@ [email protected] | |||
32 | [email protected] | 32 | [email protected] |
33 | [email protected] "pub" | 33 | [email protected] "pub" |
34 | [email protected] "(" | 34 | [email protected] "(" |
35 | [email protected] "crate" | 35 | [email protected] |
36 | [email protected] | ||
37 | [email protected] | ||
38 | [email protected] "crate" | ||
36 | [email protected] ")" | 39 | [email protected] ")" |
37 | [email protected] " " | 40 | [email protected] " " |
38 | [email protected] "fn" | 41 | [email protected] "fn" |
@@ -51,7 +54,10 @@ [email protected] | |||
51 | [email protected] | 54 | [email protected] |
52 | [email protected] "pub" | 55 | [email protected] "pub" |
53 | [email protected] "(" | 56 | [email protected] "(" |
54 | [email protected] "super" | 57 | [email protected] |
58 | [email protected] | ||
59 | [email protected] | ||
60 | [email protected] "super" | ||
55 | [email protected] ")" | 61 | [email protected] ")" |
56 | [email protected] " " | 62 | [email protected] " " |
57 | [email protected] "fn" | 63 | [email protected] "fn" |
diff --git a/crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rast b/crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rast index 0ac56df6d..6afed5f05 100644 --- a/crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rast +++ b/crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rast | |||
@@ -110,7 +110,8 @@ [email protected] | |||
110 | [email protected] "(" | 110 | [email protected] "(" |
111 | [email protected] | 111 | [email protected] |
112 | [email protected] "&" | 112 | [email protected] "&" |
113 | [email protected] "self" | 113 | [email protected] |
114 | [email protected] "self" | ||
114 | [email protected] "," | 115 | [email protected] "," |
115 | [email protected] " " | 116 | [email protected] " " |
116 | [email protected] | 117 | [email protected] |
diff --git a/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast b/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast index 3fed11838..e10521d85 100644 --- a/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast +++ b/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast | |||
@@ -281,7 +281,8 @@ [email protected] | |||
281 | [email protected] "must_use" | 281 | [email protected] "must_use" |
282 | [email protected] "]" | 282 | [email protected] "]" |
283 | [email protected] " " | 283 | [email protected] " " |
284 | [email protected] "self" | 284 | [email protected] |
285 | [email protected] "self" | ||
285 | [email protected] ")" | 286 | [email protected] ")" |
286 | [email protected] " " | 287 | [email protected] " " |
287 | [email protected] | 288 | [email protected] |
@@ -305,7 +306,8 @@ [email protected] | |||
305 | [email protected] "attr" | 306 | [email protected] "attr" |
306 | [email protected] "]" | 307 | [email protected] "]" |
307 | [email protected] " " | 308 | [email protected] " " |
308 | [email protected] "self" | 309 | [email protected] |
310 | [email protected] "self" | ||
309 | [email protected] ")" | 311 | [email protected] ")" |
310 | [email protected] " " | 312 | [email protected] " " |
311 | [email protected] | 313 | [email protected] |
@@ -330,7 +332,8 @@ [email protected] | |||
330 | [email protected] "]" | 332 | [email protected] "]" |
331 | [email protected] " " | 333 | [email protected] " " |
332 | [email protected] "&" | 334 | [email protected] "&" |
333 | [email protected] "self" | 335 | [email protected] |
336 | [email protected] "self" | ||
334 | [email protected] ")" | 337 | [email protected] ")" |
335 | [email protected] " " | 338 | [email protected] " " |
336 | [email protected] | 339 | [email protected] |
@@ -363,7 +366,8 @@ [email protected] | |||
363 | [email protected] "&" | 366 | [email protected] "&" |
364 | [email protected] "mut" | 367 | [email protected] "mut" |
365 | [email protected] " " | 368 | [email protected] " " |
366 | [email protected] "self" | 369 | [email protected] |
370 | [email protected] "self" | ||
367 | [email protected] ")" | 371 | [email protected] ")" |
368 | [email protected] " " | 372 | [email protected] " " |
369 | [email protected] | 373 | [email protected] |
@@ -397,7 +401,8 @@ [email protected] | |||
397 | [email protected] | 401 | [email protected] |
398 | [email protected] "\'a" | 402 | [email protected] "\'a" |
399 | [email protected] " " | 403 | [email protected] " " |
400 | [email protected] "self" | 404 | [email protected] |
405 | [email protected] "self" | ||
401 | [email protected] ")" | 406 | [email protected] ")" |
402 | [email protected] " " | 407 | [email protected] " " |
403 | [email protected] | 408 | [email protected] |
@@ -433,7 +438,8 @@ [email protected] | |||
433 | [email protected] " " | 438 | [email protected] " " |
434 | [email protected] "mut" | 439 | [email protected] "mut" |
435 | [email protected] " " | 440 | [email protected] " " |
436 | [email protected] "self" | 441 | [email protected] |
442 | [email protected] "self" | ||
437 | [email protected] ")" | 443 | [email protected] ")" |
438 | [email protected] " " | 444 | [email protected] " " |
439 | [email protected] | 445 | [email protected] |
@@ -457,7 +463,8 @@ [email protected] | |||
457 | [email protected] "attr" | 463 | [email protected] "attr" |
458 | [email protected] "]" | 464 | [email protected] "]" |
459 | [email protected] " " | 465 | [email protected] " " |
460 | [email protected] "self" | 466 | [email protected] |
467 | [email protected] "self" | ||
461 | [email protected] ":" | 468 | [email protected] ":" |
462 | [email protected] " " | 469 | [email protected] " " |
463 | [email protected] | 470 | [email protected] |
@@ -488,7 +495,8 @@ [email protected] | |||
488 | [email protected] "attr" | 495 | [email protected] "attr" |
489 | [email protected] "]" | 496 | [email protected] "]" |
490 | [email protected] " " | 497 | [email protected] " " |
491 | [email protected] "self" | 498 | [email protected] |
499 | [email protected] "self" | ||
492 | [email protected] ":" | 500 | [email protected] ":" |
493 | [email protected] " " | 501 | [email protected] " " |
494 | [email protected] | 502 | [email protected] |