Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hir attributes #131808

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

jdonszelmann
Copy link
Contributor

@jdonszelmann jdonszelmann commented Oct 17, 2024

This PR needs some explanation, it's somewhat large.

  • This is step one as described in Attribute handling reworks compiler-team#796. I've added a new hir::Attribute which is a lowered version of ast::Attribute. Right now, this has few concrete effects, however every place that after this PR parses a hir::Attribute should later get a pre-parsed attribute as described in Attribute handling reworks compiler-team#796 and transitively Refactoring attributes in the compiler #131229.
  • an extension trait AttributeExt is added, which is implemented for both ast::Attribute and hir::Atribute. This makes hir::Attributes mostly compatible with code that used to parse ast::Attribute. All its methods are also added as inherent methods to avoid having to import the trait everywhere in the compiler.
    • Incremental can not not hash ast::Attribute at all.

@rustbot

This comment was marked as resolved.

@rustbot

This comment was marked as outdated.

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-rustdoc-json Area: Rustdoc JSON backend PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Oct 17, 2024
@rust-log-analyzer

This comment has been minimized.

compiler/rustc_ast/src/ast.rs Outdated Show resolved Hide resolved
compiler/rustc_ast/src/ast.rs Outdated Show resolved Hide resolved
compiler/rustc_ast/src/ast.rs Show resolved Hide resolved
compiler/rustc_hir/src/hir.rs Outdated Show resolved Hide resolved
@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-release Relevant to the release subteam, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Oct 17, 2024
@jdonszelmann jdonszelmann force-pushed the hir-attributes branch 4 times, most recently from cf3179b to e3133bb Compare October 17, 2024 06:52
@petrochenkov petrochenkov self-assigned this Oct 17, 2024
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@xFrednet xFrednet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Clippy changes look good to me :D

=^.^=

@jdonszelmann jdonszelmann marked this pull request as ready for review October 17, 2024 18:44
@rustbot

This comment was marked as resolved.

@jdonszelmann jdonszelmann force-pushed the hir-attributes branch 2 times, most recently from 1920abd to cefa0ea Compare October 17, 2024 22:02
@cjgillot cjgillot self-assigned this Oct 17, 2024
@nnethercote

This comment was marked as resolved.

@bors

This comment was marked as resolved.

@bors

This comment was marked as resolved.

@rustbot

This comment was marked as outdated.

@jdonszelmann jdonszelmann force-pushed the hir-attributes branch 2 times, most recently from f080616 to 92d262d Compare November 5, 2024 10:43
@jdonszelmann

This comment was marked as resolved.

@bors

This comment was marked as resolved.

@oli-obk oli-obk self-assigned this Dec 2, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Dec 2, 2024
Change `AttrArgs::Eq` to a struct variant

Cleanups for simplifying rust-lang#131808

Basically changes `AttrArgs::Eq` to a struct variant and then avoids several matches on `AttrArgsEq` in favor of methods on it. This will make future refactorings simpler, as they can either keep methods or switch to field accesses without having to restructure code
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 3, 2024
Rollup merge of rust-lang#133746 - oli-obk:push-xwyrylxmrtvq, r=jieyouxu

Change `AttrArgs::Eq` to a struct variant

Cleanups for simplifying rust-lang#131808

Basically changes `AttrArgs::Eq` to a struct variant and then avoids several matches on `AttrArgsEq` in favor of methods on it. This will make future refactorings simpler, as they can either keep methods or switch to field accesses without having to restructure code
@oli-obk
Copy link
Contributor

oli-obk commented Dec 3, 2024

I rebased the PR, reordered some commits and squashed the clippy/rustdoc/rustfmt commits into the main commit. Each commit now builds on its own and does the minimal work necessary to get to a new compiling state. The middle commit is subsequently huge, but that's unavoidable for something like adding hir::Attribute

@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 3, 2024
@jieyouxu jieyouxu assigned jieyouxu and unassigned jieyouxu Dec 3, 2024
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Dec 4, 2024
Change `AttrArgs::Eq` to a struct variant

Cleanups for simplifying rust-lang/rust#131808

Basically changes `AttrArgs::Eq` to a struct variant and then avoids several matches on `AttrArgsEq` in favor of methods on it. This will make future refactorings simpler, as they can either keep methods or switch to field accesses without having to restructure code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-rustdoc-json Area: Rustdoc JSON backend PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-release Relevant to the release subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.