Jonathan Brouwer
244d64e60b
Port #[path] to the new attribute parsing infrastructure
...
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com >
2025-07-06 22:19:16 +02:00
Jonathan Brouwer
ef3d7741e5
Move check for new attribute to check_builtin_meta_item
...
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com >
2025-07-06 22:18:58 +02:00
Jonathan Brouwer
2d8ffff10a
Port #[ignore] to the new attribute parsing infrastructure
...
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com >
2025-07-05 21:23:09 +02:00
Jonathan Brouwer
027126ce0b
Port #[non_exhaustive] to the new attribute parsing infrastructure
2025-07-04 20:30:42 +02:00
Matthias Krüger
f3e7ec5560
Rollup merge of #143400 - GrigorenkoPV:attributes/lints, r=jdonszelmann
...
Port `#[rustc_pass_by_value]` to the new attribute system
Part of rust-lang/rust#131229
r? `@oli-obk`
2025-07-04 16:22:36 +02:00
Pavel Grigorenko
ef4dece2cb
Port #[rustc_pass_by_value] to the new attribute system
2025-07-04 00:07:56 +03:00
Jonathan Brouwer
fee5e3c3aa
Port #[no_implicit_prelude] to the new attribute parsing infrastructure
...
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com >
2025-07-03 20:59:40 +02:00
Jonathan Brouwer
3d5d72b761
Port #[target_feature] to the new attribute parsing infrastructure
...
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com >
2025-07-03 07:54:19 +02:00
Jonathan Brouwer
57a5e3b6d2
Fix duplicate errors for link_section, rustc_layout_scalar_valid_range_start and rustc_layout_scalar_valid_range_end
2025-07-01 16:40:47 +02:00
Jonathan Brouwer
0b67d14b31
Fix #[rustc_macro_transparency] giving two errors
...
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com >
2025-07-01 16:10:07 +02:00
Jonathan Brouwer
86b54d5729
Fix double error for export_name
...
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com >
2025-07-01 16:10:02 +02:00
Jonathan Brouwer
1249c14232
Port #[link_name] to the new attribute parsing infrastructure
...
Co-authored-by: Anne Stijns <anstijns@gmail.com >
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com >
2025-06-28 13:53:37 +02:00
Jana Dönszelmann
5d44fdd972
Rewrite #[track_caller]
2025-06-24 23:00:31 +02:00
Pavel Grigorenko
aa80a2b62c
Port #[rustc_skip_during_method_dispatch] to the new attribute system
2025-06-23 22:48:20 +03:00
Jonathan Brouwer
b24df42488
Port #[must_use] to new attribute parsing infrastructure
...
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com >
2025-06-22 14:51:58 +02:00
Jana Dönszelmann
b9107a83a1
expected word diagnostic test
2025-06-20 15:06:29 +02:00
Trevor Gross
bab4ca914e
Rollup merge of #138291 - jdonszelmann:optimize-attr, r=oli-obk
...
rewrite `optimize` attribute to use new attribute parsing infrastructure
r? ```@oli-obk```
I'm afraid we'll get quite a few of these PRs in the future. If we get a lot of trivial changes I'll start merging multiple into one PR. They should be easy to review :)
Waiting on #138165 first
2025-06-20 02:50:37 -04:00
Jana Dönszelmann
b64fd13a04
convert the optimize attribute to a new parser
2025-06-18 13:48:42 +02:00
Folkert de Vries
1fdf2b5620
add #[align] attribute
...
Right now it's used for functions with `fn_align`, in the future it will
get more uses (statics, struct fields, etc.)
2025-06-18 12:37:08 +02:00
Jana Dönszelmann
5ab5f8a24a
make error codes reflect reality better
2025-06-17 23:22:51 +02:00
Jana Dönszelmann
672452d573
use consistent attr errors in all attribute parsers
2025-06-17 23:19:31 +02:00
Jana Dönszelmann
ee976bbbca
fix bugs in inline/force_inline and diagnostics of all attr parsers
2025-06-17 23:19:31 +02:00
Folkert de Vries
2c8257493d
use correct edition when warning for unsafe attributes
...
If an attribute is re-emitted by a macro, the incorrect edition was used to emit warnings for unsafe attributes
2025-06-09 21:55:22 +02:00
Jieyou Xu
eb3a8e5b81
Make attribute safety validation logic more obvious
2025-05-04 21:44:50 +08:00
Urgau
f4e1ec111c
Report the unsafe_attr_outside_unsafe lint at the closest node
2025-05-03 16:10:25 +02:00
Folkert de Vries
41ddf86722
Make #[naked] an unsafe attribute
2025-04-19 00:03:35 +02:00
Folkert de Vries
cb22c1d5e9
Allow (but don't require) #[unsafe(naked)] so that compiler-builtins can upgrade to it
2025-04-14 20:44:15 +02:00
Folkert de Vries
f472cc8cd4
error on unsafe attributes in pre-2024 editions
...
the `no_mangle`, `link_section` and `export_name` attributes are exceptions, and can still be used without an unsafe in earlier editions
2025-04-13 01:22:59 +02:00
Vadim Petrochenkov
92d802eda6
expand: Leave traces when expanding cfg attributes
2025-03-26 15:30:12 +03:00
Vadim Petrochenkov
9dd4e4cad1
expand: Leave traces when expanding cfg_attr attributes
2025-03-17 15:58:25 +03:00
Michael Goulet
28a997fa44
Properly record metavar spans for other expansions other than TT
2024-12-21 20:37:27 +00:00
Jonathan Dönszelmann
d50c0a5480
Add hir::Attribute
2024-12-15 19:18:46 +01:00
Oli Scherer
53b2c7cc95
Rename value field to expr to simplify later commits' diffs
2024-12-15 18:47:45 +01:00
Oli Scherer
778321d155
Change AttrArgs::Eq into a struct variant
2024-12-02 10:28:58 +00:00
codemountains
6dfc4a0473
Rename NestedMetaItem to MetaItemInner
2024-10-06 23:28:30 +09:00
Michael Goulet
c682aa162b
Reformat using the new identifier sorting from rustfmt
2024-09-22 19:11:29 -04:00
Michael Goulet
af8d911d63
Also fix if in else
2024-09-11 17:24:01 -04:00
carbotaniuman
de9b5c3ea2
Stabilize unsafe_attributes
2024-08-07 03:12:13 -05:00
carbotaniuman
49db8a5a99
Add toggle for parse_meta_item unsafe parsing
...
This makes it possible for the `unsafe(...)` syntax to only be
valid at the top level, and the `NestedMetaItem`s will automatically
reject `unsafe(...)`.
2024-07-30 18:28:43 -05:00
carbotaniuman
d8bc8761a5
Deny unsafe on more builtin attributes
2024-07-29 21:00:09 -05:00
Nicholas Nethercote
84ac80f192
Reformat use declarations.
...
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
Zalathar
a000fa8b54
coverage: Tighten validation of #[coverage(off)] and #[coverage(on)]
2024-06-24 20:15:01 +10:00
carbotaniuman
a23917cfd0
Add hard error and migration lint for unsafe attrs
2024-06-23 19:02:14 -05:00
Oli Scherer
c91edc3888
Prefer dcx methods over fields or fields' methods
2024-06-18 13:45:08 +00:00
Matthias Krüger
4aceaaa7f3
Rollup merge of #126052 - nnethercote:rustc_parse-more-cleanups, r=spastorino
...
More `rustc_parse` cleanups
Following on from #125815 .
r? `@spastorino`
2024-06-07 20:14:30 +02:00
carbotaniuman
67f5dd1ef1
Parse unsafe attributes
2024-06-06 20:26:27 -05:00
Nicholas Nethercote
4c731c2f6b
Inline and remove check_builtin_attribute.
...
It's small and has a single call site.
Also change the second `parse_meta` call to use a simple `match`, like
the first `parse_meta` call, instead of a confusing `map_err`+`ok`
combination.
2024-06-06 08:26:54 +10:00
Nicholas Nethercote
95b4c07ef8
Reduce pub exposure.
2024-06-06 08:26:54 +10:00
Xiretza
98dd6c7e8f
Rename buffer_lint_with_diagnostic to buffer_lint
2024-05-21 20:16:39 +00:00
Xiretza
b7abf014ec
Convert uses of BuiltinLintDiag::Normal to custom variants
...
This ensures all diagnostic messages are created at diagnostic emission
time, making them translatable.
2024-05-21 20:16:39 +00:00