aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/item_tree
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/item_tree')
-rw-r--r--crates/ra_hir_def/src/item_tree/lower.rs15
-rw-r--r--crates/ra_hir_def/src/item_tree/tests.rs8
2 files changed, 15 insertions, 8 deletions
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs
index b1847a6cb..6e31266a2 100644
--- a/crates/ra_hir_def/src/item_tree/lower.rs
+++ b/crates/ra_hir_def/src/item_tree/lower.rs
@@ -325,7 +325,7 @@ impl Ctx {
325 generic_params: GenericParamsId::EMPTY, 325 generic_params: GenericParamsId::EMPTY,
326 has_self_param, 326 has_self_param,
327 is_unsafe: func.unsafe_token().is_some(), 327 is_unsafe: func.unsafe_token().is_some(),
328 params, 328 params: params.into_boxed_slice(),
329 ret_type, 329 ret_type,
330 ast_id, 330 ast_id,
331 }; 331 };
@@ -344,7 +344,14 @@ impl Ctx {
344 let bounds = self.lower_type_bounds(type_alias); 344 let bounds = self.lower_type_bounds(type_alias);
345 let generic_params = self.lower_generic_params(GenericsOwner::TypeAlias, type_alias); 345 let generic_params = self.lower_generic_params(GenericsOwner::TypeAlias, type_alias);
346 let ast_id = self.source_ast_id_map.ast_id(type_alias); 346 let ast_id = self.source_ast_id_map.ast_id(type_alias);
347 let res = TypeAlias { name, visibility, bounds, generic_params, type_ref, ast_id }; 347 let res = TypeAlias {
348 name,
349 visibility,
350 bounds: bounds.into_boxed_slice(),
351 generic_params,
352 type_ref,
353 ast_id,
354 };
348 Some(id(self.data().type_aliases.alloc(res))) 355 Some(id(self.data().type_aliases.alloc(res)))
349 } 356 }
350 357
@@ -384,7 +391,7 @@ impl Ctx {
384 }) 391 })
385 .unwrap_or_else(|| { 392 .unwrap_or_else(|| {
386 mark::hit!(name_res_works_for_broken_modules); 393 mark::hit!(name_res_works_for_broken_modules);
387 Vec::new() 394 Box::new([]) as Box<[_]>
388 }), 395 }),
389 } 396 }
390 }; 397 };
@@ -552,7 +559,7 @@ impl Ctx {
552 GenericsOwner::Function(func) => { 559 GenericsOwner::Function(func) => {
553 generics.fill(&self.body_ctx, sm, node); 560 generics.fill(&self.body_ctx, sm, node);
554 // lower `impl Trait` in arguments 561 // lower `impl Trait` in arguments
555 for param in &func.params { 562 for param in &*func.params {
556 generics.fill_implicit_impl_trait_args(param); 563 generics.fill_implicit_impl_trait_args(param);
557 } 564 }
558 } 565 }
diff --git a/crates/ra_hir_def/src/item_tree/tests.rs b/crates/ra_hir_def/src/item_tree/tests.rs
index b72f0f47b..cd4c8a199 100644
--- a/crates/ra_hir_def/src/item_tree/tests.rs
+++ b/crates/ra_hir_def/src/item_tree/tests.rs
@@ -31,7 +31,7 @@ fn test_inner_items(ra_fixture: &str) {
31 ModItem::TypeAlias(it) => tree.source(&db, InFile::new(file_id, it)).into(), 31 ModItem::TypeAlias(it) => tree.source(&db, InFile::new(file_id, it)).into(),
32 ModItem::Mod(it) => { 32 ModItem::Mod(it) => {
33 if let ModKind::Inline { items } = &tree[it].kind { 33 if let ModKind::Inline { items } = &tree[it].kind {
34 worklist.extend(items); 34 worklist.extend(&**items);
35 } 35 }
36 tree.source(&db, InFile::new(file_id, it)).into() 36 tree.source(&db, InFile::new(file_id, it)).into()
37 } 37 }
@@ -125,14 +125,14 @@ fn fmt_mod_item(out: &mut String, tree: &ItemTree, item: ModItem) {
125 } 125 }
126 ModItem::Trait(it) => { 126 ModItem::Trait(it) => {
127 format_to!(out, "{:?}", tree[it]); 127 format_to!(out, "{:?}", tree[it]);
128 for item in &tree[it].items { 128 for item in &*tree[it].items {
129 fmt_mod_item(&mut children, tree, ModItem::from(*item)); 129 fmt_mod_item(&mut children, tree, ModItem::from(*item));
130 format_to!(children, "\n"); 130 format_to!(children, "\n");
131 } 131 }
132 } 132 }
133 ModItem::Impl(it) => { 133 ModItem::Impl(it) => {
134 format_to!(out, "{:?}", tree[it]); 134 format_to!(out, "{:?}", tree[it]);
135 for item in &tree[it].items { 135 for item in &*tree[it].items {
136 fmt_mod_item(&mut children, tree, ModItem::from(*item)); 136 fmt_mod_item(&mut children, tree, ModItem::from(*item));
137 format_to!(children, "\n"); 137 format_to!(children, "\n");
138 } 138 }
@@ -144,7 +144,7 @@ fn fmt_mod_item(out: &mut String, tree: &ItemTree, item: ModItem) {
144 format_to!(out, "{:?}", tree[it]); 144 format_to!(out, "{:?}", tree[it]);
145 match &tree[it].kind { 145 match &tree[it].kind {
146 ModKind::Inline { items } => { 146 ModKind::Inline { items } => {
147 for item in items { 147 for item in &**items {
148 fmt_mod_item(&mut children, tree, *item); 148 fmt_mod_item(&mut children, tree, *item);
149 format_to!(children, "\n"); 149 format_to!(children, "\n");
150 } 150 }