aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/item_tree/lower.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/item_tree/lower.rs')
-rw-r--r--crates/hir_def/src/item_tree/lower.rs13
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 ca7fb4a43..63b2826f8 100644
--- a/crates/hir_def/src/item_tree/lower.rs
+++ b/crates/hir_def/src/item_tree/lower.rs
@@ -340,6 +340,7 @@ impl Ctx {
340 has_self_param, 340 has_self_param,
341 has_body, 341 has_body,
342 is_unsafe: func.unsafe_token().is_some(), 342 is_unsafe: func.unsafe_token().is_some(),
343 is_extern: false,
343 params: params.into_boxed_slice(), 344 params: params.into_boxed_slice(),
344 is_varargs, 345 is_varargs,
345 ret_type, 346 ret_type,
@@ -378,7 +379,7 @@ impl Ctx {
378 let visibility = self.lower_visibility(static_); 379 let visibility = self.lower_visibility(static_);
379 let mutable = static_.mut_token().is_some(); 380 let mutable = static_.mut_token().is_some();
380 let ast_id = self.source_ast_id_map.ast_id(static_); 381 let ast_id = self.source_ast_id_map.ast_id(static_);
381 let res = Static { name, visibility, mutable, type_ref, ast_id }; 382 let res = Static { name, visibility, mutable, type_ref, ast_id, is_extern: false };
382 Some(id(self.data().statics.alloc(res))) 383 Some(id(self.data().statics.alloc(res)))
383 } 384 }
384 385
@@ -554,13 +555,15 @@ impl Ctx {
554 let attrs = Attrs::new(&item, &self.hygiene); 555 let attrs = Attrs::new(&item, &self.hygiene);
555 let id: ModItem = match item { 556 let id: ModItem = match item {
556 ast::ExternItem::Fn(ast) => { 557 ast::ExternItem::Fn(ast) => {
557 let func = self.lower_function(&ast)?; 558 let func_id = self.lower_function(&ast)?;
558 self.data().functions[func.index].is_unsafe = 559 let func = &mut self.data().functions[func_id.index];
559 is_intrinsic_fn_unsafe(&self.data().functions[func.index].name); 560 func.is_unsafe = is_intrinsic_fn_unsafe(&func.name);
560 func.into() 561 func.is_extern = true;
562 func_id.into()
561 } 563 }
562 ast::ExternItem::Static(ast) => { 564 ast::ExternItem::Static(ast) => {
563 let statik = self.lower_static(&ast)?; 565 let statik = self.lower_static(&ast)?;
566 self.data().statics[statik.index].is_extern = true;
564 statik.into() 567 statik.into()
565 } 568 }
566 ast::ExternItem::TypeAlias(ty) => { 569 ast::ExternItem::TypeAlias(ty) => {