Skip to content

Commit cd56d47

Browse files
committed
E0518 Update error format #36111
- Fixes #36111 - Part of #35233
1 parent 8bcd6a3 commit cd56d47

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/librustc/hir/check_attr.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ struct CheckAttrVisitor<'a> {
4242
impl<'a> CheckAttrVisitor<'a> {
4343
fn check_inline(&self, attr: &ast::Attribute, target: Target) {
4444
if target != Target::Fn {
45-
span_err!(self.sess, attr.span, E0518, "attribute should be applied to function");
45+
struct_span_err!(self.sess, attr.span, E0518, "attribute should be applied to function")
46+
.span_label(attr.span, &format!("requires a function"))
47+
.emit();
4648
}
4749
}
4850

src/test/compile-fail/E0518.rs

+2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
// except according to those terms.
1010

1111
#[inline(always)] //~ ERROR E0518
12+
//~| requires a function
1213
struct Foo;
1314

1415
#[inline(never)] //~ ERROR E0518
16+
//~| requires a function
1517
impl Foo {
1618
}
1719

0 commit comments

Comments
 (0)