about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librustc/hir/check_attr.rs4
-rw-r--r--src/test/compile-fail/E0518.rs2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs
index a3ab5f949e7..8ba52cdb64f 100644
--- a/src/librustc/hir/check_attr.rs
+++ b/src/librustc/hir/check_attr.rs
@@ -42,7 +42,9 @@ struct CheckAttrVisitor<'a> {
 impl<'a> CheckAttrVisitor<'a> {
     fn check_inline(&self, attr: &ast::Attribute, target: Target) {
         if target != Target::Fn {
-            span_err!(self.sess, attr.span, E0518, "attribute should be applied to function");
+            struct_span_err!(self.sess, attr.span, E0518, "attribute should be applied to function")
+                .span_label(attr.span, &format!("requires a function"))
+                .emit();
         }
     }
 
diff --git a/src/test/compile-fail/E0518.rs b/src/test/compile-fail/E0518.rs
index 8518bb4a6be..f9494e0bcb5 100644
--- a/src/test/compile-fail/E0518.rs
+++ b/src/test/compile-fail/E0518.rs
@@ -9,9 +9,11 @@
 // except according to those terms.
 
 #[inline(always)] //~ ERROR E0518
+                  //~| requires a function
 struct Foo;
 
 #[inline(never)] //~ ERROR E0518
+                 //~| requires a function
 impl Foo {
 }