diff options
Diffstat (limited to 'crates/hir_ty/src/diagnostics')
-rw-r--r-- | crates/hir_ty/src/diagnostics/decl_check.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs index 4b3e2fa8f..724bad867 100644 --- a/crates/hir_ty/src/diagnostics/decl_check.rs +++ b/crates/hir_ty/src/diagnostics/decl_check.rs | |||
@@ -87,6 +87,10 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
87 | 87 | ||
88 | fn validate_func(&mut self, db: &dyn HirDatabase, func: FunctionId) { | 88 | fn validate_func(&mut self, db: &dyn HirDatabase, func: FunctionId) { |
89 | let data = db.function_data(func); | 89 | let data = db.function_data(func); |
90 | if data.is_extern { | ||
91 | return; | ||
92 | } | ||
93 | |||
90 | let body = db.body(func.into()); | 94 | let body = db.body(func.into()); |
91 | 95 | ||
92 | // Recursively validate inner scope items, such as static variables and constants. | 96 | // Recursively validate inner scope items, such as static variables and constants. |
@@ -648,6 +652,9 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
648 | 652 | ||
649 | fn validate_static(&mut self, db: &dyn HirDatabase, static_id: StaticId) { | 653 | fn validate_static(&mut self, db: &dyn HirDatabase, static_id: StaticId) { |
650 | let data = db.static_data(static_id); | 654 | let data = db.static_data(static_id); |
655 | if data.is_extern { | ||
656 | return; | ||
657 | } | ||
651 | 658 | ||
652 | if self.allowed(db, static_id.into(), allow::NON_UPPER_CASE_GLOBAL) { | 659 | if self.allowed(db, static_id.into(), allow::NON_UPPER_CASE_GLOBAL) { |
653 | return; | 660 | return; |
@@ -920,4 +927,16 @@ fn main() { | |||
920 | "#, | 927 | "#, |
921 | ); | 928 | ); |
922 | } | 929 | } |
930 | |||
931 | #[test] | ||
932 | fn ignores_extern_items() { | ||
933 | check_diagnostics( | ||
934 | r#" | ||
935 | extern { | ||
936 | fn NonSnakeCaseName(SOME_VAR: u8) -> u8; | ||
937 | pub static SomeStatic: u8 = 10; | ||
938 | } | ||
939 | "#, | ||
940 | ); | ||
941 | } | ||
923 | } | 942 | } |