about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorWim Looman <git@nemo157.com>2020-06-20 13:31:24 +0200
committerWim Looman <git@nemo157.com>2020-08-30 20:16:23 +0200
commit79b0ab5195f0b7f9e05881e775219eea9cc410f6 (patch)
tree4fb89ff2682b41c5a89269b8fc959c99c67443a0 /compiler
parent66b2f9acfcb6203090ca2321ce37bb7ae6c07210 (diff)
downloadrust-79b0ab5195f0b7f9e05881e775219eea9cc410f6.tar.gz
rust-79b0ab5195f0b7f9e05881e775219eea9cc410f6.zip
Scope no_mangle and export_name warnings to the declarations name
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_lint/src/builtin.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index 784468aac2a..89190072a72 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -279,12 +279,12 @@ impl EarlyLintPass for UnsafeCode {
 
             ast::ItemKind::Fn(..) => {
                 if attr::contains_name(&it.attrs, sym::no_mangle) {
-                    self.report_unsafe(cx, it.span, |lint| {
+                    self.report_unsafe(cx, it.ident.span, |lint| {
                         lint.build("declaration of a `no_mangle` function").emit();
                     })
                 }
                 if attr::contains_name(&it.attrs, sym::export_name) {
-                    self.report_unsafe(cx, it.span, |lint| {
+                    self.report_unsafe(cx, it.ident.span, |lint| {
                         lint.build("declaration of a function with `export_name`").emit();
                     })
                 }
@@ -292,12 +292,12 @@ impl EarlyLintPass for UnsafeCode {
 
             ast::ItemKind::Static(..) => {
                 if attr::contains_name(&it.attrs, sym::no_mangle) {
-                    self.report_unsafe(cx, it.span, |lint| {
+                    self.report_unsafe(cx, it.ident.span, |lint| {
                         lint.build("declaration of a `no_mangle` static").emit();
                     })
                 }
                 if attr::contains_name(&it.attrs, sym::export_name) {
-                    self.report_unsafe(cx, it.span, |lint| {
+                    self.report_unsafe(cx, it.ident.span, |lint| {
                         lint.build("declaration of a static with `export_name`").emit();
                     })
                 }