summary refs log tree commit diff
path: root/compiler/rustc_attr_parsing
AgeCommit message (Collapse)AuthorLines
2025-07-24Mitigate `#[align]` name resolution ambiguity regression with a renameJieyou Xu-1/+1
From `#[align]` -> `#[rustc_align]`. Attributes starting with `rustc` are always perma-unstable and feature-gated by `feature(rustc_attrs)`. See regression RUST-143834. For the underlying problem where even introducing new feature-gated unstable built-in attributes can break user code such as ```rs macro_rules! align { () => { /* .. */ }; } pub(crate) use align; // `use` here becomes ambiguous ``` refer to RUST-134963. Since the `#[align]` attribute is still feature-gated by `feature(fn_align)`, we can rename it as a mitigation. Note that `#[rustc_align]` will obviously mean that current unstable user code using `feature(fn_aling)` will need additionally `feature(rustc_attrs)`, but this is a short-term mitigation to buy time, and is expected to be changed to a better name with less collision potential. See <https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202025-07-17/near/529290371> where mitigation options were considered. (cherry picked from commit 69b71e44107b4905ec7ad84ccb3edf4f14b3df69)
2025-06-22Port `#[no_mangle]` to new attribute parsing infrastructureJonathan Brouwer-1/+20
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-22Port `#[must_use]` to new attribute parsing infrastructureJonathan Brouwer-0/+52
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-21Port `#[rustc_pub_transparent]` to the new attribute systemPavel Grigorenko-1/+15
2025-06-21Rollup merge of #142539 - GrigorenkoPV:attributes/may_dangle, r=jdonszelmannJana Dönszelmann-0/+22
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-20Auto merge of #142794 - tgross35:rollup-iae7okj, r=tgross35bors-2/+56
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-20Port `#[may_dangle]` to the new attribute systemPavel Grigorenko-0/+22
2025-06-20Rollup merge of #142769 - jdonszelmann:remove-useless-new-method, r=tgross35Jakub Beránek-7/+1
remove equivalent new method on context Noticed the two had converged so much they literally became equivalent. So one could go hehe
2025-06-20Rollup merge of #142715 - folkertdev:fn-align-corrections, r=jdonszelmannJakub Beránek-1/+1
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-20Rollup merge of #142495 - jdonszelmann:better-repr-template, r=oli-obkTrevor Gross-1/+2
Better template for `#[repr]` attributes
2025-06-20Rollup merge of #142494 - jdonszelmann:missing-attr-parsing-docs, r=oli-obkTrevor Gross-0/+19
Fix missing docs in `rustc_attr_parsing`
2025-06-20expected word diagnostic testJana Dönszelmann-3/+3
2025-06-20coldJana Dönszelmann-1/+35
2025-06-20Rollup merge of #138291 - jdonszelmann:optimize-attr, r=oli-obkTrevor Gross-0/+43
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-20remove equivalent new method on contextJana Dönszelmann-7/+1
2025-06-19correct template for `#[align]`Folkert de Vries-1/+1
it should not suggest just `#[align]`
2025-06-18fixup missing docs in attr parsingJana Dönszelmann-0/+19
2025-06-18better template for repr attributesJana Dönszelmann-1/+2
2025-06-18convert the `optimize` attribute to a new parserJana Dönszelmann-0/+43
2025-06-18add `#[align]` attributeFolkert de Vries-3/+69
Right now it's used for functions with `fn_align`, in the future it will get more uses (statics, struct fields, etc.)
2025-06-17make error codes reflect reality betterJana Dönszelmann-87/+116
2025-06-17use consistent attr errors in all attribute parsersJana Dönszelmann-93/+140
2025-06-17fix bugs in inline/force_inline and diagnostics of all attr parsersJana Dönszelmann-85/+290
2025-06-17implement rustc_force_inline parserJana Dönszelmann-1/+3
2025-06-17implement inline parserJonathan Dönszelmann-1/+4
2025-06-16Port `#[rustc_as_ptr]` to the new attribute systemPavel Grigorenko-0/+24
2025-06-13Rollup merge of #142158 - xizheyin:141617, r=jdonszelmannMatthias Krüger-1/+4
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-12Tracking the old name of renamed unstable library attributexizheyin-1/+4
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-06-12remove 'static in some placesJana Dönszelmann-13/+13
2025-06-12add error message for unused duplicateJana Dönszelmann-4/+2
2025-06-12introduce new lint infraJana Dönszelmann-194/+468
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-12Start using new diagnostic logic on all existing `single` parsersJonathan Dönszelmann-43/+14
2025-06-12introduce duplicate attribute diagnostic logicJana Dönszelmann-17/+112
2025-06-11consistently rename (old) attribute groupsJana Dönszelmann-12/+14
2025-06-11document attribute parsers betterJana Dönszelmann-0/+9
2025-06-06Rollup merge of #142058 - xizheyin:rustc-attr-parsing, r=jdonszelmannMatthias Krüger-37/+37
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-05Clean `rustc_attr_parsing` documentationxizheyin-37/+37
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-06-04Rollup merge of #141271 - nnethercote:attr-streamline, r=jdonszelmannMatthias Krüger-64/+19
Streamline some attr parsing APIs r? ``@jdonszelmann``
2025-05-26Add custom trait for emitting lint within `cfg_matches`Urgau-6/+21
2025-05-26Rollup merge of #140539 - nnethercote:simplify-attribute_groups, r=jdonszelmannJacob Pratt-48/+47
Simplify `attribute_groups` It's more complicated than it needs to be. r? ``@jdonszelmann``
2025-05-24Make #[cfg(version)] respect RUSTC_OVERRIDE_VERSION_STRINGest31-2/+2
2025-05-21Rename `MetaItemParser::path_without_args` as `MetaItemParser::path`.Nicholas Nethercote-13/+13
And avoid the clone.
2025-05-21Remove `MetaItemParser::{path,deconstruct}`.Nicholas Nethercote-15/+7
They're equivalent, and `path` is unused, and `deconstruct` has only one call site outside of `path`.
2025-05-21Remove `MetaItemParser::{word,word_without_args,path_is}`.Nicholas Nethercote-23/+0
They are unused.
2025-05-21Remove an unnecessary lifetime.Nicholas Nethercote-1/+1
2025-05-21collect doc alias as tips during resolutionbohan-1/+33
2025-05-20Remove `MetaItemListParser::all_{word,path}_list`, which are unused.Nicholas Nethercote-14/+0
2025-05-20Avoid `rustc_span::` qualifiers.Nicholas Nethercote-17/+16
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-20Fix up some comments.Nicholas Nethercote-16/+15
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-20Simplify `Accepts`.Nicholas Nethercote-10/+7
There only needs to be one `Fn` per symbol, not multiple.