about summary refs log tree commit diff
path: root/compiler/rustc_attr_parsing/src
AgeCommit message (Collapse)AuthorLines
2025-06-28Port `#[link_name]` to the new attribute parsing infrastructureJonathan Brouwer-0/+33
Co-authored-by: Anne Stijns <anstijns@gmail.com> Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-27Port `#[used]` to new attribute parsing infrastructureJonathan Brouwer-1/+84
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-26Port `#[export_name]` to the new attribute parsing infrastructureJonathan Brouwer-2/+37
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-24Rollup merge of #142825 - jdonszelmann:track-caller, r=oli-obkJubilee-4/+25
Port `#[track_caller]` to the new attribute system r? ``@oli-obk`` depends on https://github.com/rust-lang/rust/pull/142493 Closes rust-lang/rust#142783 (didn't add a test for this, this situation should simply never come up again, the code was simply wrong. lmk if I should add it, but it won't test something very useful)
2025-06-24Rollup merge of #138780 - trifectatechfoundation:loop_match_attr, ↵Jubilee-0/+35
r=oli-obk,traviscross Add `#[loop_match]` for improved DFA codegen tracking issue: https://github.com/rust-lang/rust/issues/132306 project goal: https://github.com/rust-lang/rust-project-goals/issues/258 This PR adds the `#[loop_match]` attribute, which aims to improve code generation for state machines. For some (very exciting) benchmarks, see https://github.com/rust-lang/rust-project-goals/issues/258#issuecomment-2732965199 Currently, a very restricted syntax pattern is accepted. We'd like to get feedback and merge this now before we go too far in a direction that others have concerns with. ## current state We accept code that looks like this ```rust #[loop_match] loop { state = 'blk: { match state { State::A => { #[const_continue] break 'blk State::B } State::B => { /* ... */ } /* ... */ } } } ``` - a loop should have the same semantics with and without `#[loop_match]`: normal `continue` and `break` continue to work - `#[const_continue]` is only allowed in loops annotated with `#[loop_match]` - the loop body needs to have this particular shape (a single assignment to the match scrutinee, with the body a labelled block containing just a match) ## future work - perform const evaluation on the `break` value - support more state/scrutinee types ## maybe future work - allow `continue 'label value` syntax, which `#[const_continue]` could then use. - allow the match to be on an arbitrary expression (e.g. `State::Initial`) - attempt to also optimize `break`/`continue` expressions that are not marked with `#[const_continue]` r? ``@traviscross``
2025-06-24Rewrite #[track_caller]Jana Dönszelmann-4/+25
2025-06-23Port `#[rustc_skip_during_method_dispatch]` to the new attribute systemPavel Grigorenko-18/+105
2025-06-23Add `#[loop_match]` for improved DFA codegenbjorn3-0/+35
Co-authored-by: Folkert de Vries <folkert@folkertdev.nl>
2025-06-23move naked checks out of check_attr.rsJana Dönszelmann-36/+181
2025-06-23make warnings methods on cx so it's easier to emit them elsewhere tooJana Dönszelmann-8/+28
2025-06-23rewrite #[naked] parserJana Dönszelmann-2/+20
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/+66
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-83/+116
2025-06-17use consistent attr errors in all attribute parsersJana Dönszelmann-88/+140
2025-06-17fix bugs in inline/force_inline and diagnostics of all attr parsersJana Dönszelmann-85/+285
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-1/+1
2025-06-12introduce new lint infraJana Dönszelmann-194/+458
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``