about summary refs log tree commit diff
path: root/compiler/rustc_attr_parsing/src/context.rs
AgeCommit message (Collapse)AuthorLines
2025-09-13Rollup merge of #146389 - jdonszelmann:no-std, r=oli-obkJana Dönszelmann-2/+4
Convert `no_std` and `no_core` to the new attribute infrastructure r? ```@oli-obk``` Also added a test for these, since we didn't have any and I was kind of surprised new diagnostics didn't break anything hehe
2025-09-10Rollup merge of #146178 - folkertdev:static-align, ↵Matthias Krüger-1/+2
r=jdonszelmann,ralfjung,traviscross Implement `#[rustc_align_static(N)]` on `static`s Tracking issue: https://github.com/rust-lang/rust/issues/146177 ```rust #![feature(static_align)] #[rustc_align_static(64)] static SO_ALIGNED: u64 = 0; ``` We need a different attribute than `rustc_align` because unstable attributes are tied to their feature (we can't have two unstable features use the same unstable attribute). Otherwise this uses all of the same infrastructure as `#[rustc_align]`. r? `@traviscross`
2025-09-09port `#[no_std]` to the new attribute parsing infrastructureJana Dönszelmann-1/+2
2025-09-09port `#[no_core]` to the new attribute parsing infrastructureJana Dönszelmann-2/+3
2025-09-09allow `#[rustc_align_static(N)]` on `static`sFolkert de Vries-1/+2
We need a different attribute than `rustc_align` because unstable attributes are tied to their feature (we can't have two unstable features use the same unstable attribute). Otherwise this uses all of the same infrastructure as `#[rustc_align]`.
2025-09-08fixup limit handling codeJana Dönszelmann-5/+8
2025-09-08port `#[pattern_complexity_limit]` to the new attribute parsing infrastructureJana Dönszelmann-1/+3
2025-09-08port `#[type_length_limit]` to the new attribute parsing infrastructureJana Dönszelmann-1/+4
2025-09-08port `#[move_size_limit]` to the new attribute parsing infrastructureJana Dönszelmann-1/+2
2025-09-08port `#[recursion_limit]` to the new attribute parsing infrastructureJana Dönszelmann-1/+2
2025-08-27Port the `#[link]` attribute to the new parserJonathan Brouwer-1/+2
2025-08-25Use attribute name in message for "outer attr used as inner attr" errorsSasha Pourcelot-3/+15
2025-08-24fix ICE on stable related to attrs on macrosJana Dönszelmann-19/+2
2025-08-24Port crate name to the new attribute systemJana Dönszelmann-1/+7
2025-08-24Allow errors to be emitted as fatal during attribute parsingJana Dönszelmann-11/+29
2025-08-23port attribute to the new parsing infrastructureJana Dönszelmann-1/+3
2025-08-22Rollup merge of #145762 - jdonszelmann:attrs-strings-to-symbols, r=lqdJacob Pratt-3/+7
convert strings to symbols in attr diagnostics r? `@lcnr` As you rightfully noticed in https://github.com/rust-lang/rust/pull/145670
2025-08-22Rollup merge of #145573 - veluca93:unsafe-force-target-feature, r=davidtwcoJacob Pratt-2/+3
Add an experimental unsafe(force_target_feature) attribute. This uses the feature gate for https://github.com/rust-lang/rust/issues/143352, but is described in https://github.com/rust-lang/rfcs/pull/3820 which is strongly tied to the experiment.
2025-08-22convert strings to symbols in attr diagnosticsJana Dönszelmann-3/+7
2025-08-22Add an experimental unsafe(force_target_feature) attribute.Luca Versari-2/+3
This uses the feature gate for https://github.com/rust-lang/rust/issues/143352, but is described in https://github.com/rust-lang/rfcs/pull/3820 which is strongly tied to the experiment.
2025-08-21split up context.rsJana Dönszelmann-322/+15
2025-08-21refactor target checking, move out of context.rs and rename MaybeWarn to PolicyJana Dönszelmann-266/+15
2025-08-19Rollup merge of #145243 - jdonszelmann:inner-attr-errors, r=petrochenkovStuart Cook-1/+17
take attr style into account in diagnostics when the original attribute was specified as an inner attribute, the suggestion will now match that attribute style
2025-08-18Rollup merge of #145485 - JonathanBrouwer:fix-deprecation-targets, ↵Stuart Cook-0/+3
r=jdonszelmann Fix deprecation attributes on foreign statics r? ````````@jdonszelmann```````` Fixes https://github.com/rust-lang/rust/issues/145437
2025-08-16take attr style into account in attr diagnosticsJana Dönszelmann-1/+17
2025-08-16Don't show foreign types as an allowed target if the feature is not enabledJonathan Brouwer-0/+3
2025-08-15Port `#[custom_mir(..)]` to the new attribute systemSasha Pourcelot-0/+2
2025-08-14Allow attribute parsers to specify a list of allowed targetsJonathan Brouwer-3/+234
Every acceptor gets an `ALLOWED_TARGETS` specification which can specify per target whether it is allowed, warned, or errored.
2025-08-14Pass the target type down to `parse_attribute_list`Jonathan Brouwer-1/+5
2025-08-13Port the `#[linkage]` attribute to the new attribute systemSasha Pourcelot-1/+2
2025-08-11Port `#[allow_internal_unsafe]` to the new attribute system (attempt 2)Sasha Pourcelot-1/+4
2025-08-08Revert "Port `#[allow_internal_unsafe]` to the new attribute system"Jana Dönszelmann-4/+1
This reverts commit 4f7a6ace9e2f2192af7b5d32f4b1664189e0e143.
2025-08-07Rollup merge of #144857 - scrabsha:push-pwtyrnmqkrtr, r=jdonszelmannTrevor Gross-1/+4
Port `#[allow_internal_unsafe]` to the new attribute system Related to https://github.com/rust-lang/rust/issues/131229#issue-2565886367. r? ````@jdonszelmann````
2025-08-07Port `#[allow_internal_unsafe]` to the new attribute systemSasha Pourcelot-1/+4
2025-08-07Rollup merge of #143808 - JonathanBrouwer:should_panic_parser, r=jdonszelmannStuart Cook-1/+2
Port `#[should_panic]` to the new attribute parsing infrastructure Ports `#[should_panic]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163 r? ```@jdonszelmann```
2025-08-06Port `#[should_panic]` to the new attribute parsing infrastructureJonathan Brouwer-1/+2
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-06Rollup merge of #144794 - scrabsha:push-noqrrttovmwy, r=jdonszelmannGuillaume Gomez-0/+2
Port `#[coroutine]` to the new attribute system Related to https://github.com/rust-lang/rust/issues/131229#issue-2565886367. r? `````@jdonszelmann`````
2025-08-05Rollup merge of #144866 - JonathanBrouwer:should_emit_fix, r=jdonszelmannSamuel Tardieu-4/+11
Remove `SHOULD_EMIT_LINTS` in favor of `should_emit` r? ``@jdonszelmann``
2025-08-04Port `#[coroutine]` to the new attribute systemSasha Pourcelot-0/+2
Related to https://github.com/rust-lang/rust/issues/131229#issue-2565886367.
2025-08-03Rollup merge of #144738 - bjorn3:remove_omit_gdb_pretty_printer_section, ↵Samuel Tardieu-4/+2
r=jieyouxu Remove the omit_gdb_pretty_printer_section attribute Disabling loading of pretty printers in the debugger itself is more reliable. Before this commit the .gdb_debug_scripts section couldn't be included in dylibs or rlibs as otherwise there is no way to disable the section anymore without recompiling the entire standard library.
2025-08-03Remove `SHOULD_EMIT_LINTS` in favor of `should_emit`Jonathan Brouwer-4/+11
2025-08-01Remove the omit_gdb_pretty_printer_section attributebjorn3-4/+2
Disabling loading of pretty printers in the debugger itself is more reliable. Before this commit the .gdb_debug_scripts section couldn't be included in dylibs or rlibs as otherwise there is no way to disable the section anymore without recompiling the entire standard library.
2025-08-01Cleanup the definition of `group_type`Jonathan Brouwer-25/+36
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-31remove rustc_attr_data_structuresJana Dönszelmann-2/+2
2025-07-26Parsers for the attributesJonathan Brouwer-0/+7
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-23Ports `#[macro_use]` and `#[macro_escape]` to the new attribute parsing ↵Jonathan Brouwer-0/+14
infrastructure
2025-07-18Rollup merge of #143891 - scrabsha:push-xxtttopqoprr, r=jdonszelmannMatthias Krüger-2/+24
Port `#[coverage]` to the new attribute system r? ``````@jdonszelmann``````
2025-07-17Rollup merge of #143984 - JonathanBrouwer:fix-feature-gate-ice, r=UrgauMatthias Krüger-4/+23
Fix ice for feature-gated `cfg` attributes applied to the crate This PR fixes two fixes: 1. When a feature gated option of the `cfg` attribute is applied to the crate, an ICE would occur because features are not yet available at that stage. This is fixed by ignoring the feature gate at that point, the attribute will later be re-checked (this was already done) when the feature gate is available. Fixes https://github.com/rust-lang/rust/issues/143977 2. Errors and lints on the `cfg` attribute applied to the crate would be produced twice, because of the re-checking. This is fixed by not producing any errors and lints during the first run. The added regression test checks both problems. r? ``@jdonszelmann``
2025-07-17Auto merge of #140399 - tiif:unstable_impl, r=lcnr,BoxyUwUbors-1/+4
Implement unstable trait impl This PR allows marking impls of stable trait with stable type as unstable. ## Approach In std/core, an impl can be marked as unstable by annotating it with ``#[unstable_feature_bound(feat_name)]``. This will add a ``ClauseKind::Unstable_Feature(feat_name)`` to the list of predicates in ``predicates_of`` . When an unstable impl's function is called, we will first iterate through all the goals in ``param_env`` to check if there is any ``ClauseKind::UnstableFeature(feat_name)`` in ``param_env``. The existence of ``ClauseKind::Unstable_Feature(feat_name)`` in ``param_env`` means an``#[unstable_feature_bound(feat_name)]`` is present at the call site of the function, so we allow the check to succeed in this case. If ``ClauseKind::UnstableFeature(feat_name)`` does not exist in ``param_env``, we will still allow the check to succeed for either of the cases below: 1. The feature is enabled through ``#[feature(feat_name)]`` outside of std / core. 2. We are in codegen because we may be monomorphizing a body from an upstream crate which had an unstable feature enabled that the downstream crate do not. For the rest of the case, it will fail with ambiguity. ## Limitation In this PR, we do not support: 1. using items that need ``#[unstable_feature_bound]`` within stable APIs 2. annotate main function with ``#[unstable_feature_bound]`` 3. annotate ``#[unstable_feature_bound]`` on items other than free function and impl ## Acknowledgement The design and mentoring are done by `@BoxyUwU`
2025-07-16Port `#[coverage]` to the new attribute systemSasha Pourcelot-2/+24