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

Validate proc macro attributes in AST validation #108859

Closed
wants to merge 2 commits into from

Conversation

cjgillot
Copy link
Contributor

@cjgillot cjgillot commented Mar 7, 2023

This avoids visiting the crate in proc-macro expansion just for error reporting.

I'm not sure what to do in the #[test] case.

r? @petrochenkov

@rustbot rustbot added 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. labels Mar 7, 2023
@petrochenkov
Copy link
Contributor

This avoids visiting the crate in proc-macro expansion just for error reporting.

Sorry, I don't understand, it looks like we are still visiting the crate in compiler/rustc_builtin_macros/src/proc_macro_harness.rs, even more than before (no has_proc_macro_decls shortcut now).

I'm not sure what to do in the #[test] case.

Could you elaborate, what's wrong with the #[test] (--test?) case?

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 9, 2023
@@ -799,9 +862,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
}

fn visit_item(&mut self, item: &'a Item) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, what happens if the proc-macro attributes are put on non-items?

@bors
Copy link
Contributor

bors commented Mar 23, 2023

☔ The latest upstream changes (presumably #109503) made this pull request unmergeable. Please resolve the merge conflicts.

@JohnCSimon
Copy link
Member

@cjgillot
ping from triage - can you post your status on this PR? There hasn't been an update in a few months. Thanks!

@cjgillot cjgillot closed this Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants