aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock14
-rw-r--r--Cargo.toml1
-rw-r--r--crates/base_db/src/lib.rs1
-rw-r--r--crates/hir/src/lib.rs4
-rw-r--r--crates/hir_def/src/attr.rs22
-rw-r--r--crates/hir_def/src/import_map.rs169
-rw-r--r--crates/hir_def/src/lang_item.rs1
-rw-r--r--crates/hir_def/src/per_ns.rs2
-rw-r--r--crates/ide/src/hover.rs2
-rw-r--r--crates/ide/src/prime_caches.rs7
-rw-r--r--crates/ide/src/references.rs20
-rw-r--r--crates/ide_assists/src/handlers/change_visibility.rs11
-rw-r--r--crates/ide_assists/src/handlers/remove_unused_param.rs30
-rw-r--r--crates/ide_completion/src/render.rs13
-rw-r--r--crates/ide_completion/src/render/function.rs26
-rw-r--r--crates/ide_db/src/defs.rs10
-rw-r--r--crates/ide_db/src/symbol_index.rs2
-rw-r--r--crates/mbe/src/tests/expand.rs42
-rw-r--r--crates/parser/src/grammar/attributes.rs3
-rw-r--r--crates/parser/src/syntax_kind/generated.rs2
-rw-r--r--crates/proc_macro_srv/src/dylib.rs11
-rw-r--r--crates/proc_macro_srv/src/tests/utils.rs29
-rw-r--r--crates/proc_macro_test/Cargo.toml6
-rw-r--r--crates/proc_macro_test/build.rs48
-rw-r--r--crates/proc_macro_test/imp/.gitignore2
-rw-r--r--crates/proc_macro_test/imp/Cargo.toml17
-rw-r--r--crates/proc_macro_test/imp/src/lib.rs48
-rw-r--r--crates/proc_macro_test/src/lib.rs48
-rw-r--r--crates/profile/Cargo.toml3
-rw-r--r--crates/profile/src/memory_usage.rs16
-rw-r--r--crates/rust-analyzer/src/cli.rs1
-rw-r--r--crates/rust-analyzer/src/cli/analysis_stats.rs1
-rw-r--r--crates/rust-analyzer/src/cli/diagnostics.rs8
-rw-r--r--crates/rust-analyzer/src/cli/load_cargo.rs18
-rw-r--r--crates/rust-analyzer/src/cli/ssr.rs9
-rw-r--r--crates/rust-analyzer/src/integrated_benchmarks.rs2
-rw-r--r--crates/syntax/src/ast/generated/nodes.rs31
-rw-r--r--crates/syntax/src/ast/node_ext.rs19
-rw-r--r--crates/syntax/test_data/parser/err/0005_attribute_recover.rast66
-rw-r--r--crates/syntax/test_data/parser/err/0031_block_inner_attrs.rast68
-rw-r--r--crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast17
-rw-r--r--crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast17
-rw-r--r--crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast18
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast25
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast25
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast17
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast51
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast125
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast34
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast17
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast45
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast18
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0130_let_stmt.rast9
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast9
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast9
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0145_record_pat_field.rast23
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0150_array_attrs.rast17
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0152_arg_with_attr.rast9
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0154_tuple_attrs.rast17
-rw-r--r--crates/syntax/test_data/parser/ok/0006_inner_attributes.rast258
-rw-r--r--crates/syntax/test_data/parser/ok/0008_mod_item.rast9
-rw-r--r--crates/syntax/test_data/parser/ok/0011_outer_attribute.rast45
-rw-r--r--crates/syntax/test_data/parser/ok/0017_attr_trailing_comma.rast19
-rw-r--r--crates/syntax/test_data/parser/ok/0035_weird_exprs.rast87
-rw-r--r--crates/syntax/test_data/parser/ok/0044_let_attrs.rast25
-rw-r--r--crates/syntax/test_data/parser/ok/0045_block_attrs.rast102
-rw-r--r--crates/syntax/test_data/parser/ok/0046_extern_inner_attributes.rast17
-rw-r--r--crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast135
-rw-r--r--crates/syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast9
-rw-r--r--crates/syntax/test_data/parser/ok/0062_macro_2.0.rast9
-rw-r--r--crates/syntax/test_data/parser/ok/0063_variadic_fun.rast17
-rw-r--r--xtask/Cargo.toml2
-rw-r--r--xtask/src/ast_src.rs2
73 files changed, 1190 insertions, 881 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 505263c64..12a096ff1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1158,6 +1158,15 @@ dependencies = [
1158[[package]] 1158[[package]]
1159name = "proc_macro_test" 1159name = "proc_macro_test"
1160version = "0.0.0" 1160version = "0.0.0"
1161dependencies = [
1162 "cargo_metadata",
1163 "proc_macro_test_impl",
1164 "toolchain",
1165]
1166
1167[[package]]
1168name = "proc_macro_test_impl"
1169version = "0.0.0"
1161 1170
1162[[package]] 1171[[package]]
1163name = "profile" 1172name = "profile"
@@ -1170,6 +1179,7 @@ dependencies = [
1170 "once_cell", 1179 "once_cell",
1171 "perf-event", 1180 "perf-event",
1172 "tikv-jemalloc-ctl", 1181 "tikv-jemalloc-ctl",
1182 "winapi",
1173] 1183]
1174 1184
1175[[package]] 1185[[package]]
@@ -1792,9 +1802,9 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
1792 1802
1793[[package]] 1803[[package]]
1794name = "ungrammar" 1804name = "ungrammar"
1795version = "1.13.0" 1805version = "1.14.0"
1796source = "registry+https://github.com/rust-lang/crates.io-index" 1806source = "registry+https://github.com/rust-lang/crates.io-index"
1797checksum = "76760314176cc2b94047af2f921b92c39f11a34dc05c43a3c2b0fc91cb22959f" 1807checksum = "50ef6d7335c77ec3e4a7c4be74c2b9e4642569e94a4004c836f8cca71fede3a7"
1798 1808
1799[[package]] 1809[[package]]
1800name = "unicase" 1810name = "unicase"
diff --git a/Cargo.toml b/Cargo.toml
index 32ba3923b..4d6908fa9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,7 @@
1[workspace] 1[workspace]
2resolver = "2" 2resolver = "2"
3members = ["xtask/", "lib/*", "crates/*"] 3members = ["xtask/", "lib/*", "crates/*"]
4exclude = ["crates/proc_macro_test/imp"]
4 5
5[profile.dev] 6[profile.dev]
6# Disabling debug info speeds up builds a bunch, 7# Disabling debug info speeds up builds a bunch,
diff --git a/crates/base_db/src/lib.rs b/crates/base_db/src/lib.rs
index 62bf2a4b2..54baa3a63 100644
--- a/crates/base_db/src/lib.rs
+++ b/crates/base_db/src/lib.rs
@@ -120,6 +120,7 @@ impl<T: SourceDatabaseExt> FileLoader for FileLoaderDelegate<&'_ T> {
120 } 120 }
121 121
122 fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>> { 122 fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>> {
123 let _p = profile::span("relevant_crates");
123 let source_root = self.0.file_source_root(file_id); 124 let source_root = self.0.file_source_root(file_id);
124 self.0.source_root_crates(source_root) 125 self.0.source_root_crates(source_root)
125 } 126 }
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 68ac8400c..0bb3767c1 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -191,6 +191,7 @@ impl Crate {
191 db: &dyn DefDatabase, 191 db: &dyn DefDatabase,
192 query: import_map::Query, 192 query: import_map::Query,
193 ) -> impl Iterator<Item = Either<ModuleDef, MacroDef>> { 193 ) -> impl Iterator<Item = Either<ModuleDef, MacroDef>> {
194 let _p = profile::span("query_external_importables");
194 import_map::search_dependencies(db, self.into(), query).into_iter().map(|item| match item { 195 import_map::search_dependencies(db, self.into(), query).into_iter().map(|item| match item {
195 ItemInNs::Types(mod_id) | ItemInNs::Values(mod_id) => Either::Left(mod_id.into()), 196 ItemInNs::Types(mod_id) | ItemInNs::Values(mod_id) => Either::Left(mod_id.into()),
196 ItemInNs::Macros(mac_id) => Either::Right(mac_id.into()), 197 ItemInNs::Macros(mac_id) => Either::Right(mac_id.into()),
@@ -2199,6 +2200,7 @@ impl Type {
2199 name: Option<&Name>, 2200 name: Option<&Name>,
2200 mut callback: impl FnMut(&Ty, Function) -> Option<T>, 2201 mut callback: impl FnMut(&Ty, Function) -> Option<T>,
2201 ) -> Option<T> { 2202 ) -> Option<T> {
2203 let _p = profile::span("iterate_method_candidates");
2202 // There should be no inference vars in types passed here 2204 // There should be no inference vars in types passed here
2203 // FIXME check that? 2205 // FIXME check that?
2204 // FIXME replace Unknown by bound vars here 2206 // FIXME replace Unknown by bound vars here
@@ -2232,6 +2234,7 @@ impl Type {
2232 name: Option<&Name>, 2234 name: Option<&Name>,
2233 mut callback: impl FnMut(&Ty, AssocItem) -> Option<T>, 2235 mut callback: impl FnMut(&Ty, AssocItem) -> Option<T>,
2234 ) -> Option<T> { 2236 ) -> Option<T> {
2237 let _p = profile::span("iterate_path_candidates");
2235 let canonical = hir_ty::replace_errors_with_variables(&self.ty); 2238 let canonical = hir_ty::replace_errors_with_variables(&self.ty);
2236 2239
2237 let env = self.env.clone(); 2240 let env = self.env.clone();
@@ -2269,6 +2272,7 @@ impl Type {
2269 &'a self, 2272 &'a self,
2270 db: &'a dyn HirDatabase, 2273 db: &'a dyn HirDatabase,
2271 ) -> impl Iterator<Item = Trait> + 'a { 2274 ) -> impl Iterator<Item = Trait> + 'a {
2275 let _p = profile::span("applicable_inherent_traits");
2272 self.autoderef(db) 2276 self.autoderef(db)
2273 .filter_map(|derefed_type| derefed_type.ty.dyn_trait()) 2277 .filter_map(|derefed_type| derefed_type.ty.dyn_trait())
2274 .flat_map(move |dyn_trait_id| hir_ty::all_super_traits(db.upcast(), dyn_trait_id)) 2278 .flat_map(move |dyn_trait_id| hir_ty::all_super_traits(db.upcast(), dyn_trait_id))
diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs
index 3886b6c04..d9f9fadc1 100644
--- a/crates/hir_def/src/attr.rs
+++ b/crates/hir_def/src/attr.rs
@@ -106,7 +106,9 @@ impl RawAttrs {
106 ) -> Self { 106 ) -> Self {
107 let entries = collect_attrs(owner) 107 let entries = collect_attrs(owner)
108 .flat_map(|(id, attr)| match attr { 108 .flat_map(|(id, attr)| match attr {
109 Either::Left(attr) => Attr::from_src(db, attr, hygiene, id), 109 Either::Left(attr) => {
110 attr.meta().and_then(|meta| Attr::from_src(db, meta, hygiene, id))
111 }
110 Either::Right(comment) => comment.doc_comment().map(|doc| Attr { 112 Either::Right(comment) => comment.doc_comment().map(|doc| Attr {
111 id, 113 id,
112 input: Some(Interned::new(AttrInput::Literal(SmolStr::new(doc)))), 114 input: Some(Interned::new(AttrInput::Literal(SmolStr::new(doc)))),
@@ -172,10 +174,9 @@ impl RawAttrs {
172 let index = attr.id; 174 let index = attr.id;
173 let attrs = parts.filter(|a| !a.is_empty()).filter_map(|attr| { 175 let attrs = parts.filter(|a| !a.is_empty()).filter_map(|attr| {
174 let tree = Subtree { delimiter: None, token_trees: attr.to_vec() }; 176 let tree = Subtree { delimiter: None, token_trees: attr.to_vec() };
175 let attr = ast::Attr::parse(&format!("#[{}]", tree)).ok()?;
176 // FIXME hygiene 177 // FIXME hygiene
177 let hygiene = Hygiene::new_unhygienic(); 178 let hygiene = Hygiene::new_unhygienic();
178 Attr::from_src(db, attr, &hygiene, index) 179 Attr::from_tt(db, &tree, &hygiene, index)
179 }); 180 });
180 181
181 let cfg_options = &crate_graph[krate].cfg_options; 182 let cfg_options = &crate_graph[krate].cfg_options;
@@ -664,7 +665,7 @@ impl fmt::Display for AttrInput {
664impl Attr { 665impl Attr {
665 fn from_src( 666 fn from_src(
666 db: &dyn DefDatabase, 667 db: &dyn DefDatabase,
667 ast: ast::Attr, 668 ast: ast::Meta,
668 hygiene: &Hygiene, 669 hygiene: &Hygiene,
669 id: AttrId, 670 id: AttrId,
670 ) -> Option<Attr> { 671 ) -> Option<Attr> {
@@ -683,6 +684,19 @@ impl Attr {
683 Some(Attr { id, path, input }) 684 Some(Attr { id, path, input })
684 } 685 }
685 686
687 fn from_tt(
688 db: &dyn DefDatabase,
689 tt: &tt::Subtree,
690 hygiene: &Hygiene,
691 id: AttrId,
692 ) -> Option<Attr> {
693 let (parse, _) =
694 mbe::token_tree_to_syntax_node(tt, hir_expand::FragmentKind::MetaItem).ok()?;
695 let ast = ast::Meta::cast(parse.syntax_node())?;
696
697 Self::from_src(db, ast, hygiene, id)
698 }
699
686 /// Parses this attribute as a `#[derive]`, returns an iterator that yields all contained paths 700 /// Parses this attribute as a `#[derive]`, returns an iterator that yields all contained paths
687 /// to derive macros. 701 /// to derive macros.
688 /// 702 ///
diff --git a/crates/hir_def/src/import_map.rs b/crates/hir_def/src/import_map.rs
index 960cabb5f..404e3e153 100644
--- a/crates/hir_def/src/import_map.rs
+++ b/crates/hir_def/src/import_map.rs
@@ -1,6 +1,6 @@
1//! A map of all publicly exported items in a crate. 1//! A map of all publicly exported items in a crate.
2 2
3use std::{cmp::Ordering, fmt, hash::BuildHasherDefault, sync::Arc}; 3use std::{fmt, hash::BuildHasherDefault, sync::Arc};
4 4
5use base_db::CrateId; 5use base_db::CrateId;
6use fst::{self, Streamer}; 6use fst::{self, Streamer};
@@ -69,81 +69,11 @@ pub struct ImportMap {
69impl ImportMap { 69impl ImportMap {
70 pub fn import_map_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<Self> { 70 pub fn import_map_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<Self> {
71 let _p = profile::span("import_map_query"); 71 let _p = profile::span("import_map_query");
72 let def_map = db.crate_def_map(krate);
73 let mut import_map = Self::default();
74
75 // We look only into modules that are public(ly reexported), starting with the crate root.
76 let empty = ImportPath { segments: vec![] };
77 let root = def_map.module_id(def_map.root());
78 let mut worklist = vec![(root, empty)];
79 while let Some((module, mod_path)) = worklist.pop() {
80 let ext_def_map;
81 let mod_data = if module.krate == krate {
82 &def_map[module.local_id]
83 } else {
84 // The crate might reexport a module defined in another crate.
85 ext_def_map = module.def_map(db);
86 &ext_def_map[module.local_id]
87 };
88
89 let visible_items = mod_data.scope.entries().filter_map(|(name, per_ns)| {
90 let per_ns = per_ns.filter_visibility(|vis| vis == Visibility::Public);
91 if per_ns.is_none() {
92 None
93 } else {
94 Some((name, per_ns))
95 }
96 });
97
98 for (name, per_ns) in visible_items {
99 let mk_path = || {
100 let mut path = mod_path.clone();
101 path.segments.push(name.clone());
102 path
103 };
104
105 for item in per_ns.iter_items() {
106 let path = mk_path();
107 let path_len = path.len();
108 let import_info =
109 ImportInfo { path, container: module, is_trait_assoc_item: false };
110
111 if let Some(ModuleDefId::TraitId(tr)) = item.as_module_def_id() {
112 import_map.collect_trait_assoc_items(
113 db,
114 tr,
115 matches!(item, ItemInNs::Types(_)),
116 &import_info,
117 );
118 }
119 72
120 match import_map.map.entry(item) { 73 let mut import_map = collect_import_map(db, krate);
121 Entry::Vacant(entry) => {
122 entry.insert(import_info);
123 }
124 Entry::Occupied(mut entry) => {
125 // If the new path is shorter, prefer that one.
126 if path_len < entry.get().path.len() {
127 *entry.get_mut() = import_info;
128 } else {
129 continue;
130 }
131 }
132 }
133
134 // If we've just added a path to a module, descend into it. We might traverse
135 // modules multiple times, but only if the new path to it is shorter than the
136 // first (else we `continue` above).
137 if let Some(ModuleDefId::ModuleId(mod_id)) = item.as_module_def_id() {
138 worklist.push((mod_id, mk_path()));
139 }
140 }
141 }
142 }
143 74
144 let mut importables = import_map.map.iter().collect::<Vec<_>>(); 75 let mut importables = import_map.map.iter().collect::<Vec<_>>();
145 76 importables.sort_by_cached_key(|(_, import_info)| fst_path(&import_info.path));
146 importables.sort_by(cmp);
147 77
148 // Build the FST, taking care not to insert duplicate values. 78 // Build the FST, taking care not to insert duplicate values.
149 79
@@ -151,13 +81,13 @@ impl ImportMap {
151 let mut last_batch_start = 0; 81 let mut last_batch_start = 0;
152 82
153 for idx in 0..importables.len() { 83 for idx in 0..importables.len() {
154 if let Some(next_item) = importables.get(idx + 1) { 84 let key = fst_path(&importables[last_batch_start].1.path);
155 if cmp(&importables[last_batch_start], next_item) == Ordering::Equal { 85 if let Some((_, next_import_info)) = importables.get(idx + 1) {
86 if key == fst_path(&next_import_info.path) {
156 continue; 87 continue;
157 } 88 }
158 } 89 }
159 90
160 let key = fst_path(&importables[last_batch_start].1.path);
161 builder.insert(key, last_batch_start as u64).unwrap(); 91 builder.insert(key, last_batch_start as u64).unwrap();
162 92
163 last_batch_start = idx + 1; 93 last_batch_start = idx + 1;
@@ -185,6 +115,7 @@ impl ImportMap {
185 is_type_in_ns: bool, 115 is_type_in_ns: bool,
186 original_import_info: &ImportInfo, 116 original_import_info: &ImportInfo,
187 ) { 117 ) {
118 let _p = profile::span("collect_trait_assoc_items");
188 for (assoc_item_name, item) in &db.trait_data(tr).items { 119 for (assoc_item_name, item) in &db.trait_data(tr).items {
189 let module_def_id = match item { 120 let module_def_id = match item {
190 AssocItemId::FunctionId(f) => ModuleDefId::from(*f), 121 AssocItemId::FunctionId(f) => ModuleDefId::from(*f),
@@ -210,6 +141,84 @@ impl ImportMap {
210 } 141 }
211} 142}
212 143
144fn collect_import_map(db: &dyn DefDatabase, krate: CrateId) -> ImportMap {
145 let _p = profile::span("collect_import_map");
146
147 let def_map = db.crate_def_map(krate);
148 let mut import_map = ImportMap::default();
149
150 // We look only into modules that are public(ly reexported), starting with the crate root.
151 let empty = ImportPath { segments: vec![] };
152 let root = def_map.module_id(def_map.root());
153 let mut worklist = vec![(root, empty)];
154 while let Some((module, mod_path)) = worklist.pop() {
155 let ext_def_map;
156 let mod_data = if module.krate == krate {
157 &def_map[module.local_id]
158 } else {
159 // The crate might reexport a module defined in another crate.
160 ext_def_map = module.def_map(db);
161 &ext_def_map[module.local_id]
162 };
163
164 let visible_items = mod_data.scope.entries().filter_map(|(name, per_ns)| {
165 let per_ns = per_ns.filter_visibility(|vis| vis == Visibility::Public);
166 if per_ns.is_none() {
167 None
168 } else {
169 Some((name, per_ns))
170 }
171 });
172
173 for (name, per_ns) in visible_items {
174 let mk_path = || {
175 let mut path = mod_path.clone();
176 path.segments.push(name.clone());
177 path
178 };
179
180 for item in per_ns.iter_items() {
181 let path = mk_path();
182 let path_len = path.len();
183 let import_info =
184 ImportInfo { path, container: module, is_trait_assoc_item: false };
185
186 if let Some(ModuleDefId::TraitId(tr)) = item.as_module_def_id() {
187 import_map.collect_trait_assoc_items(
188 db,
189 tr,
190 matches!(item, ItemInNs::Types(_)),
191 &import_info,
192 );
193 }
194
195 match import_map.map.entry(item) {
196 Entry::Vacant(entry) => {
197 entry.insert(import_info);
198 }
199 Entry::Occupied(mut entry) => {
200 // If the new path is shorter, prefer that one.
201 if path_len < entry.get().path.len() {
202 *entry.get_mut() = import_info;
203 } else {
204 continue;
205 }
206 }
207 }
208
209 // If we've just added a path to a module, descend into it. We might traverse
210 // modules multiple times, but only if the new path to it is shorter than the
211 // first (else we `continue` above).
212 if let Some(ModuleDefId::ModuleId(mod_id)) = item.as_module_def_id() {
213 worklist.push((mod_id, mk_path()));
214 }
215 }
216 }
217 }
218
219 import_map
220}
221
213impl PartialEq for ImportMap { 222impl PartialEq for ImportMap {
214 fn eq(&self, other: &Self) -> bool { 223 fn eq(&self, other: &Self) -> bool {
215 // `fst` and `importables` are built from `map`, so we don't need to compare them. 224 // `fst` and `importables` are built from `map`, so we don't need to compare them.
@@ -240,17 +249,12 @@ impl fmt::Debug for ImportMap {
240} 249}
241 250
242fn fst_path(path: &ImportPath) -> String { 251fn fst_path(path: &ImportPath) -> String {
252 let _p = profile::span("fst_path");
243 let mut s = path.to_string(); 253 let mut s = path.to_string();
244 s.make_ascii_lowercase(); 254 s.make_ascii_lowercase();
245 s 255 s
246} 256}
247 257
248fn cmp((_, lhs): &(&ItemInNs, &ImportInfo), (_, rhs): &(&ItemInNs, &ImportInfo)) -> Ordering {
249 let lhs_str = fst_path(&lhs.path);
250 let rhs_str = fst_path(&rhs.path);
251 lhs_str.cmp(&rhs_str)
252}
253
254#[derive(Debug, Eq, PartialEq, Hash)] 258#[derive(Debug, Eq, PartialEq, Hash)]
255pub enum ImportKind { 259pub enum ImportKind {
256 Module, 260 Module,
@@ -338,6 +342,7 @@ impl Query {
338 } 342 }
339 343
340 fn import_matches(&self, import: &ImportInfo, enforce_lowercase: bool) -> bool { 344 fn import_matches(&self, import: &ImportInfo, enforce_lowercase: bool) -> bool {
345 let _p = profile::span("import_map::Query::import_matches");
341 if import.is_trait_assoc_item { 346 if import.is_trait_assoc_item {
342 if self.exclude_import_kinds.contains(&ImportKind::AssociatedItem) { 347 if self.exclude_import_kinds.contains(&ImportKind::AssociatedItem) {
343 return false; 348 return false;
diff --git a/crates/hir_def/src/lang_item.rs b/crates/hir_def/src/lang_item.rs
index 9e90f745c..3a45cbfa1 100644
--- a/crates/hir_def/src/lang_item.rs
+++ b/crates/hir_def/src/lang_item.rs
@@ -141,6 +141,7 @@ impl LangItems {
141 ) where 141 ) where
142 T: Into<AttrDefId> + Copy, 142 T: Into<AttrDefId> + Copy,
143 { 143 {
144 let _p = profile::span("collect_lang_item");
144 if let Some(lang_item_name) = lang_attr(db, item) { 145 if let Some(lang_item_name) = lang_attr(db, item) {
145 self.items.entry(lang_item_name).or_insert_with(|| constructor(item)); 146 self.items.entry(lang_item_name).or_insert_with(|| constructor(item));
146 } 147 }
diff --git a/crates/hir_def/src/per_ns.rs b/crates/hir_def/src/per_ns.rs
index a594afce6..a9f13cb82 100644
--- a/crates/hir_def/src/per_ns.rs
+++ b/crates/hir_def/src/per_ns.rs
@@ -62,6 +62,7 @@ impl PerNs {
62 } 62 }
63 63
64 pub fn filter_visibility(self, mut f: impl FnMut(Visibility) -> bool) -> PerNs { 64 pub fn filter_visibility(self, mut f: impl FnMut(Visibility) -> bool) -> PerNs {
65 let _p = profile::span("PerNs::filter_visibility");
65 PerNs { 66 PerNs {
66 types: self.types.filter(|(_, v)| f(*v)), 67 types: self.types.filter(|(_, v)| f(*v)),
67 values: self.values.filter(|(_, v)| f(*v)), 68 values: self.values.filter(|(_, v)| f(*v)),
@@ -86,6 +87,7 @@ impl PerNs {
86 } 87 }
87 88
88 pub fn iter_items(self) -> impl Iterator<Item = ItemInNs> { 89 pub fn iter_items(self) -> impl Iterator<Item = ItemInNs> {
90 let _p = profile::span("PerNs::iter_items");
89 self.types 91 self.types
90 .map(|it| ItemInNs::Types(it.0)) 92 .map(|it| ItemInNs::Types(it.0))
91 .into_iter() 93 .into_iter()
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index ed4f18e1f..1c6d36939 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -208,7 +208,7 @@ pub(crate) fn hover(
208} 208}
209 209
210fn try_hover_for_attribute(token: &SyntaxToken) -> Option<RangeInfo<HoverResult>> { 210fn try_hover_for_attribute(token: &SyntaxToken) -> Option<RangeInfo<HoverResult>> {
211 let attr = token.ancestors().nth(1).and_then(ast::Attr::cast)?; 211 let attr = token.ancestors().find_map(ast::Attr::cast)?;
212 let (path, tt) = attr.as_simple_call()?; 212 let (path, tt) = attr.as_simple_call()?;
213 if !tt.syntax().text_range().contains(token.text_range().start()) { 213 if !tt.syntax().text_range().contains(token.text_range().start()) {
214 return None; 214 return None;
diff --git a/crates/ide/src/prime_caches.rs b/crates/ide/src/prime_caches.rs
index d912a01b8..36801c964 100644
--- a/crates/ide/src/prime_caches.rs
+++ b/crates/ide/src/prime_caches.rs
@@ -33,14 +33,15 @@ pub(crate) fn prime_caches(db: &RootDatabase, cb: &(dyn Fn(PrimeCachesProgress)
33 // FIXME: This would be easy to parallelize, since it's in the ideal ordering for that. 33 // FIXME: This would be easy to parallelize, since it's in the ideal ordering for that.
34 // Unfortunately rayon prevents panics from propagation out of a `scope`, which breaks 34 // Unfortunately rayon prevents panics from propagation out of a `scope`, which breaks
35 // cancellation, so we cannot use rayon. 35 // cancellation, so we cannot use rayon.
36 for (i, krate) in topo.iter().enumerate() { 36 for (i, &crate_id) in topo.iter().enumerate() {
37 let crate_name = graph[*krate].display_name.as_deref().unwrap_or_default().to_string(); 37 let crate_name = graph[crate_id].display_name.as_deref().unwrap_or_default().to_string();
38 38
39 cb(PrimeCachesProgress::StartedOnCrate { 39 cb(PrimeCachesProgress::StartedOnCrate {
40 on_crate: crate_name, 40 on_crate: crate_name,
41 n_done: i, 41 n_done: i,
42 n_total: topo.len(), 42 n_total: topo.len(),
43 }); 43 });
44 db.crate_def_map(*krate); 44 db.crate_def_map(crate_id);
45 db.import_map(crate_id);
45 } 46 }
46} 47}
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index ae492a264..f8b64a669 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -1380,4 +1380,24 @@ lib::foo!();
1380 "#]], 1380 "#]],
1381 ); 1381 );
1382 } 1382 }
1383
1384 #[test]
1385 fn macro_doesnt_reference_attribute_on_call() {
1386 check(
1387 r#"
1388macro_rules! m {
1389 () => {};
1390}
1391
1392#[proc_macro_test::attr_noop]
1393m$0!();
1394
1395"#,
1396 expect![[r#"
1397 m Macro FileId(0) 0..32 13..14
1398
1399 FileId(0) 64..65
1400 "#]],
1401 );
1402 }
1383} 1403}
diff --git a/crates/ide_assists/src/handlers/change_visibility.rs b/crates/ide_assists/src/handlers/change_visibility.rs
index d7e39b2ae..ed936667f 100644
--- a/crates/ide_assists/src/handlers/change_visibility.rs
+++ b/crates/ide_assists/src/handlers/change_visibility.rs
@@ -1,7 +1,9 @@
1use syntax::{ 1use syntax::{
2 ast::{self, NameOwner, VisibilityOwner}, 2 ast::{self, NameOwner, VisibilityOwner},
3 AstNode, 3 AstNode,
4 SyntaxKind::{CONST, ENUM, FN, MODULE, STATIC, STRUCT, TRAIT, TYPE_ALIAS, VISIBILITY}, 4 SyntaxKind::{
5 CONST, ENUM, FN, MACRO_DEF, MODULE, STATIC, STRUCT, TRAIT, TYPE_ALIAS, USE, VISIBILITY,
6 },
5 T, 7 T,
6}; 8};
7 9
@@ -37,12 +39,15 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
37 | T![enum] 39 | T![enum]
38 | T![trait] 40 | T![trait]
39 | T![type] 41 | T![type]
42 | T![use]
43 | T![macro]
40 ) 44 )
41 }); 45 });
42 46
43 let (offset, target) = if let Some(keyword) = item_keyword { 47 let (offset, target) = if let Some(keyword) = item_keyword {
44 let parent = keyword.parent()?; 48 let parent = keyword.parent()?;
45 let def_kws = vec![CONST, STATIC, TYPE_ALIAS, FN, MODULE, STRUCT, ENUM, TRAIT]; 49 let def_kws =
50 vec![CONST, STATIC, TYPE_ALIAS, FN, MODULE, STRUCT, ENUM, TRAIT, USE, MACRO_DEF];
46 // Parent is not a definition, can't add visibility 51 // Parent is not a definition, can't add visibility
47 if !def_kws.iter().any(|&def_kw| def_kw == parent.kind()) { 52 if !def_kws.iter().any(|&def_kw| def_kw == parent.kind()) {
48 return None; 53 return None;
@@ -122,6 +127,8 @@ mod tests {
122 check_assist(change_visibility, "$0trait Foo {}", "pub(crate) trait Foo {}"); 127 check_assist(change_visibility, "$0trait Foo {}", "pub(crate) trait Foo {}");
123 check_assist(change_visibility, "m$0od {}", "pub(crate) mod {}"); 128 check_assist(change_visibility, "m$0od {}", "pub(crate) mod {}");
124 check_assist(change_visibility, "unsafe f$0n foo() {}", "pub(crate) unsafe fn foo() {}"); 129 check_assist(change_visibility, "unsafe f$0n foo() {}", "pub(crate) unsafe fn foo() {}");
130 check_assist(change_visibility, "$0macro foo() {}", "pub(crate) macro foo() {}");
131 check_assist(change_visibility, "$0use foo;", "pub(crate) use foo;");
125 } 132 }
126 133
127 #[test] 134 #[test]
diff --git a/crates/ide_assists/src/handlers/remove_unused_param.rs b/crates/ide_assists/src/handlers/remove_unused_param.rs
index 2699d2861..fabfe7e93 100644
--- a/crates/ide_assists/src/handlers/remove_unused_param.rs
+++ b/crates/ide_assists/src/handlers/remove_unused_param.rs
@@ -37,8 +37,20 @@ pub(crate) fn remove_unused_param(acc: &mut Assists, ctx: &AssistContext) -> Opt
37 _ => return None, 37 _ => return None,
38 }; 38 };
39 let func = param.syntax().ancestors().find_map(ast::Fn::cast)?; 39 let func = param.syntax().ancestors().find_map(ast::Fn::cast)?;
40 let param_position = func.param_list()?.params().position(|it| it == param)?;
41 40
41 // check if fn is in impl Trait for ..
42 if func
43 .syntax()
44 .parent() // AssocItemList
45 .and_then(|x| x.parent())
46 .and_then(ast::Impl::cast)
47 .map_or(false, |imp| imp.trait_().is_some())
48 {
49 cov_mark::hit!(trait_impl);
50 return None;
51 }
52
53 let param_position = func.param_list()?.params().position(|it| it == param)?;
42 let fn_def = { 54 let fn_def = {
43 let func = ctx.sema.to_def(&func)?; 55 let func = ctx.sema.to_def(&func)?;
44 Definition::ModuleDef(func.into()) 56 Definition::ModuleDef(func.into())
@@ -254,6 +266,22 @@ fn main() { foo(9, 2) }
254 } 266 }
255 267
256 #[test] 268 #[test]
269 fn trait_impl() {
270 cov_mark::check!(trait_impl);
271 check_assist_not_applicable(
272 remove_unused_param,
273 r#"
274trait Trait {
275 fn foo(x: i32);
276}
277impl Trait for () {
278 fn foo($0x: i32) {}
279}
280"#,
281 );
282 }
283
284 #[test]
257 fn remove_across_files() { 285 fn remove_across_files() {
258 check_assist( 286 check_assist(
259 remove_unused_param, 287 remove_unused_param,
diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs
index f24ef7e49..d3db55c35 100644
--- a/crates/ide_completion/src/render.rs
+++ b/crates/ide_completion/src/render.rs
@@ -135,16 +135,17 @@ fn render_field_(
135 ctx.source_range(), 135 ctx.source_range(),
136 receiver.map_or_else(|| name.clone(), |receiver| format!("{}.{}", receiver, name)), 136 receiver.map_or_else(|| name.clone(), |receiver| format!("{}.{}", receiver, name)),
137 ); 137 );
138 item.kind(SymbolKind::Field)
139 .detail(ty.display(ctx.db()).to_string())
140 .set_documentation(field.docs(ctx.db()))
141 .set_deprecated(is_deprecated);
142 138
143 item.set_relevance(CompletionRelevance { 139 item.set_relevance(CompletionRelevance {
144 type_match: compute_type_match(ctx.completion, ty), 140 type_match: compute_type_match(ctx.completion, ty),
145 exact_name_match: compute_exact_name_match(ctx.completion, &name), 141 exact_name_match: compute_exact_name_match(ctx.completion, &name),
146 ..CompletionRelevance::default() 142 ..CompletionRelevance::default()
147 }); 143 });
144 item.kind(SymbolKind::Field)
145 .detail(ty.display(ctx.db()).to_string())
146 .set_documentation(field.docs(ctx.db()))
147 .set_deprecated(is_deprecated)
148 .lookup_by(name);
148 149
149 if let Some(_ref_match) = compute_ref_match(ctx.completion, ty) { 150 if let Some(_ref_match) = compute_ref_match(ctx.completion, ty) {
150 // FIXME 151 // FIXME
@@ -167,7 +168,9 @@ fn render_tuple_field_(
167 receiver.map_or_else(|| field.to_string(), |receiver| format!("{}.{}", receiver, field)), 168 receiver.map_or_else(|| field.to_string(), |receiver| format!("{}.{}", receiver, field)),
168 ); 169 );
169 170
170 item.kind(SymbolKind::Field).detail(ty.display(ctx.db()).to_string()); 171 item.kind(SymbolKind::Field)
172 .detail(ty.display(ctx.db()).to_string())
173 .lookup_by(field.to_string());
171 174
172 item.build() 175 item.build()
173} 176}
diff --git a/crates/ide_completion/src/render/function.rs b/crates/ide_completion/src/render/function.rs
index 1abeed96d..1357b9f4a 100644
--- a/crates/ide_completion/src/render/function.rs
+++ b/crates/ide_completion/src/render/function.rs
@@ -58,29 +58,29 @@ impl<'a> FunctionRender<'a> {
58 Some(FunctionRender { ctx, name, receiver, func: fn_, ast_node, is_method }) 58 Some(FunctionRender { ctx, name, receiver, func: fn_, ast_node, is_method })
59 } 59 }
60 60
61 fn render(mut self, import_to_add: Option<ImportEdit>) -> CompletionItem { 61 fn render(self, import_to_add: Option<ImportEdit>) -> CompletionItem {
62 let params = self.params(); 62 let params = self.params();
63 if let Some(receiver) = &self.receiver { 63 let call = if let Some(receiver) = &self.receiver {
64 self.name = format!("{}.{}", receiver, &self.name) 64 format!("{}.{}", receiver, &self.name)
65 } 65 } else {
66 let mut item = CompletionItem::new( 66 self.name.clone()
67 CompletionKind::Reference, 67 };
68 self.ctx.source_range(), 68 let mut item =
69 self.name.clone(), 69 CompletionItem::new(CompletionKind::Reference, self.ctx.source_range(), call.clone());
70 );
71 item.kind(self.kind()) 70 item.kind(self.kind())
72 .set_documentation(self.ctx.docs(self.func)) 71 .set_documentation(self.ctx.docs(self.func))
73 .set_deprecated( 72 .set_deprecated(
74 self.ctx.is_deprecated(self.func) || self.ctx.is_deprecated_assoc_item(self.func), 73 self.ctx.is_deprecated(self.func) || self.ctx.is_deprecated_assoc_item(self.func),
75 ) 74 )
76 .detail(self.detail()) 75 .detail(self.detail())
77 .add_call_parens(self.ctx.completion, self.name.clone(), params) 76 .add_call_parens(self.ctx.completion, call.clone(), params)
78 .add_import(import_to_add); 77 .add_import(import_to_add)
78 .lookup_by(self.name);
79 79
80 let ret_type = self.func.ret_type(self.ctx.db()); 80 let ret_type = self.func.ret_type(self.ctx.db());
81 item.set_relevance(CompletionRelevance { 81 item.set_relevance(CompletionRelevance {
82 type_match: compute_type_match(self.ctx.completion, &ret_type), 82 type_match: compute_type_match(self.ctx.completion, &ret_type),
83 exact_name_match: compute_exact_name_match(self.ctx.completion, &self.name), 83 exact_name_match: compute_exact_name_match(self.ctx.completion, &call),
84 ..CompletionRelevance::default() 84 ..CompletionRelevance::default()
85 }); 85 });
86 86
@@ -263,7 +263,7 @@ fn bar(s: &S) {
263 ); 263 );
264 264
265 check_edit( 265 check_edit(
266 "self.foo", 266 "foo",
267 r#" 267 r#"
268struct S {} 268struct S {}
269impl S { 269impl S {
diff --git a/crates/ide_db/src/defs.rs b/crates/ide_db/src/defs.rs
index 1dcccbb8b..a54f2c323 100644
--- a/crates/ide_db/src/defs.rs
+++ b/crates/ide_db/src/defs.rs
@@ -357,9 +357,9 @@ impl NameRefClass {
357 } 357 }
358 } 358 }
359 359
360 if let Some(macro_call) = parent.ancestors().find_map(ast::MacroCall::cast) { 360 if let Some(path) = name_ref.syntax().ancestors().find_map(ast::Path::cast) {
361 if let Some(path) = macro_call.path() { 361 if path.qualifier().is_none() {
362 if path.qualifier().is_none() { 362 if let Some(macro_call) = path.syntax().parent().and_then(ast::MacroCall::cast) {
363 // Only use this to resolve single-segment macro calls like `foo!()`. Multi-segment 363 // Only use this to resolve single-segment macro calls like `foo!()`. Multi-segment
364 // paths are handled below (allowing `log$0::info!` to resolve to the log crate). 364 // paths are handled below (allowing `log$0::info!` to resolve to the log crate).
365 if let Some(macro_def) = sema.resolve_macro_call(&macro_call) { 365 if let Some(macro_def) = sema.resolve_macro_call(&macro_call) {
@@ -367,11 +367,9 @@ impl NameRefClass {
367 } 367 }
368 } 368 }
369 } 369 }
370 }
371 370
372 if let Some(path) = name_ref.syntax().ancestors().find_map(ast::Path::cast) {
373 if let Some(resolved) = sema.resolve_path(&path) { 371 if let Some(resolved) = sema.resolve_path(&path) {
374 if path.syntax().parent().and_then(ast::Attr::cast).is_some() { 372 if path.syntax().ancestors().find_map(ast::Attr::cast).is_some() {
375 if let PathResolution::Def(ModuleDef::Function(func)) = resolved { 373 if let PathResolution::Def(ModuleDef::Function(func)) = resolved {
376 if func.attrs(sema.db).by_key("proc_macro_attribute").exists() { 374 if func.attrs(sema.db).by_key("proc_macro_attribute").exists() {
377 return Some(NameRefClass::Definition(resolved.into())); 375 return Some(NameRefClass::Definition(resolved.into()));
diff --git a/crates/ide_db/src/symbol_index.rs b/crates/ide_db/src/symbol_index.rs
index 5c372a7e5..000f87a85 100644
--- a/crates/ide_db/src/symbol_index.rs
+++ b/crates/ide_db/src/symbol_index.rs
@@ -197,6 +197,7 @@ pub fn world_symbols(db: &RootDatabase, query: Query) -> Vec<FileSymbol> {
197} 197}
198 198
199pub fn crate_symbols(db: &RootDatabase, krate: CrateId, query: Query) -> Vec<FileSymbol> { 199pub fn crate_symbols(db: &RootDatabase, krate: CrateId, query: Query) -> Vec<FileSymbol> {
200 let _p = profile::span("crate_symbols").detail(|| format!("{:?}", query));
200 // FIXME(#4842): This now depends on CrateDefMap, why not build the entire symbol index from 201 // FIXME(#4842): This now depends on CrateDefMap, why not build the entire symbol index from
201 // that instead? 202 // that instead?
202 203
@@ -321,6 +322,7 @@ impl SymbolIndex {
321 322
322impl Query { 323impl Query {
323 pub(crate) fn search(self, indices: &[&SymbolIndex]) -> Vec<FileSymbol> { 324 pub(crate) fn search(self, indices: &[&SymbolIndex]) -> Vec<FileSymbol> {
325 let _p = profile::span("symbol_index::Query::search");
324 let mut op = fst::map::OpBuilder::new(); 326 let mut op = fst::map::OpBuilder::new();
325 for file_symbols in indices.iter() { 327 for file_symbols in indices.iter() {
326 let automaton = fst::automaton::Subsequence::new(&self.lowercased); 328 let automaton = fst::automaton::Subsequence::new(&self.lowercased);
diff --git a/crates/mbe/src/tests/expand.rs b/crates/mbe/src/tests/expand.rs
index 5f173f513..75c88687c 100644
--- a/crates/mbe/src/tests/expand.rs
+++ b/crates/mbe/src/tests/expand.rs
@@ -1846,16 +1846,17 @@ fn test_no_space_after_semi_colon() {
1846 [email protected] 1846 [email protected]
1847 [email protected] "#" 1847 [email protected] "#"
1848 [email protected] "[" 1848 [email protected] "["
1849 [email protected] 1849 [email protected]
1850 [email protected] 1850 [email protected]
1851 [email protected] 1851 [email protected]
1852 [email protected] "cfg" 1852 [email protected]
1853 [email protected] 1853 [email protected] "cfg"
1854 [email protected] "(" 1854 [email protected]
1855 [email protected] "feature" 1855 [email protected] "("
1856 [email protected] "=" 1856 [email protected] "feature"
1857 [email protected] "\"std\"" 1857 [email protected] "="
1858 [email protected] ")" 1858 [email protected] "\"std\""
1859 [email protected] ")"
1859 [email protected] "]" 1860 [email protected] "]"
1860 [email protected] "mod" 1861 [email protected] "mod"
1861 [email protected] 1862 [email protected]
@@ -1865,16 +1866,17 @@ fn test_no_space_after_semi_colon() {
1865 [email protected] 1866 [email protected]
1866 [email protected] "#" 1867 [email protected] "#"
1867 [email protected] "[" 1868 [email protected] "["
1868 [email protected] 1869 [email protected]
1869 [email protected] 1870 [email protected]
1870 [email protected] 1871 [email protected]
1871 [email protected] "cfg" 1872 [email protected]
1872 [email protected] 1873 [email protected] "cfg"
1873 [email protected] "(" 1874 [email protected]
1874 [email protected] "feature" 1875 [email protected] "("
1875 [email protected] "=" 1876 [email protected] "feature"
1876 [email protected] "\"std\"" 1877 [email protected] "="
1877 [email protected] ")" 1878 [email protected] "\"std\""
1879 [email protected] ")"
1878 [email protected] "]" 1880 [email protected] "]"
1879 [email protected] "mod" 1881 [email protected] "mod"
1880 [email protected] 1882 [email protected]
diff --git a/crates/parser/src/grammar/attributes.rs b/crates/parser/src/grammar/attributes.rs
index b8242cd2f..a44c5e484 100644
--- a/crates/parser/src/grammar/attributes.rs
+++ b/crates/parser/src/grammar/attributes.rs
@@ -13,6 +13,7 @@ pub(super) fn outer_attrs(p: &mut Parser) {
13} 13}
14 14
15pub(super) fn meta(p: &mut Parser) { 15pub(super) fn meta(p: &mut Parser) {
16 let meta = p.start();
16 paths::use_path(p); 17 paths::use_path(p);
17 18
18 match p.current() { 19 match p.current() {
@@ -25,6 +26,8 @@ pub(super) fn meta(p: &mut Parser) {
25 T!['('] | T!['['] | T!['{'] => items::token_tree(p), 26 T!['('] | T!['['] | T!['{'] => items::token_tree(p),
26 _ => {} 27 _ => {}
27 } 28 }
29
30 meta.complete(p, META);
28} 31}
29 32
30fn attr(p: &mut Parser, inner: bool) { 33fn attr(p: &mut Parser, inner: bool) {
diff --git a/crates/parser/src/syntax_kind/generated.rs b/crates/parser/src/syntax_kind/generated.rs
index bcefd183a..5f10b82de 100644
--- a/crates/parser/src/syntax_kind/generated.rs
+++ b/crates/parser/src/syntax_kind/generated.rs
@@ -220,7 +220,7 @@ pub enum SyntaxKind {
220 ITEM_LIST, 220 ITEM_LIST,
221 ASSOC_ITEM_LIST, 221 ASSOC_ITEM_LIST,
222 ATTR, 222 ATTR,
223 META_ITEM, 223 META,
224 USE_TREE, 224 USE_TREE,
225 USE_TREE_LIST, 225 USE_TREE_LIST,
226 PATH, 226 PATH,
diff --git a/crates/proc_macro_srv/src/dylib.rs b/crates/proc_macro_srv/src/dylib.rs
index cccc53220..5133e7c50 100644
--- a/crates/proc_macro_srv/src/dylib.rs
+++ b/crates/proc_macro_srv/src/dylib.rs
@@ -188,7 +188,9 @@ impl Expander {
188/// Copy the dylib to temp directory to prevent locking in Windows 188/// Copy the dylib to temp directory to prevent locking in Windows
189#[cfg(windows)] 189#[cfg(windows)]
190fn ensure_file_with_lock_free_access(path: &Path) -> io::Result<PathBuf> { 190fn ensure_file_with_lock_free_access(path: &Path) -> io::Result<PathBuf> {
191 use std::{ffi::OsString, time::SystemTime}; 191 use std::collections::hash_map::RandomState;
192 use std::ffi::OsString;
193 use std::hash::{BuildHasher, Hasher};
192 194
193 let mut to = std::env::temp_dir(); 195 let mut to = std::env::temp_dir();
194 196
@@ -199,10 +201,11 @@ fn ensure_file_with_lock_free_access(path: &Path) -> io::Result<PathBuf> {
199 ) 201 )
200 })?; 202 })?;
201 203
202 // generate a time deps unique number 204 // Generate a unique number by abusing `HashMap`'s hasher.
203 let t = SystemTime::now().duration_since(std::time::UNIX_EPOCH).expect("Time went backwards"); 205 // Maybe this will also "inspire" a libs team member to finally put `rand` in libstd.
206 let t = RandomState::new().build_hasher().finish();
204 207
205 let mut unique_name = OsString::from(t.as_millis().to_string()); 208 let mut unique_name = OsString::from(t.to_string());
206 unique_name.push(file_name); 209 unique_name.push(file_name);
207 210
208 to.push(unique_name); 211 to.push(unique_name);
diff --git a/crates/proc_macro_srv/src/tests/utils.rs b/crates/proc_macro_srv/src/tests/utils.rs
index 2e950c113..2c093aa0a 100644
--- a/crates/proc_macro_srv/src/tests/utils.rs
+++ b/crates/proc_macro_srv/src/tests/utils.rs
@@ -7,35 +7,8 @@ use proc_macro_api::ListMacrosTask;
7use std::str::FromStr; 7use std::str::FromStr;
8 8
9pub mod fixtures { 9pub mod fixtures {
10 use cargo_metadata::Message;
11 use std::path::PathBuf;
12 use std::process::Command;
13
14 // Use current project metadata to get the proc-macro dylib path
15 pub fn proc_macro_test_dylib_path() -> std::path::PathBuf { 10 pub fn proc_macro_test_dylib_path() -> std::path::PathBuf {
16 let name = "proc_macro_test"; 11 proc_macro_test::PROC_MACRO_TEST_LOCATION.into()
17 let version = "0.0.0";
18 let command = Command::new(toolchain::cargo())
19 .args(&["check", "--tests", "--message-format", "json"])
20 .output()
21 .unwrap()
22 .stdout;
23
24 for message in Message::parse_stream(command.as_slice()) {
25 match message.unwrap() {
26 Message::CompilerArtifact(artifact) => {
27 if artifact.target.kind.contains(&"proc-macro".to_string()) {
28 let repr = format!("{} {}", name, version);
29 if artifact.package_id.repr.starts_with(&repr) {
30 return PathBuf::from(&artifact.filenames[0]);
31 }
32 }
33 }
34 _ => (), // Unknown message
35 }
36 }
37
38 panic!("No proc-macro dylib for {} found!", name);
39 } 12 }
40} 13}
41 14
diff --git a/crates/proc_macro_test/Cargo.toml b/crates/proc_macro_test/Cargo.toml
index 753443be2..1a88e361e 100644
--- a/crates/proc_macro_test/Cargo.toml
+++ b/crates/proc_macro_test/Cargo.toml
@@ -8,4 +8,8 @@ publish = false
8 8
9[lib] 9[lib]
10doctest = false 10doctest = false
11proc-macro = true 11
12[build-dependencies]
13proc_macro_test_impl = { path = "imp", version = "0.0.0" }
14toolchain = { path = "../toolchain", version = "0.0.0" }
15cargo_metadata = "0.13"
diff --git a/crates/proc_macro_test/build.rs b/crates/proc_macro_test/build.rs
new file mode 100644
index 000000000..4653a93dd
--- /dev/null
+++ b/crates/proc_macro_test/build.rs
@@ -0,0 +1,48 @@
1//! This will build the proc macro in `imp`, and copy the resulting dylib artifact into the
2//! `OUT_DIR`.
3//!
4//! `proc_macro_test` itself contains only a path to that artifact.
5
6use std::{
7 env, fs,
8 path::{Path, PathBuf},
9 process::Command,
10};
11
12use cargo_metadata::Message;
13
14fn main() {
15 let out_dir = env::var_os("OUT_DIR").unwrap();
16 let out_dir = Path::new(&out_dir);
17
18 let name = "proc_macro_test_impl";
19 let version = "0.0.0";
20 let output = Command::new(toolchain::cargo())
21 .current_dir("imp")
22 .args(&["build", "-p", "proc_macro_test_impl", "--message-format", "json"])
23 .output()
24 .unwrap();
25 assert!(output.status.success());
26
27 let mut artifact_path = None;
28 for message in Message::parse_stream(output.stdout.as_slice()) {
29 match message.unwrap() {
30 Message::CompilerArtifact(artifact) => {
31 if artifact.target.kind.contains(&"proc-macro".to_string()) {
32 let repr = format!("{} {}", name, version);
33 if artifact.package_id.repr.starts_with(&repr) {
34 artifact_path = Some(PathBuf::from(&artifact.filenames[0]));
35 }
36 }
37 }
38 _ => (), // Unknown message
39 }
40 }
41
42 let src_path = artifact_path.expect("no dylib for proc_macro_test_impl found");
43 let dest_path = out_dir.join(src_path.file_name().unwrap());
44 fs::copy(src_path, &dest_path).unwrap();
45
46 let info_path = out_dir.join("proc_macro_test_location.txt");
47 fs::write(info_path, dest_path.to_str().unwrap()).unwrap();
48}
diff --git a/crates/proc_macro_test/imp/.gitignore b/crates/proc_macro_test/imp/.gitignore
new file mode 100644
index 000000000..2c96eb1b6
--- /dev/null
+++ b/crates/proc_macro_test/imp/.gitignore
@@ -0,0 +1,2 @@
1target/
2Cargo.lock
diff --git a/crates/proc_macro_test/imp/Cargo.toml b/crates/proc_macro_test/imp/Cargo.toml
new file mode 100644
index 000000000..1c2e75401
--- /dev/null
+++ b/crates/proc_macro_test/imp/Cargo.toml
@@ -0,0 +1,17 @@
1[package]
2name = "proc_macro_test_impl"
3version = "0.0.0"
4license = "MIT OR Apache-2.0"
5authors = ["rust-analyzer developers"]
6edition = "2018"
7publish = false
8
9[lib]
10doctest = false
11proc-macro = true
12
13[workspace]
14
15[dependencies]
16# this crate should not have any dependencies, since it uses its own workspace,
17# and its own `Cargo.lock`
diff --git a/crates/proc_macro_test/imp/src/lib.rs b/crates/proc_macro_test/imp/src/lib.rs
new file mode 100644
index 000000000..4b26d2472
--- /dev/null
+++ b/crates/proc_macro_test/imp/src/lib.rs
@@ -0,0 +1,48 @@
1//! Exports a few trivial procedural macros for testing.
2
3use proc_macro::TokenStream;
4
5#[proc_macro]
6pub fn fn_like_noop(args: TokenStream) -> TokenStream {
7 args
8}
9
10#[proc_macro]
11pub fn fn_like_panic(args: TokenStream) -> TokenStream {
12 panic!("fn_like_panic!({})", args);
13}
14
15#[proc_macro]
16pub fn fn_like_error(args: TokenStream) -> TokenStream {
17 format!("compile_error!(\"fn_like_error!({})\");", args).parse().unwrap()
18}
19
20#[proc_macro_attribute]
21pub fn attr_noop(_args: TokenStream, item: TokenStream) -> TokenStream {
22 item
23}
24
25#[proc_macro_attribute]
26pub fn attr_panic(args: TokenStream, item: TokenStream) -> TokenStream {
27 panic!("#[attr_panic {}] {}", args, item);
28}
29
30#[proc_macro_attribute]
31pub fn attr_error(args: TokenStream, item: TokenStream) -> TokenStream {
32 format!("compile_error!(\"#[attr_error({})] {}\");", args, item).parse().unwrap()
33}
34
35#[proc_macro_derive(DeriveEmpty)]
36pub fn derive_empty(_item: TokenStream) -> TokenStream {
37 TokenStream::new()
38}
39
40#[proc_macro_derive(DerivePanic)]
41pub fn derive_panic(item: TokenStream) -> TokenStream {
42 panic!("#[derive(DerivePanic)] {}", item);
43}
44
45#[proc_macro_derive(DeriveError)]
46pub fn derive_error(item: TokenStream) -> TokenStream {
47 format!("compile_error!(\"#[derive(DeriveError)] {}\");", item).parse().unwrap()
48}
diff --git a/crates/proc_macro_test/src/lib.rs b/crates/proc_macro_test/src/lib.rs
index 4b26d2472..2edf23a63 100644
--- a/crates/proc_macro_test/src/lib.rs
+++ b/crates/proc_macro_test/src/lib.rs
@@ -1,48 +1,4 @@
1//! Exports a few trivial procedural macros for testing. 1//! Exports a few trivial procedural macros for testing.
2 2
3use proc_macro::TokenStream; 3pub static PROC_MACRO_TEST_LOCATION: &str =
4 4 include_str!(concat!(env!("OUT_DIR"), "/proc_macro_test_location.txt"));
5#[proc_macro]
6pub fn fn_like_noop(args: TokenStream) -> TokenStream {
7 args
8}
9
10#[proc_macro]
11pub fn fn_like_panic(args: TokenStream) -> TokenStream {
12 panic!("fn_like_panic!({})", args);
13}
14
15#[proc_macro]
16pub fn fn_like_error(args: TokenStream) -> TokenStream {
17 format!("compile_error!(\"fn_like_error!({})\");", args).parse().unwrap()
18}
19
20#[proc_macro_attribute]
21pub fn attr_noop(_args: TokenStream, item: TokenStream) -> TokenStream {
22 item
23}
24
25#[proc_macro_attribute]
26pub fn attr_panic(args: TokenStream, item: TokenStream) -> TokenStream {
27 panic!("#[attr_panic {}] {}", args, item);
28}
29
30#[proc_macro_attribute]
31pub fn attr_error(args: TokenStream, item: TokenStream) -> TokenStream {
32 format!("compile_error!(\"#[attr_error({})] {}\");", args, item).parse().unwrap()
33}
34
35#[proc_macro_derive(DeriveEmpty)]
36pub fn derive_empty(_item: TokenStream) -> TokenStream {
37 TokenStream::new()
38}
39
40#[proc_macro_derive(DerivePanic)]
41pub fn derive_panic(item: TokenStream) -> TokenStream {
42 panic!("#[derive(DerivePanic)] {}", item);
43}
44
45#[proc_macro_derive(DeriveError)]
46pub fn derive_error(item: TokenStream) -> TokenStream {
47 format!("compile_error!(\"#[derive(DeriveError)] {}\");", item).parse().unwrap()
48}
diff --git a/crates/profile/Cargo.toml b/crates/profile/Cargo.toml
index 1a8c8f862..653d3d983 100644
--- a/crates/profile/Cargo.toml
+++ b/crates/profile/Cargo.toml
@@ -20,6 +20,9 @@ jemalloc-ctl = { version = "0.4.1", package = "tikv-jemalloc-ctl", optional = tr
20[target.'cfg(target_os = "linux")'.dependencies] 20[target.'cfg(target_os = "linux")'.dependencies]
21perf-event = "0.4" 21perf-event = "0.4"
22 22
23[target.'cfg(windows)'.dependencies]
24winapi = { version = "0.3.8", features = ["psapi"] }
25
23[features] 26[features]
24cpu_profiler = [] 27cpu_profiler = []
25jemalloc = ["jemalloc-ctl"] 28jemalloc = ["jemalloc-ctl"]
diff --git a/crates/profile/src/memory_usage.rs b/crates/profile/src/memory_usage.rs
index 2917ded60..6ef58c9c1 100644
--- a/crates/profile/src/memory_usage.rs
+++ b/crates/profile/src/memory_usage.rs
@@ -35,6 +35,22 @@ impl MemoryUsage {
35 // Note: This is incredibly slow. 35 // Note: This is incredibly slow.
36 let alloc = unsafe { libc::mallinfo() }.uordblks as isize; 36 let alloc = unsafe { libc::mallinfo() }.uordblks as isize;
37 MemoryUsage { allocated: Bytes(alloc) } 37 MemoryUsage { allocated: Bytes(alloc) }
38 } else if #[cfg(windows)] {
39 // There doesn't seem to be an API for determining heap usage, so we try to
40 // approximate that by using the Commit Charge value.
41
42 use winapi::um::processthreadsapi::*;
43 use winapi::um::psapi::*;
44 use std::mem::{MaybeUninit, size_of};
45
46 let proc = unsafe { GetCurrentProcess() };
47 let mut mem_counters = MaybeUninit::uninit();
48 let cb = size_of::<PROCESS_MEMORY_COUNTERS>();
49 let ret = unsafe { GetProcessMemoryInfo(proc, mem_counters.as_mut_ptr(), cb as u32) };
50 assert!(ret != 0);
51
52 let usage = unsafe { mem_counters.assume_init().PagefileUsage };
53 MemoryUsage { allocated: Bytes(usage as isize) }
38 } else { 54 } else {
39 MemoryUsage { allocated: Bytes(0) } 55 MemoryUsage { allocated: Bytes(0) }
40 } 56 }
diff --git a/crates/rust-analyzer/src/cli.rs b/crates/rust-analyzer/src/cli.rs
index 76b666dc2..25ebcc0ec 100644
--- a/crates/rust-analyzer/src/cli.rs
+++ b/crates/rust-analyzer/src/cli.rs
@@ -16,7 +16,6 @@ use vfs::Vfs;
16pub use self::{ 16pub use self::{
17 analysis_stats::AnalysisStatsCmd, 17 analysis_stats::AnalysisStatsCmd,
18 diagnostics::diagnostics, 18 diagnostics::diagnostics,
19 load_cargo::{load_workspace, load_workspace_at, LoadCargoConfig},
20 ssr::{apply_ssr_rules, search_for_patterns}, 19 ssr::{apply_ssr_rules, search_for_patterns},
21}; 20};
22 21
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs
index 5364e907c..843c0ca37 100644
--- a/crates/rust-analyzer/src/cli/analysis_stats.rs
+++ b/crates/rust-analyzer/src/cli/analysis_stats.rs
@@ -70,6 +70,7 @@ impl AnalysisStatsCmd {
70 load_out_dirs_from_check: self.enable_build_scripts, 70 load_out_dirs_from_check: self.enable_build_scripts,
71 wrap_rustc: false, 71 wrap_rustc: false,
72 with_proc_macro: self.enable_proc_macros, 72 with_proc_macro: self.enable_proc_macros,
73 prefill_caches: false,
73 }; 74 };
74 let (host, vfs, _proc_macro) = 75 let (host, vfs, _proc_macro) =
75 load_workspace_at(&self.path, &cargo_config, &load_cargo_config, &|_| {})?; 76 load_workspace_at(&self.path, &cargo_config, &load_cargo_config, &|_| {})?;
diff --git a/crates/rust-analyzer/src/cli/diagnostics.rs b/crates/rust-analyzer/src/cli/diagnostics.rs
index c33c8179c..dc9a390fe 100644
--- a/crates/rust-analyzer/src/cli/diagnostics.rs
+++ b/crates/rust-analyzer/src/cli/diagnostics.rs
@@ -34,8 +34,12 @@ pub fn diagnostics(
34 with_proc_macro: bool, 34 with_proc_macro: bool,
35) -> Result<()> { 35) -> Result<()> {
36 let cargo_config = Default::default(); 36 let cargo_config = Default::default();
37 let load_cargo_config = 37 let load_cargo_config = LoadCargoConfig {
38 LoadCargoConfig { load_out_dirs_from_check, with_proc_macro, wrap_rustc: false }; 38 load_out_dirs_from_check,
39 with_proc_macro,
40 wrap_rustc: false,
41 prefill_caches: false,
42 };
39 let (host, _vfs, _proc_macro) = 43 let (host, _vfs, _proc_macro) =
40 load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?; 44 load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?;
41 let db = host.raw_database(); 45 let db = host.raw_database();
diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs
index 8cee65478..19cb1c046 100644
--- a/crates/rust-analyzer/src/cli/load_cargo.rs
+++ b/crates/rust-analyzer/src/cli/load_cargo.rs
@@ -14,13 +14,14 @@ use vfs::{loader::Handle, AbsPath, AbsPathBuf};
14 14
15use crate::reload::{ProjectFolders, SourceRootConfig}; 15use crate::reload::{ProjectFolders, SourceRootConfig};
16 16
17pub struct LoadCargoConfig { 17pub(crate) struct LoadCargoConfig {
18 pub load_out_dirs_from_check: bool, 18 pub(crate) load_out_dirs_from_check: bool,
19 pub wrap_rustc: bool, 19 pub(crate) wrap_rustc: bool,
20 pub with_proc_macro: bool, 20 pub(crate) with_proc_macro: bool,
21 pub(crate) prefill_caches: bool,
21} 22}
22 23
23pub fn load_workspace_at( 24pub(crate) fn load_workspace_at(
24 root: &Path, 25 root: &Path,
25 cargo_config: &CargoConfig, 26 cargo_config: &CargoConfig,
26 load_config: &LoadCargoConfig, 27 load_config: &LoadCargoConfig,
@@ -33,7 +34,7 @@ pub fn load_workspace_at(
33 load_workspace(workspace, load_config, progress) 34 load_workspace(workspace, load_config, progress)
34} 35}
35 36
36pub fn load_workspace( 37fn load_workspace(
37 ws: ProjectWorkspace, 38 ws: ProjectWorkspace,
38 config: &LoadCargoConfig, 39 config: &LoadCargoConfig,
39 progress: &dyn Fn(String), 40 progress: &dyn Fn(String),
@@ -82,6 +83,10 @@ pub fn load_workspace(
82 log::debug!("crate graph: {:?}", crate_graph); 83 log::debug!("crate graph: {:?}", crate_graph);
83 let host = 84 let host =
84 load_crate_graph(crate_graph, project_folders.source_root_config, &mut vfs, &receiver); 85 load_crate_graph(crate_graph, project_folders.source_root_config, &mut vfs, &receiver);
86
87 if config.prefill_caches {
88 host.analysis().prime_caches(|_| {})?;
89 }
85 Ok((host, vfs, proc_macro_client)) 90 Ok((host, vfs, proc_macro_client))
86} 91}
87 92
@@ -144,6 +149,7 @@ mod tests {
144 load_out_dirs_from_check: false, 149 load_out_dirs_from_check: false,
145 wrap_rustc: false, 150 wrap_rustc: false,
146 with_proc_macro: false, 151 with_proc_macro: false,
152 prefill_caches: false,
147 }; 153 };
148 let (host, _vfs, _proc_macro) = 154 let (host, _vfs, _proc_macro) =
149 load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?; 155 load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?;
diff --git a/crates/rust-analyzer/src/cli/ssr.rs b/crates/rust-analyzer/src/cli/ssr.rs
index 1fd9b5a9b..0b3475e09 100644
--- a/crates/rust-analyzer/src/cli/ssr.rs
+++ b/crates/rust-analyzer/src/cli/ssr.rs
@@ -13,6 +13,7 @@ pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> {
13 load_out_dirs_from_check: true, 13 load_out_dirs_from_check: true,
14 wrap_rustc: false, 14 wrap_rustc: false,
15 with_proc_macro: true, 15 with_proc_macro: true,
16 prefill_caches: false,
16 }; 17 };
17 let (host, vfs, _proc_macro) = 18 let (host, vfs, _proc_macro) =
18 load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?; 19 load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?;
@@ -39,8 +40,12 @@ pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<Stri
39 use ide_db::base_db::SourceDatabaseExt; 40 use ide_db::base_db::SourceDatabaseExt;
40 use ide_db::symbol_index::SymbolsDatabase; 41 use ide_db::symbol_index::SymbolsDatabase;
41 let cargo_config = Default::default(); 42 let cargo_config = Default::default();
42 let load_cargo_config = 43 let load_cargo_config = LoadCargoConfig {
43 LoadCargoConfig { load_out_dirs_from_check: true, wrap_rustc: true, with_proc_macro: true }; 44 load_out_dirs_from_check: true,
45 wrap_rustc: true,
46 with_proc_macro: true,
47 prefill_caches: false,
48 };
44 let (host, _vfs, _proc_macro) = 49 let (host, _vfs, _proc_macro) =
45 load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?; 50 load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?;
46 let db = host.raw_database(); 51 let db = host.raw_database();
diff --git a/crates/rust-analyzer/src/integrated_benchmarks.rs b/crates/rust-analyzer/src/integrated_benchmarks.rs
index ec36a5f5c..8ddeb59f7 100644
--- a/crates/rust-analyzer/src/integrated_benchmarks.rs
+++ b/crates/rust-analyzer/src/integrated_benchmarks.rs
@@ -37,6 +37,7 @@ fn integrated_highlighting_benchmark() {
37 load_out_dirs_from_check: true, 37 load_out_dirs_from_check: true,
38 wrap_rustc: false, 38 wrap_rustc: false,
39 with_proc_macro: false, 39 with_proc_macro: false,
40 prefill_caches: false,
40 }; 41 };
41 42
42 let (mut host, vfs, _proc_macro) = { 43 let (mut host, vfs, _proc_macro) = {
@@ -91,6 +92,7 @@ fn integrated_completion_benchmark() {
91 load_out_dirs_from_check: true, 92 load_out_dirs_from_check: true,
92 wrap_rustc: false, 93 wrap_rustc: false,
93 with_proc_macro: false, 94 with_proc_macro: false,
95 prefill_caches: true,
94 }; 96 };
95 97
96 let (mut host, vfs, _proc_macro) = { 98 let (mut host, vfs, _proc_macro) = {
diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs
index 9a88fdb56..702de59a9 100644
--- a/crates/syntax/src/ast/generated/nodes.rs
+++ b/crates/syntax/src/ast/generated/nodes.rs
@@ -150,10 +150,7 @@ impl Attr {
150 pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } 150 pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) }
151 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } 151 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
152 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 152 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
153 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 153 pub fn meta(&self) -> Option<Meta> { support::child(&self.syntax) }
154 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
155 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
156 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
157 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 154 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
158} 155}
159#[derive(Debug, Clone, PartialEq, Eq, Hash)] 156#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -632,6 +629,16 @@ impl WherePred {
632 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } 629 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
633} 630}
634#[derive(Debug, Clone, PartialEq, Eq, Hash)] 631#[derive(Debug, Clone, PartialEq, Eq, Hash)]
632pub struct Meta {
633 pub(crate) syntax: SyntaxNode,
634}
635impl Meta {
636 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
637 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
638 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
639 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
640}
641#[derive(Debug, Clone, PartialEq, Eq, Hash)]
635pub struct ExprStmt { 642pub struct ExprStmt {
636 pub(crate) syntax: SyntaxNode, 643 pub(crate) syntax: SyntaxNode,
637} 644}
@@ -2072,6 +2079,17 @@ impl AstNode for WherePred {
2072 } 2079 }
2073 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2080 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2074} 2081}
2082impl AstNode for Meta {
2083 fn can_cast(kind: SyntaxKind) -> bool { kind == META }
2084 fn cast(syntax: SyntaxNode) -> Option<Self> {
2085 if Self::can_cast(syntax.kind()) {
2086 Some(Self { syntax })
2087 } else {
2088 None
2089 }
2090 }
2091 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2092}
2075impl AstNode for ExprStmt { 2093impl AstNode for ExprStmt {
2076 fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } 2094 fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT }
2077 fn cast(syntax: SyntaxNode) -> Option<Self> { 2095 fn cast(syntax: SyntaxNode) -> Option<Self> {
@@ -3887,6 +3905,11 @@ impl std::fmt::Display for WherePred {
3887 std::fmt::Display::fmt(self.syntax(), f) 3905 std::fmt::Display::fmt(self.syntax(), f)
3888 } 3906 }
3889} 3907}
3908impl std::fmt::Display for Meta {
3909 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3910 std::fmt::Display::fmt(self.syntax(), f)
3911 }
3912}
3890impl std::fmt::Display for ExprStmt { 3913impl std::fmt::Display for ExprStmt {
3891 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3914 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3892 std::fmt::Display::fmt(self.syntax(), f) 3915 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 a60bc5ad9..3d27d2c1a 100644
--- a/crates/syntax/src/ast/node_ext.rs
+++ b/crates/syntax/src/ast/node_ext.rs
@@ -144,19 +144,20 @@ impl AttrKind {
144 144
145impl ast::Attr { 145impl ast::Attr {
146 pub fn as_simple_atom(&self) -> Option<SmolStr> { 146 pub fn as_simple_atom(&self) -> Option<SmolStr> {
147 if self.eq_token().is_some() || self.token_tree().is_some() { 147 let meta = self.meta()?;
148 if meta.eq_token().is_some() || meta.token_tree().is_some() {
148 return None; 149 return None;
149 } 150 }
150 self.simple_name() 151 self.simple_name()
151 } 152 }
152 153
153 pub fn as_simple_call(&self) -> Option<(SmolStr, ast::TokenTree)> { 154 pub fn as_simple_call(&self) -> Option<(SmolStr, ast::TokenTree)> {
154 let tt = self.token_tree()?; 155 let tt = self.meta()?.token_tree()?;
155 Some((self.simple_name()?, tt)) 156 Some((self.simple_name()?, tt))
156 } 157 }
157 158
158 pub fn simple_name(&self) -> Option<SmolStr> { 159 pub fn simple_name(&self) -> Option<SmolStr> {
159 let path = self.path()?; 160 let path = self.meta()?.path()?;
160 match (path.segment(), path.qualifier()) { 161 match (path.segment(), path.qualifier()) {
161 (Some(segment), None) => Some(segment.syntax().first_token()?.text().into()), 162 (Some(segment), None) => Some(segment.syntax().first_token()?.text().into()),
162 _ => None, 163 _ => None,
@@ -174,6 +175,18 @@ impl ast::Attr {
174 _ => AttrKind::Outer, 175 _ => AttrKind::Outer,
175 } 176 }
176 } 177 }
178
179 pub fn path(&self) -> Option<ast::Path> {
180 self.meta()?.path()
181 }
182
183 pub fn expr(&self) -> Option<ast::Expr> {
184 self.meta()?.expr()
185 }
186
187 pub fn token_tree(&self) -> Option<ast::TokenTree> {
188 self.meta()?.token_tree()
189 }
177} 190}
178 191
179#[derive(Debug, Clone, PartialEq, Eq)] 192#[derive(Debug, Clone, PartialEq, Eq)]
diff --git a/crates/syntax/test_data/parser/err/0005_attribute_recover.rast b/crates/syntax/test_data/parser/err/0005_attribute_recover.rast
index 4845a6563..6202c8bfe 100644
--- a/crates/syntax/test_data/parser/err/0005_attribute_recover.rast
+++ b/crates/syntax/test_data/parser/err/0005_attribute_recover.rast
@@ -3,20 +3,21 @@ [email protected]
3 [email protected] 3 [email protected]
4 [email protected] "#" 4 [email protected] "#"
5 [email protected] "[" 5 [email protected] "["
6 [email protected] 6 [email protected]
7 [email protected] 7 [email protected]
8 [email protected] 8 [email protected]
9 [email protected] "foo" 9 [email protected]
10 [email protected] 10 [email protected] "foo"
11 [email protected] "(" 11 [email protected]
12 [email protected] "foo" 12 [email protected] "("
13 [email protected] "," 13 [email protected] "foo"
14 [email protected] " " 14 [email protected] ","
15 [email protected] "+" 15 [email protected] " "
16 [email protected] "," 16 [email protected] "+"
17 [email protected] " " 17 [email protected] ","
18 [email protected] "92" 18 [email protected] " "
19 [email protected] ")" 19 [email protected] "92"
20 [email protected] ")"
20 [email protected] "]" 21 [email protected] "]"
21 [email protected] "\n" 22 [email protected] "\n"
22 [email protected] "fn" 23 [email protected] "fn"
@@ -35,24 +36,25 @@ [email protected]
35 [email protected] 36 [email protected]
36 [email protected] "#" 37 [email protected] "#"
37 [email protected] "[" 38 [email protected] "["
38 [email protected] 39 [email protected]
39 [email protected] 40 [email protected]
40 [email protected] 41 [email protected]
41 [email protected] "foo" 42 [email protected]
42 [email protected] 43 [email protected] "foo"
43 [email protected] "(" 44 [email protected]
44 [email protected] "\n" 45 [email protected] "("
45 [email protected] "fn" 46 [email protected] "\n"
46 [email protected] " " 47 [email protected] "fn"
47 [email protected] "foo" 48 [email protected] " "
48 [email protected] 49 [email protected] "foo"
49 [email protected] "(" 50 [email protected]
50 [email protected] ")" 51 [email protected] "("
51 [email protected] " " 52 [email protected] ")"
52 [email protected] 53 [email protected] " "
53 [email protected] "{" 54 [email protected]
54 [email protected] "\n" 55 [email protected] "{"
55 [email protected] "}" 56 [email protected] "\n"
57 [email protected] "}"
56 [email protected] "\n" 58 [email protected] "\n"
57error 53..53: expected R_PAREN 59error 53..53: expected R_PAREN
58error 53..53: expected `]` 60error 53..53: expected `]`
diff --git a/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rast b/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rast
index a443b37db..846279748 100644
--- a/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rast
+++ b/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rast
@@ -27,14 +27,15 @@ [email protected]
27 [email protected] "#" 27 [email protected] "#"
28 [email protected] "!" 28 [email protected] "!"
29 [email protected] "[" 29 [email protected] "["
30 [email protected] 30 [email protected]
31 [email protected] 31 [email protected]
32 [email protected] 32 [email protected]
33 [email protected] "doc" 33 [email protected]
34 [email protected] 34 [email protected] "doc"
35 [email protected] "(" 35 [email protected]
36 [email protected] "\"Inner attributes not ..." 36 [email protected] "("
37 [email protected] ")" 37 [email protected] "\"Inner attributes not ..."
38 [email protected] ")"
38 [email protected] "]" 39 [email protected] "]"
39 [email protected] "\n " 40 [email protected] "\n "
40 [email protected] "//! Nor are ModuleDoc ..." 41 [email protected] "//! Nor are ModuleDoc ..."
@@ -57,28 +58,30 @@ [email protected]
57 [email protected] "#" 58 [email protected] "#"
58 [email protected] "!" 59 [email protected] "!"
59 [email protected] "[" 60 [email protected] "["
60 [email protected] 61 [email protected]
61 [email protected] 62 [email protected]
62 [email protected] 63 [email protected]
63 [email protected] "doc" 64 [email protected]
64 [email protected] 65 [email protected] "doc"
65 [email protected] "(" 66 [email protected]
66 [email protected] "\"Nor here\"" 67 [email protected] "("
67 [email protected] ")" 68 [email protected] "\"Nor here\""
69 [email protected] ")"
68 [email protected] "]" 70 [email protected] "]"
69 [email protected] "\n " 71 [email protected] "\n "
70 [email protected] 72 [email protected]
71 [email protected] "#" 73 [email protected] "#"
72 [email protected] "!" 74 [email protected] "!"
73 [email protected] "[" 75 [email protected] "["
74 [email protected] 76 [email protected]
75 [email protected] 77 [email protected]
76 [email protected] 78 [email protected]
77 [email protected] "doc" 79 [email protected]
78 [email protected] 80 [email protected] "doc"
79 [email protected] "(" 81 [email protected]
80 [email protected] "\"We error on each attr\"" 82 [email protected] "("
81 [email protected] ")" 83 [email protected] "\"We error on each attr\""
84 [email protected] ")"
82 [email protected] "]" 85 [email protected] "]"
83 [email protected] "\n " 86 [email protected] "\n "
84 [email protected] "//! Nor are ModuleDoc ..." 87 [email protected] "//! Nor are ModuleDoc ..."
@@ -99,14 +102,15 @@ [email protected]
99 [email protected] "#" 102 [email protected] "#"
100 [email protected] "!" 103 [email protected] "!"
101 [email protected] "[" 104 [email protected] "["
102 [email protected] 105 [email protected]
103 [email protected] 106 [email protected]
104 [email protected] 107 [email protected]
105 [email protected] "doc" 108 [email protected]
106 [email protected] 109 [email protected] "doc"
107 [email protected] "(" 110 [email protected]
108 [email protected] "\"Nor here\"" 111 [email protected] "("
109 [email protected] ")" 112 [email protected] "\"Nor here\""
113 [email protected] ")"
110 [email protected] "]" 114 [email protected] "]"
111 [email protected] "\n " 115 [email protected] "\n "
112 [email protected] "//! Nor are ModuleDoc ..." 116 [email protected] "//! Nor are ModuleDoc ..."
diff --git a/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast b/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast
index 672dd054a..b6209639d 100644
--- a/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast
+++ b/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast
@@ -135,14 +135,15 @@ [email protected]
135 [email protected] 135 [email protected]
136 [email protected] "#" 136 [email protected] "#"
137 [email protected] "[" 137 [email protected] "["
138 [email protected] 138 [email protected]
139 [email protected] 139 [email protected]
140 [email protected] 140 [email protected]
141 [email protected] "cfg" 141 [email protected]
142 [email protected] 142 [email protected] "cfg"
143 [email protected] "(" 143 [email protected]
144 [email protected] "test" 144 [email protected] "("
145 [email protected] ")" 145 [email protected] "test"
146 [email protected] ")"
146 [email protected] "]" 147 [email protected] "]"
147 [email protected] "\n " 148 [email protected] "\n "
148 [email protected] 149 [email protected]
diff --git a/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast b/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast
index 33bb085e9..84c8e9ee7 100644
--- a/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast
+++ b/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast
@@ -47,14 +47,15 @@ [email protected]
47 [email protected] 47 [email protected]
48 [email protected] "#" 48 [email protected] "#"
49 [email protected] "[" 49 [email protected] "["
50 [email protected] 50 [email protected]
51 [email protected] 51 [email protected]
52 [email protected] 52 [email protected]
53 [email protected] "cfg" 53 [email protected]
54 [email protected] 54 [email protected] "cfg"
55 [email protected] "(" 55 [email protected]
56 [email protected] "test" 56 [email protected] "("
57 [email protected] ")" 57 [email protected] "test"
58 [email protected] ")"
58 [email protected] "]" 59 [email protected] "]"
59 [email protected] "\n " 60 [email protected] "\n "
60 [email protected] "}" 61 [email protected] "}"
diff --git a/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast b/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast
index 8fd8d5e59..7b8b7284f 100644
--- a/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast
+++ b/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast
@@ -15,10 +15,11 @@ [email protected]
15 [email protected] 15 [email protected]
16 [email protected] "#" 16 [email protected] "#"
17 [email protected] "[" 17 [email protected] "["
18 [email protected] 18 [email protected]
19 [email protected] 19 [email protected]
20 [email protected] 20 [email protected]
21 [email protected] "A" 21 [email protected]
22 [email protected] "A"
22 [email protected] "]" 23 [email protected] "]"
23 [email protected] " " 24 [email protected] " "
24 [email protected] 25 [email protected]
@@ -35,10 +36,11 @@ [email protected]
35 [email protected] 36 [email protected]
36 [email protected] "#" 37 [email protected] "#"
37 [email protected] "[" 38 [email protected] "["
38 [email protected] 39 [email protected]
39 [email protected] 40 [email protected]
40 [email protected] 41 [email protected]
41 [email protected] "B" 42 [email protected]
43 [email protected] "B"
42 [email protected] "]" 44 [email protected] "]"
43 [email protected] " " 45 [email protected] " "
44 [email protected] 46 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast b/crates/syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast
index 9ae271817..402950bcc 100644
--- a/crates/syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast
@@ -12,18 +12,19 @@ [email protected]
12 [email protected] 12 [email protected]
13 [email protected] "#" 13 [email protected] "#"
14 [email protected] "[" 14 [email protected] "["
15 [email protected] 15 [email protected]
16 [email protected] 16 [email protected]
17 [email protected] 17 [email protected]
18 [email protected] "serde" 18 [email protected]
19 [email protected] 19 [email protected] "serde"
20 [email protected] "(" 20 [email protected]
21 [email protected] "with" 21 [email protected] "("
22 [email protected] " " 22 [email protected] "with"
23 [email protected] "=" 23 [email protected] " "
24 [email protected] " " 24 [email protected] "="
25 [email protected] "\"url_serde\"" 25 [email protected] " "
26 [email protected] ")" 26 [email protected] "\"url_serde\""
27 [email protected] ")"
27 [email protected] "]" 28 [email protected] "]"
28 [email protected] "\n " 29 [email protected] "\n "
29 [email protected] 30 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast b/crates/syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast
index 4d09c9f50..db2b645b0 100644
--- a/crates/syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast
@@ -12,18 +12,19 @@ [email protected]
12 [email protected] 12 [email protected]
13 [email protected] "#" 13 [email protected] "#"
14 [email protected] "[" 14 [email protected] "["
15 [email protected] 15 [email protected]
16 [email protected] 16 [email protected]
17 [email protected] 17 [email protected]
18 [email protected] "serde" 18 [email protected]
19 [email protected] 19 [email protected] "serde"
20 [email protected] "(" 20 [email protected]
21 [email protected] "with" 21 [email protected] "("
22 [email protected] " " 22 [email protected] "with"
23 [email protected] "=" 23 [email protected] " "
24 [email protected] " " 24 [email protected] "="
25 [email protected] "\"url_serde\"" 25 [email protected] " "
26 [email protected] ")" 26 [email protected] "\"url_serde\""
27 [email protected] ")"
27 [email protected] "]" 28 [email protected] "]"
28 [email protected] "\n " 29 [email protected] "\n "
29 [email protected] 30 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast b/crates/syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
index 141a7b203..24ac1d66a 100644
--- a/crates/syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
@@ -26,14 +26,15 @@ [email protected]
26 [email protected] "#" 26 [email protected] "#"
27 [email protected] "!" 27 [email protected] "!"
28 [email protected] "[" 28 [email protected] "["
29 [email protected] 29 [email protected]
30 [email protected] 30 [email protected]
31 [email protected] 31 [email protected]
32 [email protected] "doc" 32 [email protected]
33 [email protected] 33 [email protected] "doc"
34 [email protected] "(" 34 [email protected]
35 [email protected] "\"This is also a doc c ..." 35 [email protected] "("
36 [email protected] ")" 36 [email protected] "\"This is also a doc c ..."
37 [email protected] ")"
37 [email protected] "]" 38 [email protected] "]"
38 [email protected] "\n" 39 [email protected] "\n"
39 [email protected] "}" 40 [email protected] "}"
diff --git a/crates/syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast b/crates/syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast
index ec7a00f1d..7fbeee203 100644
--- a/crates/syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast
@@ -25,42 +25,45 @@ [email protected]
25 [email protected] "#" 25 [email protected] "#"
26 [email protected] "!" 26 [email protected] "!"
27 [email protected] "[" 27 [email protected] "["
28 [email protected] 28 [email protected]
29 [email protected] 29 [email protected]
30 [email protected] 30 [email protected]
31 [email protected] "doc" 31 [email protected]
32 [email protected] 32 [email protected] "doc"
33 [email protected] "(" 33 [email protected]
34 [email protected] "\"Inner attribute\"" 34 [email protected] "("
35 [email protected] ")" 35 [email protected] "\"Inner attribute\""
36 [email protected] ")"
36 [email protected] "]" 37 [email protected] "]"
37 [email protected] "\n " 38 [email protected] "\n "
38 [email protected] 39 [email protected]
39 [email protected] "#" 40 [email protected] "#"
40 [email protected] "!" 41 [email protected] "!"
41 [email protected] "[" 42 [email protected] "["
42 [email protected] 43 [email protected]
43 [email protected] 44 [email protected]
44 [email protected] 45 [email protected]
45 [email protected] "doc" 46 [email protected]
46 [email protected] 47 [email protected] "doc"
47 [email protected] "(" 48 [email protected]
48 [email protected] "\"Can be\"" 49 [email protected] "("
49 [email protected] ")" 50 [email protected] "\"Can be\""
51 [email protected] ")"
50 [email protected] "]" 52 [email protected] "]"
51 [email protected] "\n " 53 [email protected] "\n "
52 [email protected] 54 [email protected]
53 [email protected] "#" 55 [email protected] "#"
54 [email protected] "!" 56 [email protected] "!"
55 [email protected] "[" 57 [email protected] "["
56 [email protected] 58 [email protected]
57 [email protected] 59 [email protected]
58 [email protected] 60 [email protected]
59 [email protected] "doc" 61 [email protected]
60 [email protected] 62 [email protected] "doc"
61 [email protected] "(" 63 [email protected]
62 [email protected] "\"Stacked\"" 64 [email protected] "("
63 [email protected] ")" 65 [email protected] "\"Stacked\""
66 [email protected] ")"
64 [email protected] "]" 67 [email protected] "]"
65 [email protected] "\n " 68 [email protected] "\n "
66 [email protected] 69 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast b/crates/syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast
index 97924da05..40852f514 100644
--- a/crates/syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast
@@ -25,18 +25,19 @@ [email protected]
25 [email protected] 25 [email protected]
26 [email protected] "#" 26 [email protected] "#"
27 [email protected] "[" 27 [email protected] "["
28 [email protected] 28 [email protected]
29 [email protected] 29 [email protected]
30 [email protected] 30 [email protected]
31 [email protected] "cfg" 31 [email protected]
32 [email protected] 32 [email protected] "cfg"
33 [email protected] "(" 33 [email protected]
34 [email protected] "feature" 34 [email protected] "("
35 [email protected] " " 35 [email protected] "feature"
36 [email protected] "=" 36 [email protected] " "
37 [email protected] " " 37 [email protected] "="
38 [email protected] "\"some\"" 38 [email protected] " "
39 [email protected] ")" 39 [email protected] "\"some\""
40 [email protected] ")"
40 [email protected] "]" 41 [email protected] "]"
41 [email protected] "\n " 42 [email protected] "\n "
42 [email protected] 43 [email protected]
@@ -53,18 +54,19 @@ [email protected]
53 [email protected] 54 [email protected]
54 [email protected] "#" 55 [email protected] "#"
55 [email protected] "[" 56 [email protected] "["
56 [email protected] 57 [email protected]
57 [email protected] 58 [email protected]
58 [email protected] 59 [email protected]
59 [email protected] "cfg" 60 [email protected]
60 [email protected] 61 [email protected] "cfg"
61 [email protected] "(" 62 [email protected]
62 [email protected] "feature" 63 [email protected] "("
63 [email protected] " " 64 [email protected] "feature"
64 [email protected] "=" 65 [email protected] " "
65 [email protected] " " 66 [email protected] "="
66 [email protected] "\"other\"" 67 [email protected] " "
67 [email protected] ")" 68 [email protected] "\"other\""
69 [email protected] ")"
68 [email protected] "]" 70 [email protected] "]"
69 [email protected] "\n " 71 [email protected] "\n "
70 [email protected] 72 [email protected]
@@ -81,52 +83,55 @@ [email protected]
81 [email protected] 83 [email protected]
82 [email protected] "#" 84 [email protected] "#"
83 [email protected] "[" 85 [email protected] "["
84 [email protected] 86 [email protected]
85 [email protected] 87 [email protected]
86 [email protected] 88 [email protected]
87 [email protected] "cfg" 89 [email protected]
88 [email protected] 90 [email protected] "cfg"
89 [email protected] "(" 91 [email protected]
90 [email protected] "feature" 92 [email protected] "("
91 [email protected] " " 93 [email protected] "feature"
92 [email protected] "=" 94 [email protected] " "
93 [email protected] " " 95 [email protected] "="
94 [email protected] "\"many\"" 96 [email protected] " "
95 [email protected] ")" 97 [email protected] "\"many\""
98 [email protected] ")"
96 [email protected] "]" 99 [email protected] "]"
97 [email protected] "\n " 100 [email protected] "\n "
98 [email protected] 101 [email protected]
99 [email protected] "#" 102 [email protected] "#"
100 [email protected] "[" 103 [email protected] "["
101 [email protected] 104 [email protected]
102 [email protected] 105 [email protected]
103 [email protected] 106 [email protected]
104 [email protected] "cfg" 107 [email protected]
105 [email protected] 108 [email protected] "cfg"
106 [email protected] "(" 109 [email protected]
107 [email protected] "feature" 110 [email protected] "("
108 [email protected] " " 111 [email protected] "feature"
109 [email protected] "=" 112 [email protected] " "
110 [email protected] " " 113 [email protected] "="
111 [email protected] "\"attributes\"" 114 [email protected] " "
112 [email protected] ")" 115 [email protected] "\"attributes\""
116 [email protected] ")"
113 [email protected] "]" 117 [email protected] "]"
114 [email protected] "\n " 118 [email protected] "\n "
115 [email protected] 119 [email protected]
116 [email protected] "#" 120 [email protected] "#"
117 [email protected] "[" 121 [email protected] "["
118 [email protected] 122 [email protected]
119 [email protected] 123 [email protected]
120 [email protected] 124 [email protected]
121 [email protected] "cfg" 125 [email protected]
122 [email protected] 126 [email protected] "cfg"
123 [email protected] "(" 127 [email protected]
124 [email protected] "feature" 128 [email protected] "("
125 [email protected] " " 129 [email protected] "feature"
126 [email protected] "=" 130 [email protected] " "
127 [email protected] " " 131 [email protected] "="
128 [email protected] "\"before\"" 132 [email protected] " "
129 [email protected] ")" 133 [email protected] "\"before\""
134 [email protected] ")"
130 [email protected] "]" 135 [email protected] "]"
131 [email protected] "\n " 136 [email protected] "\n "
132 [email protected] 137 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast b/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast
index 616aa984e..840181383 100644
--- a/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast
@@ -10,14 +10,15 @@ [email protected]
10 [email protected] 10 [email protected]
11 [email protected] "#" 11 [email protected] "#"
12 [email protected] "[" 12 [email protected] "["
13 [email protected] 13 [email protected]
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 [email protected] "derive" 16 [email protected]
17 [email protected] 17 [email protected] "derive"
18 [email protected] "(" 18 [email protected]
19 [email protected] "Lifetime" 19 [email protected] "("
20 [email protected] ")" 20 [email protected] "Lifetime"
21 [email protected] ")"
21 [email protected] "]" 22 [email protected] "]"
22 [email protected] " " 23 [email protected] " "
23 [email protected] 24 [email protected]
@@ -28,14 +29,15 @@ [email protected]
28 [email protected] 29 [email protected]
29 [email protected] "#" 30 [email protected] "#"
30 [email protected] "[" 31 [email protected] "["
31 [email protected] 32 [email protected]
32 [email protected] 33 [email protected]
33 [email protected] 34 [email protected]
34 [email protected] "derive" 35 [email protected]
35 [email protected] 36 [email protected] "derive"
36 [email protected] "(" 37 [email protected]
37 [email protected] "Type" 38 [email protected] "("
38 [email protected] ")" 39 [email protected] "Type"
40 [email protected] ")"
39 [email protected] "]" 41 [email protected] "]"
40 [email protected] " " 42 [email protected] " "
41 [email protected] 43 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast b/crates/syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast
index 54ea2c7c6..5e82214c0 100644
--- a/crates/syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast
@@ -24,14 +24,15 @@ [email protected]
24 [email protected] 24 [email protected]
25 [email protected] "#" 25 [email protected] "#"
26 [email protected] "[" 26 [email protected] "["
27 [email protected] 27 [email protected]
28 [email protected] 28 [email protected]
29 [email protected] 29 [email protected]
30 [email protected] "cfg" 30 [email protected]
31 [email protected] 31 [email protected] "cfg"
32 [email protected] "(" 32 [email protected]
33 [email protected] "test" 33 [email protected] "("
34 [email protected] ")" 34 [email protected] "test"
35 [email protected] ")"
35 [email protected] "]" 36 [email protected] "]"
36 [email protected] " " 37 [email protected] " "
37 [email protected] 38 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast b/crates/syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast
index 0342e64f3..178204fec 100644
--- a/crates/syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast
@@ -15,10 +15,11 @@ [email protected]
15 [email protected] 15 [email protected]
16 [email protected] "#" 16 [email protected] "#"
17 [email protected] "[" 17 [email protected] "["
18 [email protected] 18 [email protected]
19 [email protected] 19 [email protected]
20 [email protected] 20 [email protected]
21 [email protected] "A" 21 [email protected]
22 [email protected] "A"
22 [email protected] "]" 23 [email protected] "]"
23 [email protected] " " 24 [email protected] " "
24 [email protected] 25 [email protected]
@@ -36,10 +37,11 @@ [email protected]
36 [email protected] 37 [email protected]
37 [email protected] "#" 38 [email protected] "#"
38 [email protected] "[" 39 [email protected] "["
39 [email protected] 40 [email protected]
40 [email protected] 41 [email protected]
41 [email protected] 42 [email protected]
42 [email protected] "B" 43 [email protected]
44 [email protected] "B"
43 [email protected] "]" 45 [email protected] "]"
44 [email protected] " " 46 [email protected] " "
45 [email protected] 47 [email protected]
@@ -56,19 +58,21 @@ [email protected]
56 [email protected] 58 [email protected]
57 [email protected] "#" 59 [email protected] "#"
58 [email protected] "[" 60 [email protected] "["
59 [email protected] 61 [email protected]
60 [email protected] 62 [email protected]
61 [email protected] 63 [email protected]
62 [email protected] "C" 64 [email protected]
65 [email protected] "C"
63 [email protected] "]" 66 [email protected] "]"
64 [email protected] " " 67 [email protected] " "
65 [email protected] 68 [email protected]
66 [email protected] "#" 69 [email protected] "#"
67 [email protected] "[" 70 [email protected] "["
68 [email protected] 71 [email protected]
69 [email protected] 72 [email protected]
70 [email protected] 73 [email protected]
71 [email protected] "D" 74 [email protected]
75 [email protected] "D"
72 [email protected] "]" 76 [email protected] "]"
73 [email protected] " " 77 [email protected] " "
74 [email protected] 78 [email protected]
@@ -79,10 +83,11 @@ [email protected]
79 [email protected] 83 [email protected]
80 [email protected] "#" 84 [email protected] "#"
81 [email protected] "[" 85 [email protected] "["
82 [email protected] 86 [email protected]
83 [email protected] 87 [email protected]
84 [email protected] 88 [email protected]
85 [email protected] "D" 89 [email protected]
90 [email protected] "D"
86 [email protected] "]" 91 [email protected] "]"
87 [email protected] " " 92 [email protected] " "
88 [email protected] 93 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast b/crates/syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast
index 3b46e5b47..9daac234a 100644
--- a/crates/syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast
@@ -19,10 +19,11 @@ [email protected]
19 [email protected] 19 [email protected]
20 [email protected] "#" 20 [email protected] "#"
21 [email protected] "[" 21 [email protected] "["
22 [email protected] 22 [email protected]
23 [email protected] 23 [email protected]
24 [email protected] 24 [email protected]
25 [email protected] "A" 25 [email protected]
26 [email protected] "A"
26 [email protected] "]" 27 [email protected] "]"
27 [email protected] " " 28 [email protected] " "
28 [email protected] 29 [email protected]
@@ -42,10 +43,11 @@ [email protected]
42 [email protected] 43 [email protected]
43 [email protected] "#" 44 [email protected] "#"
44 [email protected] "[" 45 [email protected] "["
45 [email protected] 46 [email protected]
46 [email protected] 47 [email protected]
47 [email protected] 48 [email protected]
48 [email protected] "B" 49 [email protected]
50 [email protected] "B"
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/0130_let_stmt.rast b/crates/syntax/test_data/parser/inline/ok/0130_let_stmt.rast
index 4c07cefa6..c3a79836a 100644
--- a/crates/syntax/test_data/parser/inline/ok/0130_let_stmt.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0130_let_stmt.rast
@@ -109,10 +109,11 @@ [email protected]
109 [email protected] 109 [email protected]
110 [email protected] "#" 110 [email protected] "#"
111 [email protected] "[" 111 [email protected] "["
112 [email protected] 112 [email protected]
113 [email protected] 113 [email protected]
114 [email protected] 114 [email protected]
115 [email protected] "attr" 115 [email protected]
116 [email protected] "attr"
116 [email protected] "]" 117 [email protected] "]"
117 [email protected] 118 [email protected]
118 [email protected] "|" 119 [email protected] "|"
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 c54e64e3f..891eace59 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
@@ -10,10 +10,11 @@ [email protected]
10 [email protected] 10 [email protected]
11 [email protected] "#" 11 [email protected] "#"
12 [email protected] "[" 12 [email protected] "["
13 [email protected] 13 [email protected]
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 [email protected] "must_use" 16 [email protected]
17 [email protected] "must_use"
17 [email protected] "]" 18 [email protected] "]"
18 [email protected] " " 19 [email protected] " "
19 [email protected] 20 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast b/crates/syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast
index a84088bf3..a363e592b 100644
--- a/crates/syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast
@@ -10,10 +10,11 @@ [email protected]
10 [email protected] 10 [email protected]
11 [email protected] "#" 11 [email protected] "#"
12 [email protected] "[" 12 [email protected] "["
13 [email protected] 13 [email protected]
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 [email protected] "attr1" 16 [email protected]
17 [email protected] "attr1"
17 [email protected] "]" 18 [email protected] "]"
18 [email protected] " " 19 [email protected] " "
19 [email protected] 20 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0145_record_pat_field.rast b/crates/syntax/test_data/parser/inline/ok/0145_record_pat_field.rast
index e9202a612..c606a7c9b 100644
--- a/crates/syntax/test_data/parser/inline/ok/0145_record_pat_field.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0145_record_pat_field.rast
@@ -87,17 +87,18 @@ [email protected]
87 [email protected] 87 [email protected]
88 [email protected] "#" 88 [email protected] "#"
89 [email protected] "[" 89 [email protected] "["
90 [email protected] 90 [email protected]
91 [email protected] 91 [email protected]
92 [email protected] 92 [email protected]
93 [email protected] "cfg" 93 [email protected]
94 [email protected] 94 [email protected] "cfg"
95 [email protected] "(" 95 [email protected]
96 [email protected] "any" 96 [email protected] "("
97 [email protected] 97 [email protected] "any"
98 [email protected] "(" 98 [email protected]
99 [email protected] ")" 99 [email protected] "("
100 [email protected] ")" 100 [email protected] ")"
101 [email protected] ")"
101 [email protected] "]" 102 [email protected] "]"
102 [email protected] " " 103 [email protected] " "
103 [email protected] 104 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0150_array_attrs.rast b/crates/syntax/test_data/parser/inline/ok/0150_array_attrs.rast
index f284aafcd..26cdc2945 100644
--- a/crates/syntax/test_data/parser/inline/ok/0150_array_attrs.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0150_array_attrs.rast
@@ -31,14 +31,15 @@ [email protected]
31 [email protected] 31 [email protected]
32 [email protected] "#" 32 [email protected] "#"
33 [email protected] "[" 33 [email protected] "["
34 [email protected] 34 [email protected]
35 [email protected] 35 [email protected]
36 [email protected] 36 [email protected]
37 [email protected] "cfg" 37 [email protected]
38 [email protected] 38 [email protected] "cfg"
39 [email protected] "(" 39 [email protected]
40 [email protected] "test" 40 [email protected] "("
41 [email protected] ")" 41 [email protected] "test"
42 [email protected] ")"
42 [email protected] "]" 43 [email protected] "]"
43 [email protected] " " 44 [email protected] " "
44 [email protected] "2" 45 [email protected] "2"
diff --git a/crates/syntax/test_data/parser/inline/ok/0152_arg_with_attr.rast b/crates/syntax/test_data/parser/inline/ok/0152_arg_with_attr.rast
index 2905c5f1a..1d20765b0 100644
--- a/crates/syntax/test_data/parser/inline/ok/0152_arg_with_attr.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0152_arg_with_attr.rast
@@ -23,10 +23,11 @@ [email protected]
23 [email protected] 23 [email protected]
24 [email protected] "#" 24 [email protected] "#"
25 [email protected] "[" 25 [email protected] "["
26 [email protected] 26 [email protected]
27 [email protected] 27 [email protected]
28 [email protected] 28 [email protected]
29 [email protected] "attr" 29 [email protected]
30 [email protected] "attr"
30 [email protected] "]" 31 [email protected] "]"
31 [email protected] " " 32 [email protected] " "
32 [email protected] "92" 33 [email protected] "92"
diff --git a/crates/syntax/test_data/parser/inline/ok/0154_tuple_attrs.rast b/crates/syntax/test_data/parser/inline/ok/0154_tuple_attrs.rast
index d34b21abe..3b6612677 100644
--- a/crates/syntax/test_data/parser/inline/ok/0154_tuple_attrs.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0154_tuple_attrs.rast
@@ -34,14 +34,15 @@ [email protected]
34 [email protected] 34 [email protected]
35 [email protected] "#" 35 [email protected] "#"
36 [email protected] "[" 36 [email protected] "["
37 [email protected] 37 [email protected]
38 [email protected] 38 [email protected]
39 [email protected] 39 [email protected]
40 [email protected] "cfg" 40 [email protected]
41 [email protected] 41 [email protected] "cfg"
42 [email protected] "(" 42 [email protected]
43 [email protected] "test" 43 [email protected] "("
44 [email protected] ")" 44 [email protected] "test"
45 [email protected] ")"
45 [email protected] "]" 46 [email protected] "]"
46 [email protected] " " 47 [email protected] " "
47 [email protected] "2" 48 [email protected] "2"
diff --git a/crates/syntax/test_data/parser/ok/0006_inner_attributes.rast b/crates/syntax/test_data/parser/ok/0006_inner_attributes.rast
index 42587243a..be2d1dc12 100644
--- a/crates/syntax/test_data/parser/ok/0006_inner_attributes.rast
+++ b/crates/syntax/test_data/parser/ok/0006_inner_attributes.rast
@@ -3,182 +3,192 @@ [email protected]
3 [email protected] "#" 3 [email protected] "#"
4 [email protected] "!" 4 [email protected] "!"
5 [email protected] "[" 5 [email protected] "["
6 [email protected] 6 [email protected]
7 [email protected] 7 [email protected]
8 [email protected] 8 [email protected]
9 [email protected] "attr" 9 [email protected]
10 [email protected] "attr"
10 [email protected] "]" 11 [email protected] "]"
11 [email protected] "\n" 12 [email protected] "\n"
12 [email protected] 13 [email protected]
13 [email protected] "#" 14 [email protected] "#"
14 [email protected] "!" 15 [email protected] "!"
15 [email protected] "[" 16 [email protected] "["
16 [email protected] 17 [email protected]
17 [email protected] 18 [email protected]
18 [email protected] 19 [email protected]
19 [email protected] "attr" 20 [email protected]
20 [email protected] 21 [email protected] "attr"
21 [email protected] "(" 22 [email protected]
22 [email protected] "true" 23 [email protected] "("
23 [email protected] ")" 24 [email protected] "true"
25 [email protected] ")"
24 [email protected] "]" 26 [email protected] "]"
25 [email protected] "\n" 27 [email protected] "\n"
26 [email protected] 28 [email protected]
27 [email protected] "#" 29 [email protected] "#"
28 [email protected] "!" 30 [email protected] "!"
29 [email protected] "[" 31 [email protected] "["
30 [email protected] 32 [email protected]
31 [email protected] 33 [email protected]
32 [email protected] 34 [email protected]
33 [email protected] "attr" 35 [email protected]
34 [email protected] 36 [email protected] "attr"
35 [email protected] "(" 37 [email protected]
36 [email protected] "ident" 38 [email protected] "("
37 [email protected] ")" 39 [email protected] "ident"
40 [email protected] ")"
38 [email protected] "]" 41 [email protected] "]"
39 [email protected] "\n" 42 [email protected] "\n"
40 [email protected] 43 [email protected]
41 [email protected] "#" 44 [email protected] "#"
42 [email protected] "!" 45 [email protected] "!"
43 [email protected] "[" 46 [email protected] "["
44 [email protected] 47 [email protected]
45 [email protected] 48 [email protected]
46 [email protected] 49 [email protected]
47 [email protected] "attr" 50 [email protected]
48 [email protected] 51 [email protected] "attr"
49 [email protected] "(" 52 [email protected]
50 [email protected] "ident" 53 [email protected] "("
51 [email protected] "," 54 [email protected] "ident"
52 [email protected] " " 55 [email protected] ","
53 [email protected] "100" 56 [email protected] " "
54 [email protected] "," 57 [email protected] "100"
55 [email protected] " " 58 [email protected] ","
56 [email protected] "true" 59 [email protected] " "
57 [email protected] "," 60 [email protected] "true"
58 [email protected] " " 61 [email protected] ","
59 [email protected] "\"true\"" 62 [email protected] " "
60 [email protected] "," 63 [email protected] "\"true\""
61 [email protected] " " 64 [email protected] ","
62 [email protected] "ident" 65 [email protected] " "
63 [email protected] " " 66 [email protected] "ident"
64 [email protected] "=" 67 [email protected] " "
65 [email protected] " " 68 [email protected] "="
66 [email protected] "100" 69 [email protected] " "
67 [email protected] "," 70 [email protected] "100"
68 [email protected] " " 71 [email protected] ","
69 [email protected] "ident" 72 [email protected] " "
70 [email protected] " " 73 [email protected] "ident"
71 [email protected] "=" 74 [email protected] " "
72 [email protected] " " 75 [email protected] "="
73 [email protected] "\"hello\"" 76 [email protected] " "
74 [email protected] "," 77 [email protected] "\"hello\""
75 [email protected] " " 78 [email protected] ","
76 [email protected] "ident" 79 [email protected] " "
77 [email protected] 80 [email protected] "ident"
78 [email protected] "(" 81 [email protected]
79 [email protected] "100" 82 [email protected] "("
80 [email protected] ")" 83 [email protected] "100"
81 [email protected] ")" 84 [email protected] ")"
85 [email protected] ")"
82 [email protected] "]" 86 [email protected] "]"
83 [email protected] "\n" 87 [email protected] "\n"
84 [email protected] 88 [email protected]
85 [email protected] "#" 89 [email protected] "#"
86 [email protected] "!" 90 [email protected] "!"
87 [email protected] "[" 91 [email protected] "["
88 [email protected] 92 [email protected]
89 [email protected] 93 [email protected]
90 [email protected] 94 [email protected]
91 [email protected] "attr" 95 [email protected]
92 [email protected] 96 [email protected] "attr"
93 [email protected] "(" 97 [email protected]
94 [email protected] "100" 98 [email protected] "("
95 [email protected] ")" 99 [email protected] "100"
100 [email protected] ")"
96 [email protected] "]" 101 [email protected] "]"
97 [email protected] "\n" 102 [email protected] "\n"
98 [email protected] 103 [email protected]
99 [email protected] "#" 104 [email protected] "#"
100 [email protected] "!" 105 [email protected] "!"
101 [email protected] "[" 106 [email protected] "["
102 [email protected] 107 [email protected]
103 [email protected] 108 [email protected]
104 [email protected] 109 [email protected]
105 [email protected] "attr" 110 [email protected]
106 [email protected] 111 [email protected] "attr"
107 [email protected] "(" 112 [email protected]
108 [email protected] "enabled" 113 [email protected] "("
109 [email protected] " " 114 [email protected] "enabled"
110 [email protected] "=" 115 [email protected] " "
111 [email protected] " " 116 [email protected] "="
112 [email protected] "true" 117 [email protected] " "
113 [email protected] ")" 118 [email protected] "true"
119 [email protected] ")"
114 [email protected] "]" 120 [email protected] "]"
115 [email protected] "\n" 121 [email protected] "\n"
116 [email protected] 122 [email protected]
117 [email protected] "#" 123 [email protected] "#"
118 [email protected] "!" 124 [email protected] "!"
119 [email protected] "[" 125 [email protected] "["
120 [email protected] 126 [email protected]
121 [email protected] 127 [email protected]
122 [email protected] 128 [email protected]
123 [email protected] "enabled" 129 [email protected]
124 [email protected] 130 [email protected] "enabled"
125 [email protected] "(" 131 [email protected]
126 [email protected] "true" 132 [email protected] "("
127 [email protected] ")" 133 [email protected] "true"
134 [email protected] ")"
128 [email protected] "]" 135 [email protected] "]"
129 [email protected] "\n" 136 [email protected] "\n"
130 [email protected] 137 [email protected]
131 [email protected] "#" 138 [email protected] "#"
132 [email protected] "!" 139 [email protected] "!"
133 [email protected] "[" 140 [email protected] "["
134 [email protected] 141 [email protected]
135 [email protected] 142 [email protected]
136 [email protected] 143 [email protected]
137 [email protected] "attr" 144 [email protected]
138 [email protected] 145 [email protected] "attr"
139 [email protected] "(" 146 [email protected]
140 [email protected] "\"hello\"" 147 [email protected] "("
141 [email protected] ")" 148 [email protected] "\"hello\""
149 [email protected] ")"
142 [email protected] "]" 150 [email protected] "]"
143 [email protected] "\n" 151 [email protected] "\n"
144 [email protected] 152 [email protected]
145 [email protected] "#" 153 [email protected] "#"
146 [email protected] "!" 154 [email protected] "!"
147 [email protected] "[" 155 [email protected] "["
148 [email protected] 156 [email protected]
149 [email protected] 157 [email protected]
150 [email protected] 158 [email protected]
151 [email protected] "repr" 159 [email protected]
152 [email protected] 160 [email protected] "repr"
153 [email protected] "(" 161 [email protected]
154 [email protected] "C" 162 [email protected] "("
155 [email protected] "," 163 [email protected] "C"
156 [email protected] " " 164 [email protected] ","
157 [email protected] "align" 165 [email protected] " "
158 [email protected] " " 166 [email protected] "align"
159 [email protected] "=" 167 [email protected] " "
160 [email protected] " " 168 [email protected] "="
161 [email protected] "4" 169 [email protected] " "
162 [email protected] ")" 170 [email protected] "4"
171 [email protected] ")"
163 [email protected] "]" 172 [email protected] "]"
164 [email protected] "\n" 173 [email protected] "\n"
165 [email protected] 174 [email protected]
166 [email protected] "#" 175 [email protected] "#"
167 [email protected] "!" 176 [email protected] "!"
168 [email protected] "[" 177 [email protected] "["
169 [email protected] 178 [email protected]
170 [email protected] 179 [email protected]
171 [email protected] 180 [email protected]
172 [email protected] "repr" 181 [email protected]
173 [email protected] 182 [email protected] "repr"
174 [email protected] "(" 183 [email protected]
175 [email protected] "C" 184 [email protected] "("
176 [email protected] "," 185 [email protected] "C"
177 [email protected] " " 186 [email protected] ","
178 [email protected] "align" 187 [email protected] " "
179 [email protected] 188 [email protected] "align"
180 [email protected] "(" 189 [email protected]
181 [email protected] "4" 190 [email protected] "("
182 [email protected] ")" 191 [email protected] "4"
183 [email protected] ")" 192 [email protected] ")"
193 [email protected] ")"
184 [email protected] "]" 194 [email protected] "]"
diff --git a/crates/syntax/test_data/parser/ok/0008_mod_item.rast b/crates/syntax/test_data/parser/ok/0008_mod_item.rast
index b2c1d791f..8b1e0a52d 100644
--- a/crates/syntax/test_data/parser/ok/0008_mod_item.rast
+++ b/crates/syntax/test_data/parser/ok/0008_mod_item.rast
@@ -65,10 +65,11 @@ [email protected]
65 [email protected] "#" 65 [email protected] "#"
66 [email protected] "!" 66 [email protected] "!"
67 [email protected] "[" 67 [email protected] "["
68 [email protected] 68 [email protected]
69 [email protected] 69 [email protected]
70 [email protected] 70 [email protected]
71 [email protected] "attr" 71 [email protected]
72 [email protected] "attr"
72 [email protected] "]" 73 [email protected] "]"
73 [email protected] "\n " 74 [email protected] "\n "
74 [email protected] 75 [email protected]
diff --git a/crates/syntax/test_data/parser/ok/0011_outer_attribute.rast b/crates/syntax/test_data/parser/ok/0011_outer_attribute.rast
index 478fdba75..ff5877a7b 100644
--- a/crates/syntax/test_data/parser/ok/0011_outer_attribute.rast
+++ b/crates/syntax/test_data/parser/ok/0011_outer_attribute.rast
@@ -3,23 +3,25 @@ [email protected]
3 [email protected] 3 [email protected]
4 [email protected] "#" 4 [email protected] "#"
5 [email protected] "[" 5 [email protected] "["
6 [email protected] 6 [email protected]
7 [email protected] 7 [email protected]
8 [email protected] 8 [email protected]
9 [email protected] "cfg" 9 [email protected]
10 [email protected] 10 [email protected] "cfg"
11 [email protected] "(" 11 [email protected]
12 [email protected] "test" 12 [email protected] "("
13 [email protected] ")" 13 [email protected] "test"
14 [email protected] ")"
14 [email protected] "]" 15 [email protected] "]"
15 [email protected] "\n" 16 [email protected] "\n"
16 [email protected] 17 [email protected]
17 [email protected] "#" 18 [email protected] "#"
18 [email protected] "[" 19 [email protected] "["
19 [email protected] 20 [email protected]
20 [email protected] 21 [email protected]
21 [email protected] 22 [email protected]
22 [email protected] "ignore" 23 [email protected]
24 [email protected] "ignore"
23 [email protected] "]" 25 [email protected] "]"
24 [email protected] "\n" 26 [email protected] "\n"
25 [email protected] "fn" 27 [email protected] "fn"
@@ -38,15 +40,16 @@ [email protected]
38 [email protected] 40 [email protected]
39 [email protected] "#" 41 [email protected] "#"
40 [email protected] "[" 42 [email protected] "["
41 [email protected] 43 [email protected]
42 [email protected] 44 [email protected]
43 [email protected] 45 [email protected]
44 [email protected] "path" 46 [email protected]
45 [email protected] " " 47 [email protected] "path"
46 [email protected] "=" 48 [email protected] " "
47 [email protected] " " 49 [email protected] "="
48 [email protected] 50 [email protected] " "
49 [email protected] "\"a.rs\"" 51 [email protected]
52 [email protected] "\"a.rs\""
50 [email protected] "]" 53 [email protected] "]"
51 [email protected] "\n" 54 [email protected] "\n"
52 [email protected] "mod" 55 [email protected] "mod"
diff --git a/crates/syntax/test_data/parser/ok/0017_attr_trailing_comma.rast b/crates/syntax/test_data/parser/ok/0017_attr_trailing_comma.rast
index a3e091ad3..94791f771 100644
--- a/crates/syntax/test_data/parser/ok/0017_attr_trailing_comma.rast
+++ b/crates/syntax/test_data/parser/ok/0017_attr_trailing_comma.rast
@@ -3,15 +3,16 @@ [email protected]
3 [email protected] 3 [email protected]
4 [email protected] "#" 4 [email protected] "#"
5 [email protected] "[" 5 [email protected] "["
6 [email protected] 6 [email protected]
7 [email protected] 7 [email protected]
8 [email protected] 8 [email protected]
9 [email protected] "foo" 9 [email protected]
10 [email protected] 10 [email protected] "foo"
11 [email protected] "(" 11 [email protected]
12 [email protected] "a" 12 [email protected] "("
13 [email protected] "," 13 [email protected] "a"
14 [email protected] ")" 14 [email protected] ","
15 [email protected] ")"
15 [email protected] "]" 16 [email protected] "]"
16 [email protected] "\n" 17 [email protected] "\n"
17 [email protected] "fn" 18 [email protected] "fn"
diff --git a/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast
index 46b192dc1..20675dbf5 100644
--- a/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast
+++ b/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast
@@ -11,71 +11,76 @@ [email protected]
11 [email protected] "#" 11 [email protected] "#"
12 [email protected] "!" 12 [email protected] "!"
13 [email protected] "[" 13 [email protected] "["
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 [email protected] 16 [email protected]
17 [email protected] "allow" 17 [email protected]
18 [email protected] 18 [email protected] "allow"
19 [email protected] "(" 19 [email protected]
20 [email protected] "non_camel_case_types" 20 [email protected] "("
21 [email protected] ")" 21 [email protected] "non_camel_case_types"
22 [email protected] ")"
22 [email protected] "]" 23 [email protected] "]"
23 [email protected] "\n" 24 [email protected] "\n"
24 [email protected] 25 [email protected]
25 [email protected] "#" 26 [email protected] "#"
26 [email protected] "!" 27 [email protected] "!"
27 [email protected] "[" 28 [email protected] "["
28 [email protected] 29 [email protected]
29 [email protected] 30 [email protected]
30 [email protected] 31 [email protected]
31 [email protected] "allow" 32 [email protected]
32 [email protected] 33 [email protected] "allow"
33 [email protected] "(" 34 [email protected]
34 [email protected] "dead_code" 35 [email protected] "("
35 [email protected] ")" 36 [email protected] "dead_code"
37 [email protected] ")"
36 [email protected] "]" 38 [email protected] "]"
37 [email protected] "\n" 39 [email protected] "\n"
38 [email protected] 40 [email protected]
39 [email protected] "#" 41 [email protected] "#"
40 [email protected] "!" 42 [email protected] "!"
41 [email protected] "[" 43 [email protected] "["
42 [email protected] 44 [email protected]
43 [email protected] 45 [email protected]
44 [email protected] 46 [email protected]
45 [email protected] "allow" 47 [email protected]
46 [email protected] 48 [email protected] "allow"
47 [email protected] "(" 49 [email protected]
48 [email protected] "unreachable_code" 50 [email protected] "("
49 [email protected] ")" 51 [email protected] "unreachable_code"
52 [email protected] ")"
50 [email protected] "]" 53 [email protected] "]"
51 [email protected] "\n" 54 [email protected] "\n"
52 [email protected] 55 [email protected]
53 [email protected] "#" 56 [email protected] "#"
54 [email protected] "!" 57 [email protected] "!"
55 [email protected] "[" 58 [email protected] "["
56 [email protected] 59 [email protected]
57 [email protected] 60 [email protected]
58 [email protected] 61 [email protected]
59 [email protected] "allow" 62 [email protected]
60 [email protected] 63 [email protected] "allow"
61 [email protected] "(" 64 [email protected]
62 [email protected] "unused_parens" 65 [email protected] "("
63 [email protected] ")" 66 [email protected] "unused_parens"
67 [email protected] ")"
64 [email protected] "]" 68 [email protected] "]"
65 [email protected] "\n\n" 69 [email protected] "\n\n"
66 [email protected] 70 [email protected]
67 [email protected] "#" 71 [email protected] "#"
68 [email protected] "!" 72 [email protected] "!"
69 [email protected] "[" 73 [email protected] "["
70 [email protected] 74 [email protected]
71 [email protected] 75 [email protected]
72 [email protected] 76 [email protected]
73 [email protected] "recursion_limit" 77 [email protected]
74 [email protected] " " 78 [email protected] "recursion_limit"
75 [email protected] "=" 79 [email protected] " "
76 [email protected] " " 80 [email protected] "="
77 [email protected] 81 [email protected] " "
78 [email protected] "\"128\"" 82 [email protected]
83 [email protected] "\"128\""
79 [email protected] "]" 84 [email protected] "]"
80 [email protected] "\n\n" 85 [email protected] "\n\n"
81 [email protected] 86 [email protected]
diff --git a/crates/syntax/test_data/parser/ok/0044_let_attrs.rast b/crates/syntax/test_data/parser/ok/0044_let_attrs.rast
index af44a4dbe..d0e7a1dbe 100644
--- a/crates/syntax/test_data/parser/ok/0044_let_attrs.rast
+++ b/crates/syntax/test_data/parser/ok/0044_let_attrs.rast
@@ -17,18 +17,19 @@ [email protected]
17 [email protected] 17 [email protected]
18 [email protected] "#" 18 [email protected] "#"
19 [email protected] "[" 19 [email protected] "["
20 [email protected] 20 [email protected]
21 [email protected] 21 [email protected]
22 [email protected] 22 [email protected]
23 [email protected] "cfg" 23 [email protected]
24 [email protected] 24 [email protected] "cfg"
25 [email protected] "(" 25 [email protected]
26 [email protected] "feature" 26 [email protected] "("
27 [email protected] " " 27 [email protected] "feature"
28 [email protected] "=" 28 [email protected] " "
29 [email protected] " " 29 [email protected] "="
30 [email protected] "\"backtrace\"" 30 [email protected] " "
31 [email protected] ")" 31 [email protected] "\"backtrace\""
32 [email protected] ")"
32 [email protected] "]" 33 [email protected] "]"
33 [email protected] "\n " 34 [email protected] "\n "
34 [email protected] "let" 35 [email protected] "let"
diff --git a/crates/syntax/test_data/parser/ok/0045_block_attrs.rast b/crates/syntax/test_data/parser/ok/0045_block_attrs.rast
index 5e50b4e0b..7fbd635d0 100644
--- a/crates/syntax/test_data/parser/ok/0045_block_attrs.rast
+++ b/crates/syntax/test_data/parser/ok/0045_block_attrs.rast
@@ -15,14 +15,15 @@ [email protected]
15 [email protected] "#" 15 [email protected] "#"
16 [email protected] "!" 16 [email protected] "!"
17 [email protected] "[" 17 [email protected] "["
18 [email protected] 18 [email protected]
19 [email protected] 19 [email protected]
20 [email protected] 20 [email protected]
21 [email protected] "doc" 21 [email protected]
22 [email protected] 22 [email protected] "doc"
23 [email protected] "(" 23 [email protected]
24 [email protected] "\"Inner attributes all ..." 24 [email protected] "("
25 [email protected] ")" 25 [email protected] "\"Inner attributes all ..."
26 [email protected] ")"
26 [email protected] "]" 27 [email protected] "]"
27 [email protected] "\n " 28 [email protected] "\n "
28 [email protected] "//! As are ModuleDoc ..." 29 [email protected] "//! As are ModuleDoc ..."
@@ -35,28 +36,30 @@ [email protected]
35 [email protected] "#" 36 [email protected] "#"
36 [email protected] "!" 37 [email protected] "!"
37 [email protected] "[" 38 [email protected] "["
38 [email protected] 39 [email protected]
39 [email protected] 40 [email protected]
40 [email protected] 41 [email protected]
41 [email protected] "doc" 42 [email protected]
42 [email protected] 43 [email protected] "doc"
43 [email protected] "(" 44 [email protected]
44 [email protected] "\"Inner attributes are ..." 45 [email protected] "("
45 [email protected] ")" 46 [email protected] "\"Inner attributes are ..."
47 [email protected] ")"
46 [email protected] "]" 48 [email protected] "]"
47 [email protected] "\n " 49 [email protected] "\n "
48 [email protected] 50 [email protected]
49 [email protected] "#" 51 [email protected] "#"
50 [email protected] "!" 52 [email protected] "!"
51 [email protected] "[" 53 [email protected] "["
52 [email protected] 54 [email protected]
53 [email protected] 55 [email protected]
54 [email protected] 56 [email protected]
55 [email protected] "doc" 57 [email protected]
56 [email protected] 58 [email protected] "doc"
57 [email protected] "(" 59 [email protected]
58 [email protected] "\"Being validated is n ..." 60 [email protected] "("
59 [email protected] ")" 61 [email protected] "\"Being validated is n ..."
62 [email protected] ")"
60 [email protected] "]" 63 [email protected] "]"
61 [email protected] "\n " 64 [email protected] "\n "
62 [email protected] "//! As are ModuleDoc ..." 65 [email protected] "//! As are ModuleDoc ..."
@@ -71,14 +74,15 @@ [email protected]
71 [email protected] "#" 74 [email protected] "#"
72 [email protected] "!" 75 [email protected] "!"
73 [email protected] "[" 76 [email protected] "["
74 [email protected] 77 [email protected]
75 [email protected] 78 [email protected]
76 [email protected] 79 [email protected]
77 [email protected] "doc" 80 [email protected]
78 [email protected] 81 [email protected] "doc"
79 [email protected] "(" 82 [email protected]
80 [email protected] "\"Inner attributes are ..." 83 [email protected] "("
81 [email protected] ")" 84 [email protected] "\"Inner attributes are ..."
85 [email protected] ")"
82 [email protected] "]" 86 [email protected] "]"
83 [email protected] "\n " 87 [email protected] "\n "
84 [email protected] "//! As are ModuleDoc ..." 88 [email protected] "//! As are ModuleDoc ..."
@@ -111,14 +115,15 @@ [email protected]
111 [email protected] 115 [email protected]
112 [email protected] "#" 116 [email protected] "#"
113 [email protected] "[" 117 [email protected] "["
114 [email protected] 118 [email protected]
115 [email protected] 119 [email protected]
116 [email protected] 120 [email protected]
117 [email protected] "doc" 121 [email protected]
118 [email protected] 122 [email protected] "doc"
119 [email protected] "(" 123 [email protected]
120 [email protected] "\"Outer attributes are ..." 124 [email protected] "("
121 [email protected] ")" 125 [email protected] "\"Outer attributes are ..."
126 [email protected] ")"
122 [email protected] "]" 127 [email protected] "]"
123 [email protected] " " 128 [email protected] " "
124 [email protected] "{" 129 [email protected] "{"
@@ -200,14 +205,15 @@ [email protected]
200 [email protected] "#" 205 [email protected] "#"
201 [email protected] "!" 206 [email protected] "!"
202 [email protected] "[" 207 [email protected] "["
203 [email protected] 208 [email protected]
204 [email protected] 209 [email protected]
205 [email protected] 210 [email protected]
206 [email protected] "allow" 211 [email protected]
207 [email protected] 212 [email protected] "allow"
208 [email protected] "(" 213 [email protected]
209 [email protected] "unused_variables" 214 [email protected] "("
210 [email protected] ")" 215 [email protected] "unused_variables"
216 [email protected] ")"
211 [email protected] "]" 217 [email protected] "]"
212 [email protected] " " 218 [email protected] " "
213 [email protected] "// this is `inner_at ..." 219 [email protected] "// this is `inner_at ..."
diff --git a/crates/syntax/test_data/parser/ok/0046_extern_inner_attributes.rast b/crates/syntax/test_data/parser/ok/0046_extern_inner_attributes.rast
index 37594769a..854ff9d56 100644
--- a/crates/syntax/test_data/parser/ok/0046_extern_inner_attributes.rast
+++ b/crates/syntax/test_data/parser/ok/0046_extern_inner_attributes.rast
@@ -14,14 +14,15 @@ [email protected]
14 [email protected] "#" 14 [email protected] "#"
15 [email protected] "!" 15 [email protected] "!"
16 [email protected] "[" 16 [email protected] "["
17 [email protected] 17 [email protected]
18 [email protected] 18 [email protected]
19 [email protected] 19 [email protected]
20 [email protected] "doc" 20 [email protected]
21 [email protected] 21 [email protected] "doc"
22 [email protected] "(" 22 [email protected]
23 [email protected] "\"This is also a doc c ..." 23 [email protected] "("
24 [email protected] ")" 24 [email protected] "\"This is also a doc c ..."
25 [email protected] ")"
25 [email protected] "]" 26 [email protected] "]"
26 [email protected] "\n" 27 [email protected] "\n"
27 [email protected] "}" 28 [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 88470c41c..f935a0df5 100644
--- a/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast
+++ b/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast
@@ -10,19 +10,21 @@ [email protected]
10 [email protected] 10 [email protected]
11 [email protected] "#" 11 [email protected] "#"
12 [email protected] "[" 12 [email protected] "["
13 [email protected] 13 [email protected]
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 [email protected] "attr1" 16 [email protected]
17 [email protected] "attr1"
17 [email protected] "]" 18 [email protected] "]"
18 [email protected] " " 19 [email protected] " "
19 [email protected] 20 [email protected]
20 [email protected] "#" 21 [email protected] "#"
21 [email protected] "[" 22 [email protected] "["
22 [email protected] 23 [email protected]
23 [email protected] 24 [email protected]
24 [email protected] 25 [email protected]
25 [email protected] "attr2" 26 [email protected]
27 [email protected] "attr2"
26 [email protected] "]" 28 [email protected] "]"
27 [email protected] " " 29 [email protected] " "
28 [email protected] 30 [email protected]
@@ -52,10 +54,11 @@ [email protected]
52 [email protected] 54 [email protected]
53 [email protected] "#" 55 [email protected] "#"
54 [email protected] "[" 56 [email protected] "["
55 [email protected] 57 [email protected]
56 [email protected] 58 [email protected]
57 [email protected] 59 [email protected]
58 [email protected] "attr1" 60 [email protected]
61 [email protected] "attr1"
59 [email protected] "]" 62 [email protected] "]"
60 [email protected] " " 63 [email protected] " "
61 [email protected] 64 [email protected]
@@ -111,10 +114,11 @@ [email protected]
111 [email protected] 114 [email protected]
112 [email protected] "#" 115 [email protected] "#"
113 [email protected] "[" 116 [email protected] "["
114 [email protected] 117 [email protected]
115 [email protected] 118 [email protected]
116 [email protected] 119 [email protected]
117 [email protected] "attr" 120 [email protected]
121 [email protected] "attr"
118 [email protected] "]" 122 [email protected] "]"
119 [email protected] " " 123 [email protected] " "
120 [email protected] "..." 124 [email protected] "..."
@@ -157,10 +161,11 @@ [email protected]
157 [email protected] 161 [email protected]
158 [email protected] "#" 162 [email protected] "#"
159 [email protected] "[" 163 [email protected] "["
160 [email protected] 164 [email protected]
161 [email protected] 165 [email protected]
162 [email protected] 166 [email protected]
163 [email protected] "attr" 167 [email protected]
168 [email protected] "attr"
164 [email protected] "]" 169 [email protected] "]"
165 [email protected] " " 170 [email protected] " "
166 [email protected] 171 [email protected]
@@ -207,10 +212,11 @@ [email protected]
207 [email protected] 212 [email protected]
208 [email protected] "#" 213 [email protected] "#"
209 [email protected] "[" 214 [email protected] "["
210 [email protected] 215 [email protected]
211 [email protected] 216 [email protected]
212 [email protected] 217 [email protected]
213 [email protected] "attr" 218 [email protected]
219 [email protected] "attr"
214 [email protected] "]" 220 [email protected] "]"
215 [email protected] " " 221 [email protected] " "
216 [email protected] 222 [email protected]
@@ -229,10 +235,11 @@ [email protected]
229 [email protected] "#" 235 [email protected] "#"
230 [email protected] " " 236 [email protected] " "
231 [email protected] "[" 237 [email protected] "["
232 [email protected] 238 [email protected]
233 [email protected] 239 [email protected]
234 [email protected] 240 [email protected]
235 [email protected] "attr" 241 [email protected]
242 [email protected] "attr"
236 [email protected] "]" 243 [email protected] "]"
237 [email protected] " " 244 [email protected] " "
238 [email protected] 245 [email protected]
@@ -275,10 +282,11 @@ [email protected]
275 [email protected] 282 [email protected]
276 [email protected] "#" 283 [email protected] "#"
277 [email protected] "[" 284 [email protected] "["
278 [email protected] 285 [email protected]
279 [email protected] 286 [email protected]
280 [email protected] 287 [email protected]
281 [email protected] "must_use" 288 [email protected]
289 [email protected] "must_use"
282 [email protected] "]" 290 [email protected] "]"
283 [email protected] " " 291 [email protected] " "
284 [email protected] 292 [email protected]
@@ -300,10 +308,11 @@ [email protected]
300 [email protected] 308 [email protected]
301 [email protected] "#" 309 [email protected] "#"
302 [email protected] "[" 310 [email protected] "["
303 [email protected] 311 [email protected]
304 [email protected] 312 [email protected]
305 [email protected] 313 [email protected]
306 [email protected] "attr" 314 [email protected]
315 [email protected] "attr"
307 [email protected] "]" 316 [email protected] "]"
308 [email protected] " " 317 [email protected] " "
309 [email protected] 318 [email protected]
@@ -325,10 +334,11 @@ [email protected]
325 [email protected] 334 [email protected]
326 [email protected] "#" 335 [email protected] "#"
327 [email protected] "[" 336 [email protected] "["
328 [email protected] 337 [email protected]
329 [email protected] 338 [email protected]
330 [email protected] 339 [email protected]
331 [email protected] "attr" 340 [email protected]
341 [email protected] "attr"
332 [email protected] "]" 342 [email protected] "]"
333 [email protected] " " 343 [email protected] " "
334 [email protected] "&" 344 [email protected] "&"
@@ -357,10 +367,11 @@ [email protected]
357 [email protected] 367 [email protected]
358 [email protected] "#" 368 [email protected] "#"
359 [email protected] "[" 369 [email protected] "["
360 [email protected] 370 [email protected]
361 [email protected] 371 [email protected]
362 [email protected] 372 [email protected]
363 [email protected] "attr" 373 [email protected]
374 [email protected] "attr"
364 [email protected] "]" 375 [email protected] "]"
365 [email protected] " " 376 [email protected] " "
366 [email protected] "&" 377 [email protected] "&"
@@ -391,10 +402,11 @@ [email protected]
391 [email protected] 402 [email protected]
392 [email protected] "#" 403 [email protected] "#"
393 [email protected] "[" 404 [email protected] "["
394 [email protected] 405 [email protected]
395 [email protected] 406 [email protected]
396 [email protected] 407 [email protected]
397 [email protected] "attr" 408 [email protected]
409 [email protected] "attr"
398 [email protected] "]" 410 [email protected] "]"
399 [email protected] " " 411 [email protected] " "
400 [email protected] "&" 412 [email protected] "&"
@@ -426,10 +438,11 @@ [email protected]
426 [email protected] 438 [email protected]
427 [email protected] "#" 439 [email protected] "#"
428 [email protected] "[" 440 [email protected] "["
429 [email protected] 441 [email protected]
430 [email protected] 442 [email protected]
431 [email protected] 443 [email protected]
432 [email protected] "attr" 444 [email protected]
445 [email protected] "attr"
433 [email protected] "]" 446 [email protected] "]"
434 [email protected] " " 447 [email protected] " "
435 [email protected] "&" 448 [email protected] "&"
@@ -457,10 +470,11 @@ [email protected]
457 [email protected] 470 [email protected]
458 [email protected] "#" 471 [email protected] "#"
459 [email protected] "[" 472 [email protected] "["
460 [email protected] 473 [email protected]
461 [email protected] 474 [email protected]
462 [email protected] 475 [email protected]
463 [email protected] "attr" 476 [email protected]
477 [email protected] "attr"
464 [email protected] "]" 478 [email protected] "]"
465 [email protected] " " 479 [email protected] " "
466 [email protected] 480 [email protected]
@@ -489,10 +503,11 @@ [email protected]
489 [email protected] 503 [email protected]
490 [email protected] "#" 504 [email protected] "#"
491 [email protected] "[" 505 [email protected] "["
492 [email protected] 506 [email protected]
493 [email protected] 507 [email protected]
494 [email protected] 508 [email protected]
495 [email protected] "attr" 509 [email protected]
510 [email protected] "attr"
496 [email protected] "]" 511 [email protected] "]"
497 [email protected] " " 512 [email protected] " "
498 [email protected] 513 [email protected]
diff --git a/crates/syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast b/crates/syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast
index 87d8ebcba..97416f16a 100644
--- a/crates/syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast
+++ b/crates/syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast
@@ -5,10 +5,11 @@ [email protected]
5 [email protected] 5 [email protected]
6 [email protected] "#" 6 [email protected] "#"
7 [email protected] "[" 7 [email protected] "["
8 [email protected] 8 [email protected]
9 [email protected] 9 [email protected]
10 [email protected] 10 [email protected]
11 [email protected] "macro_export" 11 [email protected]
12 [email protected] "macro_export"
12 [email protected] "]" 13 [email protected] "]"
13 [email protected] "\n" 14 [email protected] "\n"
14 [email protected] "macro_rules" 15 [email protected] "macro_rules"
diff --git a/crates/syntax/test_data/parser/ok/0062_macro_2.0.rast b/crates/syntax/test_data/parser/ok/0062_macro_2.0.rast
index 0c22c31a4..e75848f0f 100644
--- a/crates/syntax/test_data/parser/ok/0062_macro_2.0.rast
+++ b/crates/syntax/test_data/parser/ok/0062_macro_2.0.rast
@@ -55,10 +55,11 @@ [email protected]
55 [email protected] 55 [email protected]
56 [email protected] "#" 56 [email protected] "#"
57 [email protected] "[" 57 [email protected] "["
58 [email protected] 58 [email protected]
59 [email protected] 59 [email protected]
60 [email protected] 60 [email protected]
61 [email protected] "test" 61 [email protected]
62 [email protected] "test"
62 [email protected] "]" 63 [email protected] "]"
63 [email protected] "\n" 64 [email protected] "\n"
64 [email protected] "fn" 65 [email protected] "fn"
diff --git a/crates/syntax/test_data/parser/ok/0063_variadic_fun.rast b/crates/syntax/test_data/parser/ok/0063_variadic_fun.rast
index f7c094898..dcc4105c9 100644
--- a/crates/syntax/test_data/parser/ok/0063_variadic_fun.rast
+++ b/crates/syntax/test_data/parser/ok/0063_variadic_fun.rast
@@ -96,14 +96,15 @@ [email protected]
96 [email protected] 96 [email protected]
97 [email protected] "#" 97 [email protected] "#"
98 [email protected] "[" 98 [email protected] "["
99 [email protected] 99 [email protected]
100 [email protected] 100 [email protected]
101 [email protected] 101 [email protected]
102 [email protected] "cfg" 102 [email protected]
103 [email protected] 103 [email protected] "cfg"
104 [email protected] "(" 104 [email protected]
105 [email protected] "never" 105 [email protected] "("
106 [email protected] ")" 106 [email protected] "never"
107 [email protected] ")"
107 [email protected] "]" 108 [email protected] "]"
108 [email protected] " " 109 [email protected] " "
109 [email protected] 110 [email protected]
diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml
index 997770958..c4fc91386 100644
--- a/xtask/Cargo.toml
+++ b/xtask/Cargo.toml
@@ -11,7 +11,7 @@ anyhow = "1.0.26"
11flate2 = "1.0" 11flate2 = "1.0"
12proc-macro2 = "1.0.8" 12proc-macro2 = "1.0.8"
13quote = "1.0.2" 13quote = "1.0.2"
14ungrammar = "=1.13" 14ungrammar = "=1.14"
15walkdir = "2.3.1" 15walkdir = "2.3.1"
16write-json = "0.1.0" 16write-json = "0.1.0"
17xshell = "0.1" 17xshell = "0.1"
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs
index 0fd1d13e6..fe37d0245 100644
--- a/xtask/src/ast_src.rs
+++ b/xtask/src/ast_src.rs
@@ -184,7 +184,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
184 "ITEM_LIST", 184 "ITEM_LIST",
185 "ASSOC_ITEM_LIST", 185 "ASSOC_ITEM_LIST",
186 "ATTR", 186 "ATTR",
187 "META_ITEM", // not an item actually 187 "META",
188 "USE_TREE", 188 "USE_TREE",
189 "USE_TREE_LIST", 189 "USE_TREE_LIST",
190 "PATH", 190 "PATH",