diff options
Diffstat (limited to 'tests/ui/attributes/inline/attr-usage-inline.rs')
| -rw-r--r-- | tests/ui/attributes/inline/attr-usage-inline.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/attributes/inline/attr-usage-inline.rs b/tests/ui/attributes/inline/attr-usage-inline.rs new file mode 100644 index 00000000000..d8ca0fce163 --- /dev/null +++ b/tests/ui/attributes/inline/attr-usage-inline.rs @@ -0,0 +1,26 @@ +//! Check that `#[inline]` attribute can only be applied to fn-like targets (e.g. function or +//! closure), and when misapplied to other targets an error is emitted. + +#[inline] +fn f() {} + +#[inline] //~ ERROR: attribute should be applied to function or closure +struct S; + +struct I { + #[inline] + i: u8, +} + +#[macro_export] +#[inline] +macro_rules! m_e { + () => {}; +} + +#[inline] //~ ERROR: attribute should be applied to function or closure +macro_rules! m { + () => {}; +} + +fn main() {} |
