diff options
Diffstat (limited to 'crates')
76 files changed, 1425 insertions, 900 deletions
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 debc3ee62..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()), |
@@ -1450,6 +1451,20 @@ impl AssocItem { | |||
1450 | _ => None, | 1451 | _ => None, |
1451 | } | 1452 | } |
1452 | } | 1453 | } |
1454 | |||
1455 | pub fn containing_trait_impl(self, db: &dyn HirDatabase) -> Option<Trait> { | ||
1456 | match self.container(db) { | ||
1457 | AssocItemContainer::Impl(i) => i.trait_(db), | ||
1458 | _ => None, | ||
1459 | } | ||
1460 | } | ||
1461 | |||
1462 | pub fn containing_trait_or_trait_impl(self, db: &dyn HirDatabase) -> Option<Trait> { | ||
1463 | match self.container(db) { | ||
1464 | AssocItemContainer::Trait(t) => Some(t), | ||
1465 | AssocItemContainer::Impl(i) => i.trait_(db), | ||
1466 | } | ||
1467 | } | ||
1453 | } | 1468 | } |
1454 | 1469 | ||
1455 | impl HasVisibility for AssocItem { | 1470 | impl HasVisibility for AssocItem { |
@@ -2185,6 +2200,7 @@ impl Type { | |||
2185 | name: Option<&Name>, | 2200 | name: Option<&Name>, |
2186 | mut callback: impl FnMut(&Ty, Function) -> Option<T>, | 2201 | mut callback: impl FnMut(&Ty, Function) -> Option<T>, |
2187 | ) -> Option<T> { | 2202 | ) -> Option<T> { |
2203 | let _p = profile::span("iterate_method_candidates"); | ||
2188 | // There should be no inference vars in types passed here | 2204 | // There should be no inference vars in types passed here |
2189 | // FIXME check that? | 2205 | // FIXME check that? |
2190 | // FIXME replace Unknown by bound vars here | 2206 | // FIXME replace Unknown by bound vars here |
@@ -2218,6 +2234,7 @@ impl Type { | |||
2218 | name: Option<&Name>, | 2234 | name: Option<&Name>, |
2219 | mut callback: impl FnMut(&Ty, AssocItem) -> Option<T>, | 2235 | mut callback: impl FnMut(&Ty, AssocItem) -> Option<T>, |
2220 | ) -> Option<T> { | 2236 | ) -> Option<T> { |
2237 | let _p = profile::span("iterate_path_candidates"); | ||
2221 | let canonical = hir_ty::replace_errors_with_variables(&self.ty); | 2238 | let canonical = hir_ty::replace_errors_with_variables(&self.ty); |
2222 | 2239 | ||
2223 | let env = self.env.clone(); | 2240 | let env = self.env.clone(); |
@@ -2255,6 +2272,7 @@ impl Type { | |||
2255 | &'a self, | 2272 | &'a self, |
2256 | db: &'a dyn HirDatabase, | 2273 | db: &'a dyn HirDatabase, |
2257 | ) -> impl Iterator<Item = Trait> + 'a { | 2274 | ) -> impl Iterator<Item = Trait> + 'a { |
2275 | let _p = profile::span("applicable_inherent_traits"); | ||
2258 | self.autoderef(db) | 2276 | self.autoderef(db) |
2259 | .filter_map(|derefed_type| derefed_type.ty.dyn_trait()) | 2277 | .filter_map(|derefed_type| derefed_type.ty.dyn_trait()) |
2260 | .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 { | |||
664 | impl Attr { | 665 | impl 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 | ||
3 | use std::{cmp::Ordering, fmt, hash::BuildHasherDefault, sync::Arc}; | 3 | use std::{fmt, hash::BuildHasherDefault, sync::Arc}; |
4 | 4 | ||
5 | use base_db::CrateId; | 5 | use base_db::CrateId; |
6 | use fst::{self, Streamer}; | 6 | use fst::{self, Streamer}; |
@@ -69,81 +69,11 @@ pub struct ImportMap { | |||
69 | impl ImportMap { | 69 | impl 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 | ||
144 | fn 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 | |||
213 | impl PartialEq for ImportMap { | 222 | impl 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 | ||
242 | fn fst_path(path: &ImportPath) -> String { | 251 | fn 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 | ||
248 | fn 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)] |
255 | pub enum ImportKind { | 259 | pub 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/goto_implementation.rs b/crates/ide/src/goto_implementation.rs index 43356a94e..95fd39850 100644 --- a/crates/ide/src/goto_implementation.rs +++ b/crates/ide/src/goto_implementation.rs | |||
@@ -52,13 +52,13 @@ pub(crate) fn goto_implementation( | |||
52 | hir::ModuleDef::Function(f) => { | 52 | hir::ModuleDef::Function(f) => { |
53 | let assoc = f.as_assoc_item(sema.db)?; | 53 | let assoc = f.as_assoc_item(sema.db)?; |
54 | let name = assoc.name(sema.db)?; | 54 | let name = assoc.name(sema.db)?; |
55 | let trait_ = assoc.containing_trait(sema.db)?; | 55 | let trait_ = assoc.containing_trait_or_trait_impl(sema.db)?; |
56 | impls_for_trait_item(&sema, trait_, name) | 56 | impls_for_trait_item(&sema, trait_, name) |
57 | } | 57 | } |
58 | hir::ModuleDef::Const(c) => { | 58 | hir::ModuleDef::Const(c) => { |
59 | let assoc = c.as_assoc_item(sema.db)?; | 59 | let assoc = c.as_assoc_item(sema.db)?; |
60 | let name = assoc.name(sema.db)?; | 60 | let name = assoc.name(sema.db)?; |
61 | let trait_ = assoc.containing_trait(sema.db)?; | 61 | let trait_ = assoc.containing_trait_or_trait_impl(sema.db)?; |
62 | impls_for_trait_item(&sema, trait_, name) | 62 | impls_for_trait_item(&sema, trait_, name) |
63 | } | 63 | } |
64 | _ => return None, | 64 | _ => return None, |
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 | ||
210 | fn try_hover_for_attribute(token: &SyntaxToken) -> Option<RangeInfo<HoverResult>> { | 210 | fn 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/rename.rs b/crates/ide/src/references/rename.rs index 2a4a1c3c8..7dfc5043e 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs | |||
@@ -239,7 +239,7 @@ fn rename_mod( | |||
239 | 239 | ||
240 | fn rename_reference( | 240 | fn rename_reference( |
241 | sema: &Semantics<RootDatabase>, | 241 | sema: &Semantics<RootDatabase>, |
242 | def: Definition, | 242 | mut def: Definition, |
243 | new_name: &str, | 243 | new_name: &str, |
244 | ) -> RenameResult<SourceChange> { | 244 | ) -> RenameResult<SourceChange> { |
245 | let ident_kind = check_identifier(new_name)?; | 245 | let ident_kind = check_identifier(new_name)?; |
@@ -285,7 +285,38 @@ fn rename_reference( | |||
285 | } | 285 | } |
286 | } | 286 | } |
287 | 287 | ||
288 | def = match def { | ||
289 | // HACK: resolve trait impl items to the item def of the trait definition | ||
290 | // so that we properly resolve all trait item references | ||
291 | Definition::ModuleDef(mod_def) => mod_def | ||
292 | .as_assoc_item(sema.db) | ||
293 | .and_then(|it| it.containing_trait_impl(sema.db)) | ||
294 | .and_then(|it| { | ||
295 | it.items(sema.db).into_iter().find_map(|it| match (it, mod_def) { | ||
296 | (hir::AssocItem::Function(trait_func), ModuleDef::Function(func)) | ||
297 | if trait_func.name(sema.db) == func.name(sema.db) => | ||
298 | { | ||
299 | Some(Definition::ModuleDef(ModuleDef::Function(trait_func))) | ||
300 | } | ||
301 | (hir::AssocItem::Const(trait_konst), ModuleDef::Const(konst)) | ||
302 | if trait_konst.name(sema.db) == konst.name(sema.db) => | ||
303 | { | ||
304 | Some(Definition::ModuleDef(ModuleDef::Const(trait_konst))) | ||
305 | } | ||
306 | ( | ||
307 | hir::AssocItem::TypeAlias(trait_type_alias), | ||
308 | ModuleDef::TypeAlias(type_alias), | ||
309 | ) if trait_type_alias.name(sema.db) == type_alias.name(sema.db) => { | ||
310 | Some(Definition::ModuleDef(ModuleDef::TypeAlias(trait_type_alias))) | ||
311 | } | ||
312 | _ => None, | ||
313 | }) | ||
314 | }) | ||
315 | .unwrap_or(def), | ||
316 | _ => def, | ||
317 | }; | ||
288 | let usages = def.usages(sema).all(); | 318 | let usages = def.usages(sema).all(); |
319 | |||
289 | if !usages.is_empty() && ident_kind == IdentifierKind::Underscore { | 320 | if !usages.is_empty() && ident_kind == IdentifierKind::Underscore { |
290 | cov_mark::hit!(rename_underscore_multiple); | 321 | cov_mark::hit!(rename_underscore_multiple); |
291 | bail!("Cannot rename reference to `_` as it is being referenced multiple times"); | 322 | bail!("Cannot rename reference to `_` as it is being referenced multiple times"); |
@@ -1938,4 +1969,136 @@ use Bar$0; | |||
1938 | "error: Renaming aliases is currently unsupported", | 1969 | "error: Renaming aliases is currently unsupported", |
1939 | ); | 1970 | ); |
1940 | } | 1971 | } |
1972 | |||
1973 | #[test] | ||
1974 | fn test_rename_trait_method() { | ||
1975 | let res = r" | ||
1976 | trait Foo { | ||
1977 | fn foo(&self) { | ||
1978 | self.foo(); | ||
1979 | } | ||
1980 | } | ||
1981 | |||
1982 | impl Foo for () { | ||
1983 | fn foo(&self) { | ||
1984 | self.foo(); | ||
1985 | } | ||
1986 | }"; | ||
1987 | check( | ||
1988 | "foo", | ||
1989 | r#" | ||
1990 | trait Foo { | ||
1991 | fn bar$0(&self) { | ||
1992 | self.bar(); | ||
1993 | } | ||
1994 | } | ||
1995 | |||
1996 | impl Foo for () { | ||
1997 | fn bar(&self) { | ||
1998 | self.bar(); | ||
1999 | } | ||
2000 | }"#, | ||
2001 | res, | ||
2002 | ); | ||
2003 | check( | ||
2004 | "foo", | ||
2005 | r#" | ||
2006 | trait Foo { | ||
2007 | fn bar(&self) { | ||
2008 | self.bar$0(); | ||
2009 | } | ||
2010 | } | ||
2011 | |||
2012 | impl Foo for () { | ||
2013 | fn bar(&self) { | ||
2014 | self.bar(); | ||
2015 | } | ||
2016 | }"#, | ||
2017 | res, | ||
2018 | ); | ||
2019 | check( | ||
2020 | "foo", | ||
2021 | r#" | ||
2022 | trait Foo { | ||
2023 | fn bar(&self) { | ||
2024 | self.bar(); | ||
2025 | } | ||
2026 | } | ||
2027 | |||
2028 | impl Foo for () { | ||
2029 | fn bar$0(&self) { | ||
2030 | self.bar(); | ||
2031 | } | ||
2032 | }"#, | ||
2033 | res, | ||
2034 | ); | ||
2035 | check( | ||
2036 | "foo", | ||
2037 | r#" | ||
2038 | trait Foo { | ||
2039 | fn bar(&self) { | ||
2040 | self.bar(); | ||
2041 | } | ||
2042 | } | ||
2043 | |||
2044 | impl Foo for () { | ||
2045 | fn bar(&self) { | ||
2046 | self.bar$0(); | ||
2047 | } | ||
2048 | }"#, | ||
2049 | res, | ||
2050 | ); | ||
2051 | } | ||
2052 | |||
2053 | #[test] | ||
2054 | fn test_rename_trait_const() { | ||
2055 | let res = r" | ||
2056 | trait Foo { | ||
2057 | const FOO: (); | ||
2058 | } | ||
2059 | |||
2060 | impl Foo for () { | ||
2061 | const FOO: (); | ||
2062 | } | ||
2063 | fn f() { <()>::FOO; }"; | ||
2064 | check( | ||
2065 | "FOO", | ||
2066 | r#" | ||
2067 | trait Foo { | ||
2068 | const BAR$0: (); | ||
2069 | } | ||
2070 | |||
2071 | impl Foo for () { | ||
2072 | const BAR: (); | ||
2073 | } | ||
2074 | fn f() { <()>::BAR; }"#, | ||
2075 | res, | ||
2076 | ); | ||
2077 | check( | ||
2078 | "FOO", | ||
2079 | r#" | ||
2080 | trait Foo { | ||
2081 | const BAR: (); | ||
2082 | } | ||
2083 | |||
2084 | impl Foo for () { | ||
2085 | const BAR$0: (); | ||
2086 | } | ||
2087 | fn f() { <()>::BAR; }"#, | ||
2088 | res, | ||
2089 | ); | ||
2090 | check( | ||
2091 | "FOO", | ||
2092 | r#" | ||
2093 | trait Foo { | ||
2094 | const BAR: (); | ||
2095 | } | ||
2096 | |||
2097 | impl Foo for () { | ||
2098 | const BAR: (); | ||
2099 | } | ||
2100 | fn f() { <()>::BAR$0; }"#, | ||
2101 | res, | ||
2102 | ); | ||
2103 | } | ||
1941 | } | 2104 | } |
diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 9503c936d..84012227d 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs | |||
@@ -131,6 +131,9 @@ pub(super) fn element( | |||
131 | } | 131 | } |
132 | STRING | BYTE_STRING => HlTag::StringLiteral.into(), | 132 | STRING | BYTE_STRING => HlTag::StringLiteral.into(), |
133 | ATTR => HlTag::Attribute.into(), | 133 | ATTR => HlTag::Attribute.into(), |
134 | INT_NUMBER if element.ancestors().nth(1).map_or(false, |it| it.kind() == FIELD_EXPR) => { | ||
135 | SymbolKind::Field.into() | ||
136 | } | ||
134 | INT_NUMBER | FLOAT_NUMBER => HlTag::NumericLiteral.into(), | 137 | INT_NUMBER | FLOAT_NUMBER => HlTag::NumericLiteral.into(), |
135 | BYTE => HlTag::ByteLiteral.into(), | 138 | BYTE => HlTag::ByteLiteral.into(), |
136 | CHAR => HlTag::CharLiteral.into(), | 139 | CHAR => HlTag::CharLiteral.into(), |
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index a7b5c3b89..59f1e8e4c 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html | |||
@@ -215,8 +215,8 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
215 | <span class="keyword">let</span> <span class="variable callable declaration">a</span> <span class="operator">=</span> <span class="punctuation">|</span><span class="value_param declaration">x</span><span class="punctuation">|</span> <span class="value_param">x</span><span class="semicolon">;</span> | 215 | <span class="keyword">let</span> <span class="variable callable declaration">a</span> <span class="operator">=</span> <span class="punctuation">|</span><span class="value_param declaration">x</span><span class="punctuation">|</span> <span class="value_param">x</span><span class="semicolon">;</span> |
216 | <span class="keyword">let</span> <span class="variable callable declaration">bar</span> <span class="operator">=</span> <span class="struct">Foo</span><span class="operator">::</span><span class="function associated">baz</span><span class="semicolon">;</span> | 216 | <span class="keyword">let</span> <span class="variable callable declaration">bar</span> <span class="operator">=</span> <span class="struct">Foo</span><span class="operator">::</span><span class="function associated">baz</span><span class="semicolon">;</span> |
217 | 217 | ||
218 | <span class="keyword">let</span> <span class="variable declaration">baz</span> <span class="operator">=</span> <span class="numeric_literal">-</span><span class="numeric_literal">42</span><span class="semicolon">;</span> | 218 | <span class="keyword">let</span> <span class="variable declaration">baz</span> <span class="operator">=</span> <span class="parenthesis">(</span><span class="numeric_literal">-</span><span class="numeric_literal">42</span><span class="comma">,</span><span class="parenthesis">)</span><span class="semicolon">;</span> |
219 | <span class="keyword">let</span> <span class="variable declaration">baz</span> <span class="operator">=</span> <span class="operator">-</span><span class="variable">baz</span><span class="semicolon">;</span> | 219 | <span class="keyword">let</span> <span class="variable declaration">baz</span> <span class="operator">=</span> <span class="operator">-</span><span class="variable">baz</span><span class="operator">.</span><span class="field">0</span><span class="semicolon">;</span> |
220 | 220 | ||
221 | <span class="keyword">let</span> <span class="punctuation">_</span> <span class="operator">=</span> <span class="logical">!</span><span class="bool_literal">true</span><span class="semicolon">;</span> | 221 | <span class="keyword">let</span> <span class="punctuation">_</span> <span class="operator">=</span> <span class="logical">!</span><span class="bool_literal">true</span><span class="semicolon">;</span> |
222 | 222 | ||
diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs index 6ad2a362a..f7d8334a0 100644 --- a/crates/ide/src/syntax_highlighting/tests.rs +++ b/crates/ide/src/syntax_highlighting/tests.rs | |||
@@ -189,8 +189,8 @@ fn main() { | |||
189 | let a = |x| x; | 189 | let a = |x| x; |
190 | let bar = Foo::baz; | 190 | let bar = Foo::baz; |
191 | 191 | ||
192 | let baz = -42; | 192 | let baz = (-42,); |
193 | let baz = -baz; | 193 | let baz = -baz.0; |
194 | 194 | ||
195 | let _ = !true; | 195 | let _ = !true; |
196 | 196 | ||
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 @@ | |||
1 | use syntax::{ | 1 | use 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#" | ||
274 | trait Trait { | ||
275 | fn foo(x: i32); | ||
276 | } | ||
277 | impl 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/completions.rs b/crates/ide_completion/src/completions.rs index fbd499900..bd90cefb2 100644 --- a/crates/ide_completion/src/completions.rs +++ b/crates/ide_completion/src/completions.rs | |||
@@ -29,7 +29,7 @@ use crate::{ | |||
29 | macro_::render_macro, | 29 | macro_::render_macro, |
30 | pattern::{render_struct_pat, render_variant_pat}, | 30 | pattern::{render_struct_pat, render_variant_pat}, |
31 | render_field, render_resolution, render_tuple_field, | 31 | render_field, render_resolution, render_tuple_field, |
32 | type_alias::render_type_alias, | 32 | type_alias::{render_type_alias, render_type_alias_with_eq}, |
33 | RenderContext, | 33 | RenderContext, |
34 | }, | 34 | }, |
35 | CompletionContext, CompletionItem, CompletionItemKind, | 35 | CompletionContext, CompletionItem, CompletionItemKind, |
@@ -188,6 +188,14 @@ impl Completions { | |||
188 | self.add_opt(render_type_alias(RenderContext::new(ctx), type_alias)); | 188 | self.add_opt(render_type_alias(RenderContext::new(ctx), type_alias)); |
189 | } | 189 | } |
190 | 190 | ||
191 | pub(crate) fn add_type_alias_with_eq( | ||
192 | &mut self, | ||
193 | ctx: &CompletionContext, | ||
194 | type_alias: hir::TypeAlias, | ||
195 | ) { | ||
196 | self.add_opt(render_type_alias_with_eq(RenderContext::new(ctx), type_alias)); | ||
197 | } | ||
198 | |||
191 | pub(crate) fn add_qualified_enum_variant( | 199 | pub(crate) fn add_qualified_enum_variant( |
192 | &mut self, | 200 | &mut self, |
193 | ctx: &CompletionContext, | 201 | ctx: &CompletionContext, |
diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs index b1e6b2b77..952f052a1 100644 --- a/crates/ide_completion/src/completions/unqualified_path.rs +++ b/crates/ide_completion/src/completions/unqualified_path.rs | |||
@@ -1,8 +1,9 @@ | |||
1 | //! Completion of names from the current scope, e.g. locals and imported items. | 1 | //! Completion of names from the current scope, e.g. locals and imported items. |
2 | 2 | ||
3 | use hir::ScopeDef; | 3 | use hir::ScopeDef; |
4 | use syntax::{ast, AstNode}; | ||
4 | 5 | ||
5 | use crate::{CompletionContext, Completions}; | 6 | use crate::{patterns::ImmediateLocation, CompletionContext, Completions}; |
6 | 7 | ||
7 | pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionContext) { | 8 | pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionContext) { |
8 | if ctx.is_path_disallowed() || !ctx.is_trivial_path() { | 9 | if ctx.is_path_disallowed() || !ctx.is_trivial_path() { |
@@ -43,6 +44,20 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC | |||
43 | }); | 44 | }); |
44 | } | 45 | } |
45 | 46 | ||
47 | if let Some(ImmediateLocation::GenericArgList(arg_list)) = &ctx.completion_location { | ||
48 | if let Some(path_seg) = arg_list.syntax().parent().and_then(ast::PathSegment::cast) { | ||
49 | if let Some(hir::PathResolution::Def(hir::ModuleDef::Trait(trait_))) = | ||
50 | ctx.sema.resolve_path(&path_seg.parent_path()) | ||
51 | { | ||
52 | trait_.items(ctx.sema.db).into_iter().for_each(|it| { | ||
53 | if let hir::AssocItem::TypeAlias(alias) = it { | ||
54 | acc.add_type_alias_with_eq(ctx, alias) | ||
55 | } | ||
56 | }); | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | |||
46 | ctx.scope.process_all_names(&mut |name, res| { | 61 | ctx.scope.process_all_names(&mut |name, res| { |
47 | if let ScopeDef::GenericParam(hir::GenericParam::LifetimeParam(_)) = res { | 62 | if let ScopeDef::GenericParam(hir::GenericParam::LifetimeParam(_)) = res { |
48 | cov_mark::hit!(skip_lifetime_completion); | 63 | cov_mark::hit!(skip_lifetime_completion); |
@@ -777,4 +792,21 @@ $0 | |||
777 | "#]], | 792 | "#]], |
778 | ) | 793 | ) |
779 | } | 794 | } |
795 | |||
796 | #[test] | ||
797 | fn completes_assoc_types_in_dynimpl_trait() { | ||
798 | check( | ||
799 | r#" | ||
800 | trait Foo { | ||
801 | type Bar; | ||
802 | } | ||
803 | |||
804 | fn foo(_: impl Foo<B$0>) {} | ||
805 | "#, | ||
806 | expect![[r#" | ||
807 | ta Bar = type Bar; | ||
808 | tt Foo | ||
809 | "#]], | ||
810 | ); | ||
811 | } | ||
780 | } | 812 | } |
diff --git a/crates/ide_completion/src/patterns.rs b/crates/ide_completion/src/patterns.rs index ee87bf461..81d7a1a1d 100644 --- a/crates/ide_completion/src/patterns.rs +++ b/crates/ide_completion/src/patterns.rs | |||
@@ -47,6 +47,9 @@ pub(crate) enum ImmediateLocation { | |||
47 | receiver_is_ambiguous_float_literal: bool, | 47 | receiver_is_ambiguous_float_literal: bool, |
48 | }, | 48 | }, |
49 | // Original file ast node | 49 | // Original file ast node |
50 | // Only set from a type arg | ||
51 | GenericArgList(ast::GenericArgList), | ||
52 | // Original file ast node | ||
50 | /// The record expr of the field name we are completing | 53 | /// The record expr of the field name we are completing |
51 | RecordExpr(ast::RecordExpr), | 54 | RecordExpr(ast::RecordExpr), |
52 | // Original file ast node | 55 | // Original file ast node |
@@ -159,7 +162,6 @@ pub(crate) fn determine_location( | |||
159 | } | 162 | } |
160 | } | 163 | } |
161 | }; | 164 | }; |
162 | |||
163 | let res = match_ast! { | 165 | let res = match_ast! { |
164 | match parent { | 166 | match parent { |
165 | ast::IdentPat(_it) => ImmediateLocation::IdentPat, | 167 | ast::IdentPat(_it) => ImmediateLocation::IdentPat, |
@@ -174,6 +176,9 @@ pub(crate) fn determine_location( | |||
174 | Some(TRAIT) => ImmediateLocation::Trait, | 176 | Some(TRAIT) => ImmediateLocation::Trait, |
175 | _ => return None, | 177 | _ => return None, |
176 | }, | 178 | }, |
179 | ast::GenericArgList(_it) => sema | ||
180 | .find_node_at_offset_with_macros(original_file, offset) | ||
181 | .map(ImmediateLocation::GenericArgList)?, | ||
177 | ast::Module(it) => { | 182 | ast::Module(it) => { |
178 | if it.item_list().is_none() { | 183 | if it.item_list().is_none() { |
179 | ImmediateLocation::ModDeclaration(it) | 184 | ImmediateLocation::ModDeclaration(it) |
diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs index 902df46ca..d3db55c35 100644 --- a/crates/ide_completion/src/render.rs +++ b/crates/ide_completion/src/render.rs | |||
@@ -111,7 +111,10 @@ impl<'a> RenderContext<'a> { | |||
111 | hir::AssocItem::TypeAlias(it) => self.is_deprecated(it), | 111 | hir::AssocItem::TypeAlias(it) => self.is_deprecated(it), |
112 | }; | 112 | }; |
113 | is_assoc_deprecated | 113 | is_assoc_deprecated |
114 | || assoc.containing_trait(db).map(|trait_| self.is_deprecated(trait_)).unwrap_or(false) | 114 | || assoc |
115 | .containing_trait_or_trait_impl(db) | ||
116 | .map(|trait_| self.is_deprecated(trait_)) | ||
117 | .unwrap_or(false) | ||
115 | } | 118 | } |
116 | 119 | ||
117 | fn docs(&self, node: impl HasAttrs) -> Option<hir::Documentation> { | 120 | fn docs(&self, node: impl HasAttrs) -> Option<hir::Documentation> { |
@@ -132,16 +135,17 @@ fn render_field_( | |||
132 | ctx.source_range(), | 135 | ctx.source_range(), |
133 | receiver.map_or_else(|| name.clone(), |receiver| format!("{}.{}", receiver, name)), | 136 | receiver.map_or_else(|| name.clone(), |receiver| format!("{}.{}", receiver, name)), |
134 | ); | 137 | ); |
135 | item.kind(SymbolKind::Field) | ||
136 | .detail(ty.display(ctx.db()).to_string()) | ||
137 | .set_documentation(field.docs(ctx.db())) | ||
138 | .set_deprecated(is_deprecated); | ||
139 | 138 | ||
140 | item.set_relevance(CompletionRelevance { | 139 | item.set_relevance(CompletionRelevance { |
141 | type_match: compute_type_match(ctx.completion, ty), | 140 | type_match: compute_type_match(ctx.completion, ty), |
142 | exact_name_match: compute_exact_name_match(ctx.completion, &name), | 141 | exact_name_match: compute_exact_name_match(ctx.completion, &name), |
143 | ..CompletionRelevance::default() | 142 | ..CompletionRelevance::default() |
144 | }); | 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); | ||
145 | 149 | ||
146 | if let Some(_ref_match) = compute_ref_match(ctx.completion, ty) { | 150 | if let Some(_ref_match) = compute_ref_match(ctx.completion, ty) { |
147 | // FIXME | 151 | // FIXME |
@@ -164,7 +168,9 @@ fn render_tuple_field_( | |||
164 | receiver.map_or_else(|| field.to_string(), |receiver| format!("{}.{}", receiver, field)), | 168 | receiver.map_or_else(|| field.to_string(), |receiver| format!("{}.{}", receiver, field)), |
165 | ); | 169 | ); |
166 | 170 | ||
167 | 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()); | ||
168 | 174 | ||
169 | item.build() | 175 | item.build() |
170 | } | 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#" |
268 | struct S {} | 268 | struct S {} |
269 | impl S { | 269 | impl S { |
diff --git a/crates/ide_completion/src/render/type_alias.rs b/crates/ide_completion/src/render/type_alias.rs index e47b4c745..e0234171a 100644 --- a/crates/ide_completion/src/render/type_alias.rs +++ b/crates/ide_completion/src/render/type_alias.rs | |||
@@ -16,7 +16,14 @@ pub(crate) fn render_type_alias<'a>( | |||
16 | ctx: RenderContext<'a>, | 16 | ctx: RenderContext<'a>, |
17 | type_alias: hir::TypeAlias, | 17 | type_alias: hir::TypeAlias, |
18 | ) -> Option<CompletionItem> { | 18 | ) -> Option<CompletionItem> { |
19 | TypeAliasRender::new(ctx, type_alias)?.render() | 19 | TypeAliasRender::new(ctx, type_alias)?.render(false) |
20 | } | ||
21 | |||
22 | pub(crate) fn render_type_alias_with_eq<'a>( | ||
23 | ctx: RenderContext<'a>, | ||
24 | type_alias: hir::TypeAlias, | ||
25 | ) -> Option<CompletionItem> { | ||
26 | TypeAliasRender::new(ctx, type_alias)?.render(true) | ||
20 | } | 27 | } |
21 | 28 | ||
22 | #[derive(Debug)] | 29 | #[derive(Debug)] |
@@ -32,8 +39,14 @@ impl<'a> TypeAliasRender<'a> { | |||
32 | Some(TypeAliasRender { ctx, type_alias, ast_node }) | 39 | Some(TypeAliasRender { ctx, type_alias, ast_node }) |
33 | } | 40 | } |
34 | 41 | ||
35 | fn render(self) -> Option<CompletionItem> { | 42 | fn render(self, with_eq: bool) -> Option<CompletionItem> { |
36 | let name = self.name()?; | 43 | let name = self.ast_node.name().map(|name| { |
44 | if with_eq { | ||
45 | format!("{} = ", name.text()) | ||
46 | } else { | ||
47 | name.text().to_string() | ||
48 | } | ||
49 | })?; | ||
37 | let detail = self.detail(); | 50 | let detail = self.detail(); |
38 | 51 | ||
39 | let mut item = | 52 | let mut item = |
@@ -49,10 +62,6 @@ impl<'a> TypeAliasRender<'a> { | |||
49 | Some(item.build()) | 62 | Some(item.build()) |
50 | } | 63 | } |
51 | 64 | ||
52 | fn name(&self) -> Option<String> { | ||
53 | self.ast_node.name().map(|name| name.text().to_string()) | ||
54 | } | ||
55 | |||
56 | fn detail(&self) -> String { | 65 | fn detail(&self) -> String { |
57 | type_label(&self.ast_node) | 66 | type_label(&self.ast_node) |
58 | } | 67 | } |
diff --git a/crates/ide_db/src/defs.rs b/crates/ide_db/src/defs.rs index 1b69d72f9..a54f2c323 100644 --- a/crates/ide_db/src/defs.rs +++ b/crates/ide_db/src/defs.rs | |||
@@ -369,7 +369,7 @@ impl NameRefClass { | |||
369 | } | 369 | } |
370 | 370 | ||
371 | if let Some(resolved) = sema.resolve_path(&path) { | 371 | if let Some(resolved) = sema.resolve_path(&path) { |
372 | if path.syntax().parent().and_then(ast::Attr::cast).is_some() { | 372 | if path.syntax().ancestors().find_map(ast::Attr::cast).is_some() { |
373 | if let PathResolution::Def(ModuleDef::Function(func)) = resolved { | 373 | if let PathResolution::Def(ModuleDef::Function(func)) = resolved { |
374 | if func.attrs(sema.db).by_key("proc_macro_attribute").exists() { | 374 | if func.attrs(sema.db).by_key("proc_macro_attribute").exists() { |
375 | return Some(NameRefClass::Definition(resolved.into())); | 375 | return Some(NameRefClass::Definition(resolved.into())); |
diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs index 67840602b..8152630f5 100644 --- a/crates/ide_db/src/search.rs +++ b/crates/ide_db/src/search.rs | |||
@@ -8,7 +8,8 @@ use std::{convert::TryInto, mem}; | |||
8 | 8 | ||
9 | use base_db::{FileId, FileRange, SourceDatabase, SourceDatabaseExt}; | 9 | use base_db::{FileId, FileRange, SourceDatabase, SourceDatabaseExt}; |
10 | use hir::{ | 10 | use hir::{ |
11 | DefWithBody, HasAttrs, HasSource, InFile, ModuleDef, ModuleSource, Semantics, Visibility, | 11 | AsAssocItem, DefWithBody, HasAttrs, HasSource, InFile, ModuleDef, ModuleSource, Semantics, |
12 | Visibility, | ||
12 | }; | 13 | }; |
13 | use once_cell::unsync::Lazy; | 14 | use once_cell::unsync::Lazy; |
14 | use rustc_hash::FxHashMap; | 15 | use rustc_hash::FxHashMap; |
@@ -303,13 +304,13 @@ impl Definition { | |||
303 | } | 304 | } |
304 | } | 305 | } |
305 | 306 | ||
306 | pub fn usages<'a>(&'a self, sema: &'a Semantics<RootDatabase>) -> FindUsages<'a> { | 307 | pub fn usages<'a>(self, sema: &'a Semantics<RootDatabase>) -> FindUsages<'a> { |
307 | FindUsages { def: self, sema, scope: None, include_self_kw_refs: None } | 308 | FindUsages { def: self, sema, scope: None, include_self_kw_refs: None } |
308 | } | 309 | } |
309 | } | 310 | } |
310 | 311 | ||
311 | pub struct FindUsages<'a> { | 312 | pub struct FindUsages<'a> { |
312 | def: &'a Definition, | 313 | def: Definition, |
313 | sema: &'a Semantics<'a, RootDatabase>, | 314 | sema: &'a Semantics<'a, RootDatabase>, |
314 | scope: Option<SearchScope>, | 315 | scope: Option<SearchScope>, |
315 | include_self_kw_refs: Option<hir::Type>, | 316 | include_self_kw_refs: Option<hir::Type>, |
@@ -318,7 +319,7 @@ pub struct FindUsages<'a> { | |||
318 | impl<'a> FindUsages<'a> { | 319 | impl<'a> FindUsages<'a> { |
319 | /// Enable searching for `Self` when the definition is a type. | 320 | /// Enable searching for `Self` when the definition is a type. |
320 | pub fn include_self_refs(mut self) -> FindUsages<'a> { | 321 | pub fn include_self_refs(mut self) -> FindUsages<'a> { |
321 | self.include_self_kw_refs = def_to_ty(self.sema, self.def); | 322 | self.include_self_kw_refs = def_to_ty(self.sema, &self.def); |
322 | self | 323 | self |
323 | } | 324 | } |
324 | 325 | ||
@@ -445,7 +446,7 @@ impl<'a> FindUsages<'a> { | |||
445 | sink: &mut dyn FnMut(FileId, FileReference) -> bool, | 446 | sink: &mut dyn FnMut(FileId, FileReference) -> bool, |
446 | ) -> bool { | 447 | ) -> bool { |
447 | match NameRefClass::classify_lifetime(self.sema, lifetime) { | 448 | match NameRefClass::classify_lifetime(self.sema, lifetime) { |
448 | Some(NameRefClass::Definition(def)) if &def == self.def => { | 449 | Some(NameRefClass::Definition(def)) if def == self.def => { |
449 | let FileRange { file_id, range } = self.sema.original_range(lifetime.syntax()); | 450 | let FileRange { file_id, range } = self.sema.original_range(lifetime.syntax()); |
450 | let reference = FileReference { | 451 | let reference = FileReference { |
451 | range, | 452 | range, |
@@ -464,7 +465,7 @@ impl<'a> FindUsages<'a> { | |||
464 | sink: &mut dyn FnMut(FileId, FileReference) -> bool, | 465 | sink: &mut dyn FnMut(FileId, FileReference) -> bool, |
465 | ) -> bool { | 466 | ) -> bool { |
466 | match NameRefClass::classify(self.sema, &name_ref) { | 467 | match NameRefClass::classify(self.sema, &name_ref) { |
467 | Some(NameRefClass::Definition(def)) if &def == self.def => { | 468 | Some(NameRefClass::Definition(def)) if def == self.def => { |
468 | let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax()); | 469 | let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax()); |
469 | let reference = FileReference { | 470 | let reference = FileReference { |
470 | range, | 471 | range, |
@@ -489,10 +490,10 @@ impl<'a> FindUsages<'a> { | |||
489 | Some(NameRefClass::FieldShorthand { local_ref: local, field_ref: field }) => { | 490 | Some(NameRefClass::FieldShorthand { local_ref: local, field_ref: field }) => { |
490 | let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax()); | 491 | let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax()); |
491 | let access = match self.def { | 492 | let access = match self.def { |
492 | Definition::Field(_) if &field == self.def => { | 493 | Definition::Field(_) if field == self.def => { |
493 | reference_access(&field, &name_ref) | 494 | reference_access(&field, &name_ref) |
494 | } | 495 | } |
495 | Definition::Local(l) if &local == l => { | 496 | Definition::Local(l) if local == l => { |
496 | reference_access(&Definition::Local(local), &name_ref) | 497 | reference_access(&Definition::Local(local), &name_ref) |
497 | } | 498 | } |
498 | _ => return false, | 499 | _ => return false, |
@@ -513,7 +514,7 @@ impl<'a> FindUsages<'a> { | |||
513 | match NameClass::classify(self.sema, name) { | 514 | match NameClass::classify(self.sema, name) { |
514 | Some(NameClass::PatFieldShorthand { local_def: _, field_ref }) | 515 | Some(NameClass::PatFieldShorthand { local_def: _, field_ref }) |
515 | if matches!( | 516 | if matches!( |
516 | self.def, Definition::Field(_) if &field_ref == self.def | 517 | self.def, Definition::Field(_) if field_ref == self.def |
517 | ) => | 518 | ) => |
518 | { | 519 | { |
519 | let FileRange { file_id, range } = self.sema.original_range(name.syntax()); | 520 | let FileRange { file_id, range } = self.sema.original_range(name.syntax()); |
@@ -525,12 +526,38 @@ impl<'a> FindUsages<'a> { | |||
525 | }; | 526 | }; |
526 | sink(file_id, reference) | 527 | sink(file_id, reference) |
527 | } | 528 | } |
528 | Some(NameClass::ConstReference(def)) if *self.def == def => { | 529 | Some(NameClass::ConstReference(def)) if self.def == def => { |
529 | let FileRange { file_id, range } = self.sema.original_range(name.syntax()); | 530 | let FileRange { file_id, range } = self.sema.original_range(name.syntax()); |
530 | let reference = | 531 | let reference = |
531 | FileReference { range, name: ast::NameLike::Name(name.clone()), access: None }; | 532 | FileReference { range, name: ast::NameLike::Name(name.clone()), access: None }; |
532 | sink(file_id, reference) | 533 | sink(file_id, reference) |
533 | } | 534 | } |
535 | // Resolve trait impl function definitions to the trait definition's version if self.def is the trait definition's | ||
536 | Some(NameClass::Definition(Definition::ModuleDef(mod_def))) => { | ||
537 | /* poor man's try block */ | ||
538 | (|| { | ||
539 | let this = match self.def { | ||
540 | Definition::ModuleDef(this) if this != mod_def => this, | ||
541 | _ => return None, | ||
542 | }; | ||
543 | let this_trait = this | ||
544 | .as_assoc_item(self.sema.db)? | ||
545 | .containing_trait_or_trait_impl(self.sema.db)?; | ||
546 | let trait_ = mod_def | ||
547 | .as_assoc_item(self.sema.db)? | ||
548 | .containing_trait_or_trait_impl(self.sema.db)?; | ||
549 | (trait_ == this_trait).then(|| { | ||
550 | let FileRange { file_id, range } = self.sema.original_range(name.syntax()); | ||
551 | let reference = FileReference { | ||
552 | range, | ||
553 | name: ast::NameLike::Name(name.clone()), | ||
554 | access: None, | ||
555 | }; | ||
556 | sink(file_id, reference) | ||
557 | }) | ||
558 | })() | ||
559 | .unwrap_or(false) | ||
560 | } | ||
534 | _ => false, | 561 | _ => false, |
535 | } | 562 | } |
536 | } | 563 | } |
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 | ||
199 | pub fn crate_symbols(db: &RootDatabase, krate: CrateId, query: Query) -> Vec<FileSymbol> { | 199 | pub 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 | ||
322 | impl Query { | 323 | impl 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 | ||
15 | pub(super) fn meta(p: &mut Parser) { | 15 | pub(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 | ||
30 | fn attr(p: &mut Parser, inner: bool) { | 33 | fn 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)] |
190 | fn ensure_file_with_lock_free_access(path: &Path) -> io::Result<PathBuf> { | 190 | fn 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; | |||
7 | use std::str::FromStr; | 7 | use std::str::FromStr; |
8 | 8 | ||
9 | pub mod fixtures { | 9 | pub 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] |
10 | doctest = false | 10 | doctest = false |
11 | proc-macro = true | 11 | |
12 | [build-dependencies] | ||
13 | proc_macro_test_impl = { path = "imp", version = "0.0.0" } | ||
14 | toolchain = { path = "../toolchain", version = "0.0.0" } | ||
15 | cargo_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 | |||
6 | use std::{ | ||
7 | env, fs, | ||
8 | path::{Path, PathBuf}, | ||
9 | process::Command, | ||
10 | }; | ||
11 | |||
12 | use cargo_metadata::Message; | ||
13 | |||
14 | fn 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 @@ | |||
1 | target/ | ||
2 | Cargo.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] | ||
2 | name = "proc_macro_test_impl" | ||
3 | version = "0.0.0" | ||
4 | license = "MIT OR Apache-2.0" | ||
5 | authors = ["rust-analyzer developers"] | ||
6 | edition = "2018" | ||
7 | publish = false | ||
8 | |||
9 | [lib] | ||
10 | doctest = false | ||
11 | proc-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 | |||
3 | use proc_macro::TokenStream; | ||
4 | |||
5 | #[proc_macro] | ||
6 | pub fn fn_like_noop(args: TokenStream) -> TokenStream { | ||
7 | args | ||
8 | } | ||
9 | |||
10 | #[proc_macro] | ||
11 | pub fn fn_like_panic(args: TokenStream) -> TokenStream { | ||
12 | panic!("fn_like_panic!({})", args); | ||
13 | } | ||
14 | |||
15 | #[proc_macro] | ||
16 | pub fn fn_like_error(args: TokenStream) -> TokenStream { | ||
17 | format!("compile_error!(\"fn_like_error!({})\");", args).parse().unwrap() | ||
18 | } | ||
19 | |||
20 | #[proc_macro_attribute] | ||
21 | pub fn attr_noop(_args: TokenStream, item: TokenStream) -> TokenStream { | ||
22 | item | ||
23 | } | ||
24 | |||
25 | #[proc_macro_attribute] | ||
26 | pub fn attr_panic(args: TokenStream, item: TokenStream) -> TokenStream { | ||
27 | panic!("#[attr_panic {}] {}", args, item); | ||
28 | } | ||
29 | |||
30 | #[proc_macro_attribute] | ||
31 | pub 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)] | ||
36 | pub fn derive_empty(_item: TokenStream) -> TokenStream { | ||
37 | TokenStream::new() | ||
38 | } | ||
39 | |||
40 | #[proc_macro_derive(DerivePanic)] | ||
41 | pub fn derive_panic(item: TokenStream) -> TokenStream { | ||
42 | panic!("#[derive(DerivePanic)] {}", item); | ||
43 | } | ||
44 | |||
45 | #[proc_macro_derive(DeriveError)] | ||
46 | pub 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 | ||
3 | use proc_macro::TokenStream; | 3 | pub static PROC_MACRO_TEST_LOCATION: &str = |
4 | 4 | include_str!(concat!(env!("OUT_DIR"), "/proc_macro_test_location.txt")); | |
5 | #[proc_macro] | ||
6 | pub fn fn_like_noop(args: TokenStream) -> TokenStream { | ||
7 | args | ||
8 | } | ||
9 | |||
10 | #[proc_macro] | ||
11 | pub fn fn_like_panic(args: TokenStream) -> TokenStream { | ||
12 | panic!("fn_like_panic!({})", args); | ||
13 | } | ||
14 | |||
15 | #[proc_macro] | ||
16 | pub fn fn_like_error(args: TokenStream) -> TokenStream { | ||
17 | format!("compile_error!(\"fn_like_error!({})\");", args).parse().unwrap() | ||
18 | } | ||
19 | |||
20 | #[proc_macro_attribute] | ||
21 | pub fn attr_noop(_args: TokenStream, item: TokenStream) -> TokenStream { | ||
22 | item | ||
23 | } | ||
24 | |||
25 | #[proc_macro_attribute] | ||
26 | pub fn attr_panic(args: TokenStream, item: TokenStream) -> TokenStream { | ||
27 | panic!("#[attr_panic {}] {}", args, item); | ||
28 | } | ||
29 | |||
30 | #[proc_macro_attribute] | ||
31 | pub 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)] | ||
36 | pub fn derive_empty(_item: TokenStream) -> TokenStream { | ||
37 | TokenStream::new() | ||
38 | } | ||
39 | |||
40 | #[proc_macro_derive(DerivePanic)] | ||
41 | pub fn derive_panic(item: TokenStream) -> TokenStream { | ||
42 | panic!("#[derive(DerivePanic)] {}", item); | ||
43 | } | ||
44 | |||
45 | #[proc_macro_derive(DeriveError)] | ||
46 | pub fn derive_error(item: TokenStream) -> TokenStream { | ||
47 | format!("compile_error!(\"#[derive(DeriveError)] {}\");", item).parse().unwrap() | ||
48 | } | ||
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; | |||
16 | pub use self::{ | 16 | pub 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 | ||
15 | use crate::reload::{ProjectFolders, SourceRootConfig}; | 15 | use crate::reload::{ProjectFolders, SourceRootConfig}; |
16 | 16 | ||
17 | pub struct LoadCargoConfig { | 17 | pub(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 | ||
23 | pub fn load_workspace_at( | 24 | pub(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 | ||
36 | pub fn load_workspace( | 37 | fn 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)] |
632 | pub struct Meta { | ||
633 | pub(crate) syntax: SyntaxNode, | ||
634 | } | ||
635 | impl 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)] | ||
635 | pub struct ExprStmt { | 642 | pub 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 | } |
2082 | impl 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 | } | ||
2075 | impl AstNode for ExprStmt { | 2093 | impl 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 | } |
3908 | impl 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 | } | ||
3890 | impl std::fmt::Display for ExprStmt { | 3913 | impl 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 | ||
145 | impl ast::Attr { | 145 | impl 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" |
57 | error 53..53: expected R_PAREN | 59 | error 53..53: expected R_PAREN |
58 | error 53..53: expected `]` | 60 | error 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] |