Skip to content

Commit 38a0177

Browse files
Add E0534 error explanation
1 parent 028c796 commit 38a0177

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

src/libsyntax/attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ pub fn find_inline_attr(diagnostic: Option<&Handler>, attrs: &[Attribute]) -> In
373373
InlineAttr::None
374374
}
375375
}
376-
_ => ia
376+
_ => ia,
377377
}
378378
})
379379
}

src/libsyntax/diagnostic_list.rs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,43 @@ fn main() {}
3838
```
3939
"##,
4040

41+
E0534: r##"
42+
The inline attribute was badly used.
43+
44+
Erroneous code example:
45+
46+
```compile_fail,E0534
47+
#[inline()] // error: expected one argument
48+
pub fn something() {}
49+
50+
fn main() {}
51+
```
52+
53+
The inline attribute can be used without arguments:
54+
55+
```
56+
#[inline] // ok!
57+
pub fn something() {}
58+
59+
fn main() {}
60+
```
61+
62+
Or with arguments (and parens have to be used for this case!):
63+
64+
```
65+
#[inline(always)] // ok!
66+
pub fn something() {}
67+
68+
fn main() {}
69+
```
70+
71+
For more information about the inline attribute, take a look here:
72+
https://doc.rust-lang.org/reference.html#inline-attributes)
73+
"##,
74+
4175
}
4276

4377
register_diagnostics! {
44-
E0534, // expected one argument
4578
E0535, // invalid argument
4679
E0536, // expected 1 cfg-pattern
4780
E0537, // invalid predicate

0 commit comments

Comments
 (0)