diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2024-12-17 19:29:14 +0800 |
|---|---|---|
| committer | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2024-12-17 19:57:42 +0800 |
| commit | 7424b898e94b019b49e0854ec061abfdc071e61e (patch) | |
| tree | e1023cd7a68c32dc4b493991576e554c9b018249 /tests/ui/attributes/inline/attr-usage-inline.rs | |
| parent | 88f8bf7e560f5ea9c2efe2f587b2586f95984c4c (diff) | |
| download | rust-7424b898e94b019b49e0854ec061abfdc071e61e.tar.gz rust-7424b898e94b019b49e0854ec061abfdc071e61e.zip | |
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.
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() {} |
