Repository navigation
Move #[naked] attribute check to attribute parsing stage - #162530
RichardTjokroutomo wants to merge 12 commits into
Conversation
|
Some changes occurred in compiler/rustc_passes/src/check_attr.rs cc @jdonszelmann, @JonathanBrouwer Some changes occurred in compiler/rustc_attr_parsing |
|
Thanks for the pull request, and welcome! The Rust Project has assigned @nnethercote (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks. Please see the contribution instructions and our LLM policy for more information. Why was this reviewer chosen?The reviewer was selected based on:
|
57ae8f4 to
c65aa6f
Compare
This comment has been minimized.
This comment has been minimized.
c65aa6f to
4c2e629
Compare
This comment has been minimized.
This comment has been minimized.
4c2e629 to
ee7a87a
Compare
ee7a87a to
9d144c2
Compare
This comment has been minimized.
This comment has been minimized.
|
Reminder, once the PR becomes ready for a review, use |
9d144c2 to
7e93b9a
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
7e93b9a to
cdc980c
Compare
This comment has been minimized.
This comment has been minimized.
cdc980c to
4fbadae
Compare
dd825f3 to
2d331a2
Compare
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
…functions calling lower_attrs() Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
2d331a2 to
566fa74
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
I just read the LLM guidelines and found out disclosure is needed only if a part of the PR (code, PR desc, etc) is generated by LLM. Since I only use it to learn the codebase, I'll remove the disclosure. |
| WherePredicate(&'a WherePredicate), | ||
|
|
||
| /// Used when it is not possible to get detailed information about the target. | ||
| None, |
There was a problem hiding this comment.
Yeah that makes sense, we can have a 'AstTarget::None` for this case then to keep things simple
Yeah as long as reviewers are not seeing any AI generated output you don't need to disclose. |
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
566fa74 to
f12bf6b
Compare
| &l.attrs, | ||
| l.span, | ||
| Target::Statement, | ||
| rustc_attr_ir::target::AstTarget::None, |
There was a problem hiding this comment.
Why can't this be AstTarget::Statement?
There was a problem hiding this comment.
Sorry... should've checked the caller function
| &attrs, | ||
| span, | ||
| Target::Expression, | ||
| rustc_attr_ir::target::AstTarget::None, |
There was a problem hiding this comment.
Why can't this be AstTarget::Expression?
There was a problem hiding this comment.
I didn't check caller functions, sorry....
| ¶m.attrs, | ||
| param.span, | ||
| Target::Param, | ||
| AstTarget::None, |
There was a problem hiding this comment.
Why can't this be AstTarget::Pram?
There was a problem hiding this comment.
Sorry... I was being careless..
| &f.attrs, | ||
| f.span, | ||
| Target::ExprField, | ||
| AstTarget::Expression(expr), |
There was a problem hiding this comment.
I don't think this is correct
| #[derive(Clone, Copy, Debug)] | ||
| pub enum AstTarget<'a> { | ||
| // Target types that may correspond to different kinds of items. | ||
| Delegation { target: DelegationAstTarget<'a>, mac: bool }, |
There was a problem hiding this comment.
Also here I'm leaning towards that we don't need the fields of this, and it adds a lot of complexity
| pub fn from_ast_item(kind: &'a ast::ItemKind) -> Self { | ||
| match kind { | ||
| ast::ItemKind::ExternCrate(..) => AstTarget::ExternCrate(kind), | ||
| ast::ItemKind::Use(..) => AstTarget::Use(kind), |
There was a problem hiding this comment.
I'd prefer if we map each ItemKind to its field where reasonable.
Like have AstTarget::Use take a UseTree rather than a ast::ItemKind.
| Union(&'a ItemKind), | ||
| Trait(&'a ItemKind), | ||
| TraitAlias(&'a ItemKind), | ||
| Impl { item: &'a ItemKind, of_trait: bool }, |
There was a problem hiding this comment.
Do we need this of_trait field? That should already be stored in the Impl right?
There was a problem hiding this comment.
yeah. It's irrelevant now after the most recent commit
f12bf6b to
4280fe0
Compare
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
4280fe0 to
b567ca0
Compare
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
|
@JonathanBrouwer I think everything is correct now. Let's just wait for CI results... Previously there were a lot of changes when making |
|
@rustbot ready |
View all comments
Following #161482's idea to add
target_itemfield toFinalizeCheckContext, replacetarget_itemwithast_target, which is anenumthat contains all possible types of target Item (obtained by grepping all functions that calllower_attrs()).This change is needed as methods defined under
traits &impls are represented asast::AssocItem. Lastly, movecheck_nakedto the callback returned byNakedParser::deferred_finalize_check().Part of #153101. r?@JonathanBrouwer