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

add test to reproduce #137687 and fix it by converting #[crate_name] to a new-style attribute parser #137729

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

Conversation

jdonszelmann
Copy link
Contributor

r? @fmease

Closes #137687

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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 Feb 27, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@jdonszelmann jdonszelmann force-pushed the fix-137687 branch 2 times, most recently from 4e90cee to 21838d5 Compare February 27, 2025 16:51
Comment on lines +179 to +180
name: Symbol,
name_span: Span,
Copy link
Member

Choose a reason for hiding this comment

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

This could theoretically use Spanned but it doesn't necessarily lead to more readable code (and I don't remember if it's compatible with translatable diagnostics).

Suggested change
name: Symbol,
name_span: Span,
name: Symbol,
name_span: Span,

pub(crate) struct CratenameParser;

impl SingleAttributeParser for CratenameParser {
const PATH: &'static [Symbol] = &[sym::crate_name];
Copy link
Member

Choose a reason for hiding this comment

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

FYI: You generally no longer need to explicitly state 'static in the ty of assoc consts.


fn on_duplicate(cx: &AcceptContext<'_>, first_span: Span) {
// FIXME(jdonszelmann): better duplicate reporting (WIP)
cx.emit_err(UnusedMultiple {
Copy link
Member

Choose a reason for hiding this comment

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

Duplicates are warnings on master, right? So this is a breaking change?

@jdonszelmann
Copy link
Contributor Author

@fmease and I decided to delay this PR for a bit until more diagnostic infra for attrs lands (hopefully next week) to make the duplicate error a warning to be consistent with current master.

@fmease fmease added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 6, 2025
@fmease
Copy link
Member

fmease commented Mar 6, 2025

r=fmease,bjorn3 once that PR lands and you can downgrade the error to a lint warning again.

@bors delegate+

@bors
Copy link
Contributor

bors commented Mar 6, 2025

✌️ @jdonszelmann, you can now approve this pull request!

If @fmease told you to "r=me" after making some further change, please make that change, then do @bors r=@fmease

@bors
Copy link
Contributor

bors commented Mar 13, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) S-blocked Status: Blocked on something else such as an RFC or other implementation work. 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.

ICE: expr in place where literal is expected (builtin attr parsing)
6 participants