about summary refs log tree commit diff
path: root/compiler/rustc_attr_parsing/src/context.rs
AgeCommit message (Collapse)AuthorLines
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
2025-07-15Fix ice for feature-gated cfg attributes applied to the crateJonathan Brouwer-4/+23
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-15Implement other logicstiif-1/+4
2025-07-15Auto merge of #143958 - samueltardieu:rollup-lh1s143, r=samueltardieubors-2/+3
Rollup of 13 pull requests Successful merges: - rust-lang/rust#142301 (tests: Fix duplicated-path-in-error fail with musl) - rust-lang/rust#143630 (Drop `./x suggest`) - rust-lang/rust#143736 (Give all bytes of TypeId provenance) - rust-lang/rust#143752 (Don't panic if WASI_SDK_PATH not set when detecting compiler) - rust-lang/rust#143837 (Adjust `run_make_support::symbols` helpers) - rust-lang/rust#143878 (Port `#[pointee]` to the new attribute parsing infrastructure) - rust-lang/rust#143905 (Recover and suggest to use `;` to construct array type) - rust-lang/rust#143907 (core: make `str::split_at_unchecked()` inline) - rust-lang/rust#143910 (Add experimental `backtrace-trace-only` std feature) - rust-lang/rust#143927 (Preserve constness in trait objects up to hir ty lowering) - rust-lang/rust#143935 (rustc_type_ir/walk: move docstring to `TypeWalker` itself) - rust-lang/rust#143938 (Update books) - rust-lang/rust#143941 (update `cfg_select!` documentation) Failed merges: - rust-lang/rust#143926 (Remove deprecated fields in bootstrap) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-15Allow `Early` stage to emit errorsJonathan Brouwer-14/+83
2025-07-14Port `#[pointee]` to the new attribute parsing infrastructureJonathan Brouwer-2/+3
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-14Rollup merge of #143855 - JonathanBrouwer:omit_gdb_pretty_printer_section, ↵Samuel Tardieu-2/+3
r=jdonszelmann Port `#[omit_gdb_pretty_printer_section]` to the new attribute parsing Ports `#[omit_gdb_pretty_printer_section]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163 r? ```@jdonszelmann```
2025-07-14Rollup merge of #143217 - Periodic1911:link-ordinal, r=jdonszelmannJakub Beránek-3/+33
Port #[link_ordinal] to the new attribute parsing infrastructure Ports link_ordinal to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197
2025-07-14Auto merge of #143779 - JonathanBrouwer:automatically_derived_parser, r=oli-obkbors-1/+4
Port `#[automatically_derived]` to the new attribute parsing infrastructure Ports `#[automatically_derived]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163 r? `@oli-obk` cc `@jdonszelmann`
2025-07-13Port `#[link_ordinal]` to the new attribute parsing infrastructure.Anne Stijns-3/+33
2025-07-13Rollup merge of #143796 - JonathanBrouwer:fix-builtin-attribute-prefix, ↵León Orell Valerian Liehr-0/+5
r=jdonszelmann Fix ICE for parsed attributes with longer path not handled by CheckAttribute Fixes https://github.com/rust-lang/rust/issues/137590 Fixes https://github.com/rust-lang/rust/issues/143789 r? ```@jdonszelmann```
2025-07-12Port `#[omit_gdb_pretty_printer_section]` to the new attribute parsing ↵Jonathan Brouwer-2/+3
infrastructure Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-12Port `#[automatically_derived]` to the new attribute parsing infrastructureJonathan Brouwer-1/+4
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-11Fix ICE for parsed attributes with longer path not handled by CheckAttrVisitorJonathan Brouwer-0/+5
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-09Port `#[rustc_coherence_is_core]` to the new attribute systemPavel Grigorenko-3/+4
2025-07-09Port `#[rustc_allow_incoherent_impl]` to the new attribute systemPavel Grigorenko-3/+5
2025-07-09Port `#[rustc_paren_sugar]` to the new attribute systemPavel Grigorenko-2/+3
2025-07-09Port `#[fundamental]` to the new attribute systemPavel Grigorenko-2/+3
2025-07-09Port `#[marker]` to the new attribute systemPavel Grigorenko-1/+2
2025-07-09Port `#[rustc_unsafe_specialization_marker]` to the new attribute systemPavel Grigorenko-0/+2
2025-07-09Port `#[rustc_specialization_trait]` to the new attribute systemPavel Grigorenko-1/+2
2025-07-09Port `#[type_const]` to the new attribute systemPavel Grigorenko-1/+2
2025-07-09Port `#[rustc_coinductive]` to the new attribute systemPavel Grigorenko-1/+2
2025-07-09Port `#[rustc_do_not_implement_via_object]` to the new attribute systemPavel Grigorenko-1/+3
2025-07-09Port `#[rustc_deny_explicit_impl]` to the new attribute systemPavel Grigorenko-1/+4
2025-07-09Port `#[const_trait]` to the new attribute systemPavel Grigorenko-1/+2
2025-07-08Rollup merge of #143593 - mejrs:dummy, r=jdonszelmannMatthias Krüger-0/+2
Port #[rustc_dummy] r? ``@jdonszelmann``
2025-07-07Port #[rustc_dummy]mejrs-0/+2
2025-07-07Port `#[rustc_std_internal_symbol]` to the new attribute systemPavel Grigorenko-0/+2
2025-07-07Port `#[ffi_pure]` to the new attribute systemPavel Grigorenko-1/+2
2025-07-07Port `#[ffi_const]` to the new attribute systemPavel Grigorenko-1/+4
2025-07-07Port `#[export_stable]` to the new attribute systemPavel Grigorenko-1/+2
2025-07-06Port `#[path]` to the new attribute parsing infrastructureJonathan Brouwer-0/+2
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06Rewrite empty attribute lintJonathan Brouwer-0/+10
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-05Port `#[ignore]` to the new attribute parsing infrastructureJonathan Brouwer-0/+2
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-04Port `#[non_exhaustive]` to the new attribute parsing infrastructureJonathan Brouwer-0/+2
2025-07-04Rollup merge of #143400 - GrigorenkoPV:attributes/lints, r=jdonszelmannMatthias Krüger-1/+2
Port `#[rustc_pass_by_value]` to the new attribute system Part of rust-lang/rust#131229 r? `@oli-obk`
2025-07-04Port `#[rustc_pass_by_value]` to the new attribute systemPavel Grigorenko-1/+2
2025-07-03Port `#[no_implicit_prelude]` to the new attribute parsing infrastructureJonathan Brouwer-0/+2
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-03Rollup merge of #142876 - JonathanBrouwer:target_feature_parser, r=oli-obkJana Dönszelmann-2/+3
Port `#[target_feature]` to new attribute parsing infrastructure Ports `target_feature` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? ``@jdonszelmann``
2025-07-03Rollup merge of #134006 - klensy:typos, r=nnethercoteJana Dönszelmann-1/+1
setup typos check in CI This allows to check typos in CI, currently for compiler only (to reduce commit size with fixes). With current setup, exclude list is quite short, so it worth trying? Also includes commits with actual typo fixes. MCP: https://github.com/rust-lang/compiler-team/issues/817 typos check currently turned for: * ./compiler * ./library * ./src/bootstrap * ./src/librustdoc After merging, PRs which enables checks for other crates (tools) can be implemented too. Found typos will **not break** other jobs immediately: (tests, building compiler for perf run). Job will be marked as red on completion in ~ 20 secs, so you will not forget to fix it whenever you want, before merging pr. Check typos: `python x.py test tidy --extra-checks=spellcheck` Apply typo fixes: `python x.py test tidy --extra-checks=spellcheck:fix` (in case if there only 1 suggestion of each typo) Current fail in this pr is expected and shows how typo errors emitted. Commit with error will be removed after r+.
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-1/+1
2025-07-03Port `#[target_feature]` to the new attribute parsing infrastructureJonathan Brouwer-2/+3
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-02Rollup merge of #142964 - GrigorenkoPV:attributes/argless, r=oli-obkMatthias Krüger-10/+12
Attribute rework: a parser for single attributes without arguments Part of rust-lang/rust#131229 r? `@jdonszelmann` I think code (with comments) speaks for itself. The only subtlety: now `#[cold]`, `#[no_mangle]`, & `#[track_caller]` do not get thrown away when malformed (i.e. have arguments). This doesn't matter too much (I think), because an error gets emitted either way, so the compilation will not finish.
2025-07-01Port `#[rustc_object_lifetime_default]` to the new attribute parsing ↵Jonathan Brouwer-0/+2
infrastructure
2025-07-01Auto merge of #142921 - JonathanBrouwer:rustc_attributes_parser, r=oli-obkbors-0/+15
Port `#[rustc_layout_scalar_valid_range_start/end]` to the new attrib… Ports `rustc_layout_scalar_valid_range_start` and `rustc_layout_scalar_valid_range_end` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? `@jdonszelmann`
2025-06-30NoArgsAttributeParserPavel Grigorenko-10/+12