diff options
| author | Gavin Baker <gavinb@antonym.org> | 2016-08-30 11:44:25 +1000 |
|---|---|---|
| committer | Gavin Baker <gavinb@antonym.org> | 2016-09-06 00:21:04 +1000 |
| commit | cd56d47da3a2c2ed2eb2a1e4e54ca471c2c9172a (patch) | |
| tree | 5ebd71a664d986df2afe6ac6377451df58ace5e0 | |
| parent | 8bcd6a33bebb8177781ae07ea1fc0d4a9a679627 (diff) | |
| download | rust-cd56d47da3a2c2ed2eb2a1e4e54ca471c2c9172a.tar.gz rust-cd56d47da3a2c2ed2eb2a1e4e54ca471c2c9172a.zip | |
E0518 Update error format #36111
- Fixes #36111 - Part of #35233
| -rw-r--r-- | src/librustc/hir/check_attr.rs | 4 | ||||
| -rw-r--r-- | src/test/compile-fail/E0518.rs | 2 |
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 { } |
