2024-12-17 11:29:14 +00:00
|
|
|
//! 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.
|
2015-09-25 06:25:59 +00:00
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn f() {}
|
|
|
|
|
2018-04-27 05:20:46 +00:00
|
|
|
#[inline] //~ ERROR: attribute should be applied to function or closure
|
2015-09-25 06:25:59 +00:00
|
|
|
struct S;
|
|
|
|
|
2021-02-01 14:35:53 +00:00
|
|
|
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 {
|
|
|
|
() => {};
|
|
|
|
}
|
|
|
|
|
2015-09-25 06:25:59 +00:00
|
|
|
fn main() {}
|