rust/tests/ui/attributes/inline/attr-usage-inline.rs
许杰友 Jieyou Xu (Joe) 7424b898e9 Adjust tests/ui/attr-usage-inline.rs
- Move `tests/ui/attr-usage-inline.rs` to `tests/ui/attributes/inline/`.
- Briefly document test intent.
- Drop unnecessary `#[allow(dead_code)]` as this is allowed-by-default
  for ui test suite.
2024-12-17 19:57:42 +08:00

27 lines
491 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 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() {}