Tweak some of our internal #[rustc_*] TEST attributes#153300
Merged
rust-bors[bot] merged 7 commits intorust-lang:mainfrom Mar 5, 2026
Merged
Tweak some of our internal #[rustc_*] TEST attributes#153300rust-bors[bot] merged 7 commits intorust-lang:mainfrom
#[rustc_*] TEST attributes#153300rust-bors[bot] merged 7 commits intorust-lang:mainfrom
Conversation
Collaborator
|
Some changes occurred in compiler/rustc_attr_parsing cc @jdonszelmann, @JonathanBrouwer Some changes occurred in compiler/rustc_hir/src/attrs cc @jdonszelmann, @JonathanBrouwer The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes. cc @BoxyUwU, @jieyouxu, @Kobzol, @tshepang Some changes occurred in compiler/rustc_passes/src/check_attr.rs |
#[rustc_*] TEST attributes
36414b9 to
4de4b61
Compare
…iance}]` * `#[dump_predicates]` works on any definition for which query `predicates_of` returns a useful (!) result * `#[rustc_object_lifetime_default]` works on any definition for which query `object_lifetime_default` returns a useful (!) result for type parameters * `#[rustc_variance]` works on any definition for which query `variances_of` returns a useful (!) result When these attributes were ported to the new attribute parsing API, their targets were unnecessarily restricted.
…the wrong item kind Attr parsing already reports an error for this, an subsequent ICE isn't really helpful. Side note: We certainly don't want convert the `bug!(…)`s in the respective queries to delayed bugs! It's imperative that these queries eagerly complain about misuse to prevent dormant bugs!
…etime_defaults]`
4de4b61 to
722fcbb
Compare
jdonszelmann
reviewed
Mar 2, 2026
Contributor
|
@bors r+ rollup |
Contributor
rust-bors bot
pushed a commit
that referenced
this pull request
Mar 4, 2026
…uwer Rollup of 12 pull requests Successful merges: - #153402 (miri subtree update) - #152164 (Lint unused features) - #152801 (Refactor WriteBackendMethods a bit) - #153196 (Update path separators to be available in const context) - #153204 (Add `#[must_use]` attribute to `HashMap` and `HashSet` constructors) - #153317 (Abort after `representability` errors) - #153276 (Remove `cycle_fatal` query modifier) - #153300 (Tweak some of our internal `#[rustc_*]` TEST attributes) - #153396 (use `minicore` in some `run-make` tests) - #153401 (Migrationg of `LintDiagnostic` - part 7) - #153406 (Remove a ping for myself) - #153414 (Rename translation -> formatting)
rust-bors bot
pushed a commit
that referenced
this pull request
Mar 4, 2026
…uwer Rollup of 12 pull requests Successful merges: - #153402 (miri subtree update) - #152164 (Lint unused features) - #152801 (Refactor WriteBackendMethods a bit) - #153196 (Update path separators to be available in const context) - #153204 (Add `#[must_use]` attribute to `HashMap` and `HashSet` constructors) - #153317 (Abort after `representability` errors) - #153276 (Remove `cycle_fatal` query modifier) - #153300 (Tweak some of our internal `#[rustc_*]` TEST attributes) - #153396 (use `minicore` in some `run-make` tests) - #153401 (Migrationg of `LintDiagnostic` - part 7) - #153406 (Remove a ping for myself) - #153414 (Rename translation -> formatting)
rust-bors bot
pushed a commit
that referenced
this pull request
Mar 4, 2026
…uwer Rollup of 12 pull requests Successful merges: - #153402 (miri subtree update) - #152164 (Lint unused features) - #152801 (Refactor WriteBackendMethods a bit) - #153196 (Update path separators to be available in const context) - #153204 (Add `#[must_use]` attribute to `HashMap` and `HashSet` constructors) - #153317 (Abort after `representability` errors) - #153276 (Remove `cycle_fatal` query modifier) - #153300 (Tweak some of our internal `#[rustc_*]` TEST attributes) - #153396 (use `minicore` in some `run-make` tests) - #153401 (Migrationg of `LintDiagnostic` - part 7) - #153406 (Remove a ping for myself) - #153414 (Rename translation -> formatting)
rust-bors bot
pushed a commit
that referenced
this pull request
Mar 5, 2026
…uwer Rollup of 12 pull requests Successful merges: - #153402 (miri subtree update) - #152164 (Lint unused features) - #152801 (Refactor WriteBackendMethods a bit) - #153196 (Update path separators to be available in const context) - #153204 (Add `#[must_use]` attribute to `HashMap` and `HashSet` constructors) - #153317 (Abort after `representability` errors) - #153276 (Remove `cycle_fatal` query modifier) - #153300 (Tweak some of our internal `#[rustc_*]` TEST attributes) - #153396 (use `minicore` in some `run-make` tests) - #153401 (Migrationg of `LintDiagnostic` - part 7) - #153406 (Remove a ping for myself) - #153414 (Rename translation -> formatting)
rust-timer
added a commit
that referenced
this pull request
Mar 5, 2026
Rollup merge of #153300 - fmease:test-attrs-tweaks, r=JonathanBrouwer Tweak some of our internal `#[rustc_*]` TEST attributes I think I might be the one who's used the internal TEST attrs `#[rustc_{dump_predicates,object_lifetime_default,outlives,variance}]` the most in recent times, I might even be the only one. As such I've noticed some recent-ish issues that haven't been fixed so far and which keep bothering me. Moreover I have a longstanding urge to rename several of these attributes which I couldn't contain anymore. [`#[rustc_*]` TEST attributes](https://rustc-dev-guide.rust-lang.org/compiler-debugging.html#rustc_-test-attributes) are internal attributes that basically allow you to dump the output of specific queries for use in UI tests or for debugging purposes. 1. When some of these attributes were ported over to the new parsing API, their targets were unnecessarily restricted. I've kept encountering these incorrect "attribute cannot be used" errors all the while HIR analysis happily & correctly dumped the requested data below it. I've now relaxed their targets. 2. Since we now have target checking for the internal attributes I figured that it's unhelpful if we still intentionally crashed on invalid targets, so I've got rid of that. 3. I've always been annoyed that most of these (very old) attributes don't contain the word `dump` in their name (rendering their purpose non-obvious) and that some of their names diverge quite a bit from the corresponding query name. I've now rectified that. The new names take longer to type but it's still absolutely acceptable imo. --- I haven't renamed all of the TEST attributes to follow the `rustc_dump_` scheme since that's quite tedious. If it's okay with you I'd like to postpone that (e.g., `rustc_{def_path,hidden_type…,layout,regions,symbol_name}`). I've noticed that the parsers for TEST attrs are spread across `rustc_dump.rs`, `rustc_internal.rs` & `test_attrs.rs` which is a bit confusing. Since the new names are prefixed with `rustc_dump_` I've moved their parsers into `rustc_dump.rs` but of course they are still TEST attrs. IIRC, `test_attrs.rs` also contains non-`rustc_`-TEST attrs, so we can't just merge these two files. I guess that'll sort itself out in the future when I tackle the other internal TEST attrs. r\? Jana || Jonathan
github-actions bot
pushed a commit
to rust-lang/rust-analyzer
that referenced
this pull request
Mar 5, 2026
…uwer Rollup of 12 pull requests Successful merges: - rust-lang/rust#153402 (miri subtree update) - rust-lang/rust#152164 (Lint unused features) - rust-lang/rust#152801 (Refactor WriteBackendMethods a bit) - rust-lang/rust#153196 (Update path separators to be available in const context) - rust-lang/rust#153204 (Add `#[must_use]` attribute to `HashMap` and `HashSet` constructors) - rust-lang/rust#153317 (Abort after `representability` errors) - rust-lang/rust#153276 (Remove `cycle_fatal` query modifier) - rust-lang/rust#153300 (Tweak some of our internal `#[rustc_*]` TEST attributes) - rust-lang/rust#153396 (use `minicore` in some `run-make` tests) - rust-lang/rust#153401 (Migrationg of `LintDiagnostic` - part 7) - rust-lang/rust#153406 (Remove a ping for myself) - rust-lang/rust#153414 (Rename translation -> formatting)
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
Mar 5, 2026
…uwer Rollup of 12 pull requests Successful merges: - rust-lang/rust#153402 (miri subtree update) - rust-lang/rust#152164 (Lint unused features) - rust-lang/rust#152801 (Refactor WriteBackendMethods a bit) - rust-lang/rust#153196 (Update path separators to be available in const context) - rust-lang/rust#153204 (Add `#[must_use]` attribute to `HashMap` and `HashSet` constructors) - rust-lang/rust#153317 (Abort after `representability` errors) - rust-lang/rust#153276 (Remove `cycle_fatal` query modifier) - rust-lang/rust#153300 (Tweak some of our internal `#[rustc_*]` TEST attributes) - rust-lang/rust#153396 (use `minicore` in some `run-make` tests) - rust-lang/rust#153401 (Migrationg of `LintDiagnostic` - part 7) - rust-lang/rust#153406 (Remove a ping for myself) - rust-lang/rust#153414 (Rename translation -> formatting)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I think I might be the one who's used the internal TEST attrs
#[rustc_{dump_predicates,object_lifetime_default,outlives,variance}]the most in recent times, I might even be the only one. As such I've noticed some recent-ish issues that haven't been fixed so far and which keep bothering me. Moreover I have a longstanding urge to rename several of these attributes which I couldn't contain anymore.#[rustc_*]TEST attributes are internal attributes that basically allow you to dump the output of specific queries for use in UI tests or for debugging purposes.dumpin their name (rendering their purpose non-obvious) and that some of their names diverge quite a bit from the corresponding query name. I've now rectified that. The new names take longer to type but it's still absolutely acceptable imo.I haven't renamed all of the TEST attributes to follow the
rustc_dump_scheme since that's quite tedious. If it's okay with you I'd like to postpone that (e.g.,rustc_{def_path,hidden_type…,layout,regions,symbol_name}).I've noticed that the parsers for TEST attrs are spread across
rustc_dump.rs,rustc_internal.rs&test_attrs.rswhich is a bit confusing. Since the new names are prefixed withrustc_dump_I've moved their parsers intorustc_dump.rsbut of course they are still TEST attrs. IIRC,test_attrs.rsalso contains non-rustc_-TEST attrs, so we can't just merge these two files. I guess that'll sort itself out in the future when I tackle the other internal TEST attrs.r? Jana || Jonathan