Skip to content

Rewrite empty attribute lint for new attribute parser #143252

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JonathanBrouwer
Copy link
Contributor

cc @jdonszelmann

This is blocked on some of the changes from #142876

Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 30, 2025
@bors
Copy link
Collaborator

bors commented Jul 3, 2025

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

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 3, 2025
@@ -285,7 +283,7 @@ pub enum AttributeKind {
PubTransparent(Span),

/// Represents [`#[repr]`](https://doc.rust-lang.org/stable/reference/type-layout.html#representations).
Repr(ThinVec<(ReprAttr, Span)>),
Repr(ThinVec<(ReprAttr, Span)>, Span),
Copy link
Contributor

Choose a reason for hiding this comment

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

could you call this field "first_span"?

Copy link
Contributor

Choose a reason for hiding this comment

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

do you need this field at all if the warning always happens in thiscrate (attr_parsing)

@@ -12,4 +12,5 @@ pub struct AttributeLint<Id> {
pub enum AttributeLintKind {
UnusedDuplicate { this: Span, other: Span, warning: bool },
IllFormedAttributeInput { suggestions: Vec<String> },
EmptyAttribute { span: Span },
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Target::Struct | Target::Union | Target::Enum => {}
Target::Fn | Target::Method(_) => {
self.dcx().emit_err(errors::ReprAlignShouldBeAlign {
span: first_attr_span,
Copy link
Contributor

Choose a reason for hiding this comment

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

right, with repr you need it here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) 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.

4 participants