rust/tests/ui/attributes/inline/attr-usage-inline.rs
Jonathan Brouwer 66b8a9db1f
Update uitests with new unused_attributes warnings
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-10-18 21:17:48 +02:00

32 lines
680 B
Rust

//! 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 cannot be used on
struct S;
struct I {
#[inline]
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
i: u8,
}
#[macro_export]
#[inline]
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
macro_rules! m_e {
() => {};
}
#[inline] //~ ERROR: attribute should be applied to function or closure
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
macro_rules! m {
() => {};
}
fn main() {}