106 Commits

Author SHA1 Message Date
Jonathan Brouwer
2084831cd5
Port #[no_mangle] to new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-22 22:17:04 +02: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
Pavel Grigorenko
d86d3f3742 Port #[rustc_pub_transparent] to the new attribute system 2025-06-21 21:52:25 +03:00
Jana Dönszelmann
cd857f4bef
Rollup merge of #142539 - GrigorenkoPV:attributes/may_dangle, r=jdonszelmann
Port `#[may_dangle]` to the new attribute system

Very similar to rust-lang/rust#142498.

This is a part of rust-lang/rust#131229, so
r? `@jdonszelmann`
2025-06-21 15:32:05 +02:00
bors
15c701fbc9 Auto merge of #142794 - tgross35:rollup-iae7okj, r=tgross35
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#142331 (Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.)
 - rust-lang/rust#142491 (Rework #[cold] attribute parser)
 - rust-lang/rust#142494 (Fix missing docs in `rustc_attr_parsing`)
 - rust-lang/rust#142495 (Better template for `#[repr]` attributes)
 - rust-lang/rust#142497 (Fix random failure when JS code is executed when the whole file was not read yet)
 - rust-lang/rust#142575 (Ensure copy* intrinsics also perform the static self-init checks)
 - rust-lang/rust#142650 (Refactor Translator)
 - rust-lang/rust#142713 (mbe: Refactor transcription)
 - rust-lang/rust#142755 (rustdoc: Remove `FormatRenderer::cache`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-20 23:09:48 +00:00
Pavel Grigorenko
045faa8c5c Port #[may_dangle] to the new attribute system 2025-06-20 22:39:14 +03:00
Jakub Beránek
e7cc4ec8f7
Rollup merge of #142769 - jdonszelmann:remove-useless-new-method, r=tgross35
remove equivalent new method on context

Noticed the two had converged so much they literally became equivalent. So one could go hehe
2025-06-20 20:03:25 +02:00
Jakub Beránek
065a5fb225
Rollup merge of #142715 - folkertdev:fn-align-corrections, r=jdonszelmann
correct template for `#[align]` attribute

Tracking issue: https://github.com/rust-lang/rust/issues/82232
related: https://github.com/rust-lang/rust/pull/142507

I didn't fully understand what `template!` did, clearly. An empty `#[align]` attribute was still rejected later, but without this change it does get suggested in certain cases.

I've also updated some outdated references to `#[repr(align)]` on functions.

r? ``@jdonszelmann``
2025-06-20 20:03:21 +02:00
Trevor Gross
1e2ac532e4
Rollup merge of #142495 - jdonszelmann:better-repr-template, r=oli-obk
Better template for `#[repr]` attributes
2025-06-20 13:36:00 -04:00
Trevor Gross
d2a00eb65f
Rollup merge of #142494 - jdonszelmann:missing-attr-parsing-docs, r=oli-obk
Fix missing docs in `rustc_attr_parsing`
2025-06-20 13:35:59 -04:00
Jana Dönszelmann
b9107a83a1
expected word diagnostic test 2025-06-20 15:06:29 +02:00
Jana Dönszelmann
de0fd27f34
cold 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
75bcc9ca6e
remove equivalent new method on context 2025-06-20 07:50:11 +02:00
Folkert de Vries
eefd598725
correct template for #[align]
it should not suggest just `#[align]`
2025-06-19 13:58:23 +02:00
Jana Dönszelmann
7f49de2cca
fixup missing docs in attr parsing 2025-06-18 14:46:12 +02:00
Jana Dönszelmann
815f0b71c7
better template for repr attributes 2025-06-18 13:48:42 +02: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
Jana Dönszelmann
0aade73c50
implement rustc_force_inline parser 2025-06-17 23:19:31 +02:00
Jonathan Dönszelmann
4f73cd0a6c implement inline parser 2025-06-17 23:19:31 +02:00
Pavel Grigorenko
da8d6bbd50 Port #[rustc_as_ptr] to the new attribute system 2025-06-16 18:13:27 +03:00
Matthias Krüger
fac011eb2d
Rollup merge of #142158 - xizheyin:141617, r=jdonszelmann
Tracking the old name of renamed unstable library features

This PR resolves the first problem of rust-lang/rust#141617 : tracking renamed unstable features. The first commit is to add a ui test, and the second one tracks the changes. I will comment on the code for clarification.

r? `@jdonszelmann`
There have been a lot of PR's reviewed by you lately, thanks for your time!

cc `@jyn514`
2025-06-13 05:16:56 +02:00
xizheyin
b8066f94fd
Tracking the old name of renamed unstable library attribute
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-06-12 19:24:11 +08:00
Jana Dönszelmann
e2afe04e2e
remove 'static in some places 2025-06-12 09:57:38 +02:00
Jana Dönszelmann
e6a5f281ec
add error message for unused duplicate 2025-06-12 09:56:47 +02:00
Jana Dönszelmann
6072207a11
introduce new lint infra
lint on duplicates during attribute parsing
To do this we stuff them in the diagnostic context to be emitted after
hir is constructed
2025-06-12 09:56:47 +02:00
Jonathan Dönszelmann
4e1b6d13a2 Start using new diagnostic logic on all existing single parsers 2025-06-12 09:42:45 +02:00
Jana Dönszelmann
28bf61b9b3
introduce duplicate attribute diagnostic logic 2025-06-12 09:42:45 +02:00
Jana Dönszelmann
ce0438684d
consistently rename (old) attribute groups 2025-06-11 18:46:57 +02:00
Jana Dönszelmann
34241e5397
document attribute parsers better 2025-06-11 18:46:57 +02:00
Matthias Krüger
7420ae82a7
Rollup merge of #142058 - xizheyin:rustc-attr-parsing, r=jdonszelmann
Clean `rustc_attr_parsing/src/lib.rs` documentation

Improves the documentation clarity in `rustc_attr_parsing` by restructuring content with clearer section headers, simplifying explanations of attribute types, making technical descriptions more precise.

r? ``@oli-obk``
2025-06-06 00:58:46 +02:00
xizheyin
1e49ad3862 Clean rustc_attr_parsing documentation
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-06-05 17:11:46 +08:00
Matthias Krüger
c1e8fe760b
Rollup merge of #141271 - nnethercote:attr-streamline, r=jdonszelmann
Streamline some attr parsing APIs

r? ``@jdonszelmann``
2025-06-04 16:24:06 +02:00
Urgau
e33fe611f5 Add custom trait for emitting lint within cfg_matches 2025-05-26 21:51:09 +02:00
Jacob Pratt
761e5464dd
Rollup merge of #140539 - nnethercote:simplify-attribute_groups, r=jdonszelmann
Simplify `attribute_groups`

It's more complicated than it needs to be.

r? ``@jdonszelmann``
2025-05-26 03:38:16 +02:00
est31
f3245e48f9 Make #[cfg(version)] respect RUSTC_OVERRIDE_VERSION_STRING 2025-05-24 23:54:17 +02:00
Nicholas Nethercote
e5c78de85c Rename MetaItemParser::path_without_args as MetaItemParser::path.
And avoid the clone.
2025-05-21 04:53:31 +10:00
Nicholas Nethercote
2cd2d24967 Remove MetaItemParser::{path,deconstruct}.
They're equivalent, and `path` is unused, and `deconstruct` has only one
call site outside of `path`.
2025-05-21 04:53:31 +10:00
Nicholas Nethercote
ea3b3fdcc1 Remove MetaItemParser::{word,word_without_args,path_is}.
They are unused.
2025-05-21 04:53:31 +10:00
Nicholas Nethercote
a822e557cd Remove an unnecessary lifetime. 2025-05-21 04:53:24 +10:00
bohan
097b7a2ac7 collect doc alias as tips during resolution 2025-05-21 00:47:36 +08:00
Nicholas Nethercote
ee1c2d583a Remove MetaItemListParser::all_{word,path}_list, which are unused. 2025-05-20 11:58:11 +10:00
Nicholas Nethercote
354b1cbcca Avoid rustc_span:: qualifiers.
In several files they are entirely unnecessary, with the relevant names
already imported. And in a few I have added the necessary `use` item.
2025-05-20 09:20:27 +10:00
Nicholas Nethercote
1525f548bc Fix up some comments.
Some are too long (> 100 chars), some are too short, some are missing
full stops, some are missing upper-case letters at the start of
sentences.
2025-05-20 09:17:49 +10:00
Nicholas Nethercote
5b808b7da8 Simplify Accepts.
There only needs to be one `Fn` per symbol, not multiple.
2025-05-20 09:12:24 +10:00
Nicholas Nethercote
e139d268f0 Introduce some typedefs to improve readability. 2025-05-20 08:31:49 +10:00