diff options
Diffstat (limited to 'crates/hir_def/src/item_tree/lower.rs')
-rw-r--r-- | crates/hir_def/src/item_tree/lower.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs index 6a503d785..54814f141 100644 --- a/crates/hir_def/src/item_tree/lower.rs +++ b/crates/hir_def/src/item_tree/lower.rs | |||
@@ -364,6 +364,7 @@ impl Ctx { | |||
364 | generic_params, | 364 | generic_params, |
365 | type_ref, | 365 | type_ref, |
366 | ast_id, | 366 | ast_id, |
367 | is_extern: false, | ||
367 | }; | 368 | }; |
368 | Some(id(self.data().type_aliases.alloc(res))) | 369 | Some(id(self.data().type_aliases.alloc(res))) |
369 | } | 370 | } |
@@ -482,7 +483,7 @@ impl Ctx { | |||
482 | ModPath::expand_use_item( | 483 | ModPath::expand_use_item( |
483 | InFile::new(self.file, use_item.clone()), | 484 | InFile::new(self.file, use_item.clone()), |
484 | &self.hygiene, | 485 | &self.hygiene, |
485 | |path, _tree, is_glob, alias| { | 486 | |path, _use_tree, is_glob, alias| { |
486 | imports.push(id(tree.imports.alloc(Import { | 487 | imports.push(id(tree.imports.alloc(Import { |
487 | path, | 488 | path, |
488 | alias, | 489 | alias, |
@@ -490,6 +491,7 @@ impl Ctx { | |||
490 | is_glob, | 491 | is_glob, |
491 | is_prelude, | 492 | is_prelude, |
492 | ast_id, | 493 | ast_id, |
494 | index: imports.len(), | ||
493 | }))); | 495 | }))); |
494 | }, | 496 | }, |
495 | ); | 497 | ); |
@@ -501,7 +503,7 @@ impl Ctx { | |||
501 | &mut self, | 503 | &mut self, |
502 | extern_crate: &ast::ExternCrate, | 504 | extern_crate: &ast::ExternCrate, |
503 | ) -> Option<FileItemTreeId<ExternCrate>> { | 505 | ) -> Option<FileItemTreeId<ExternCrate>> { |
504 | let path = ModPath::from_name_ref(&extern_crate.name_ref()?); | 506 | let name = extern_crate.name_ref()?.as_name(); |
505 | let alias = extern_crate.rename().map(|a| { | 507 | let alias = extern_crate.rename().map(|a| { |
506 | a.name().map(|it| it.as_name()).map_or(ImportAlias::Underscore, ImportAlias::Alias) | 508 | a.name().map(|it| it.as_name()).map_or(ImportAlias::Underscore, ImportAlias::Alias) |
507 | }); | 509 | }); |
@@ -510,7 +512,7 @@ impl Ctx { | |||
510 | // FIXME: cfg_attr | 512 | // FIXME: cfg_attr |
511 | let is_macro_use = extern_crate.has_atom_attr("macro_use"); | 513 | let is_macro_use = extern_crate.has_atom_attr("macro_use"); |
512 | 514 | ||
513 | let res = ExternCrate { path, alias, visibility, is_macro_use, ast_id }; | 515 | let res = ExternCrate { name, alias, visibility, is_macro_use, ast_id }; |
514 | Some(id(self.data().extern_crates.alloc(res))) | 516 | Some(id(self.data().extern_crates.alloc(res))) |
515 | } | 517 | } |
516 | 518 | ||
@@ -558,8 +560,9 @@ impl Ctx { | |||
558 | statik.into() | 560 | statik.into() |
559 | } | 561 | } |
560 | ast::ExternItem::TypeAlias(ty) => { | 562 | ast::ExternItem::TypeAlias(ty) => { |
561 | let id = self.lower_type_alias(&ty)?; | 563 | let foreign_ty = self.lower_type_alias(&ty)?; |
562 | id.into() | 564 | self.data().type_aliases[foreign_ty.index].is_extern = true; |
565 | foreign_ty.into() | ||
563 | } | 566 | } |
564 | ast::ExternItem::MacroCall(_) => return None, | 567 | ast::ExternItem::MacroCall(_) => return None, |
565 | }; | 568 | }; |