Skip to content

Check proc_macro attributes on statement items #52367

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 2 commits into from

Conversation

csmoe
Copy link
Member

@csmoe csmoe commented Jul 14, 2018

Closes #52329
r? @petrochenkov

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 14, 2018
@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@petrochenkov
Copy link
Contributor

@csmoe
There are many locations that the check_attr infra doesn't check.
Here's a list collected from hir/mod.rs:

  • generic parameter (GenericParam)
  • let statement (Local)
  • match arm (Arm)
  • expression (Expr)
  • trait item (TraitItem)
  • impl item (ImplItem)
  • enum variant (Variant_)
  • struct field (StructField)
  • item (Item)
  • foreign item (ForeignItem)
  • crate root (Crate)

From these locations only items, expressions and let statements are checked.
So, with this PR as is, proc-macro attributes are checked for items (in proc_macro_registrar) and for let statements (check_attr). Doesn't look like a noticeable improvement.

I think we'll need to build full attr checking infra eventually, but it doesn't seem to worth it for proc-macro attributes alone.
If anything, we can start reporting an unused attribute lint for proc-macro attributes in wrong positions at any time.

I'll close this PR and #52329 as well as wontfix.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants