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

Tracking Issue for -Z crate-attr #138287

Open
6 tasks
jyn514 opened this issue Mar 9, 2025 · 2 comments
Open
6 tasks

Tracking Issue for -Z crate-attr #138287

jyn514 opened this issue Mar 9, 2025 · 2 comments
Labels
-Zcrate-attr Unstable option: -Zcrate-attr A-CLI Area: Command-line interface (CLI) to the compiler C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Mar 9, 2025

This is a tracking issue for the -Z crate-attr unstable option.

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.

Steps

Unresolved Questions

  • this likely needs an RFC, since it landed without much discussion? i am tentatively planning to do this at the same time as an RFC for #![register_tool].
  • probably we will want to limit the syntax? for example, -Z crate-attr='crate_name= /* foo */ "test"' is currently accepted without warning, and -Z crate-attr='crate_name=/*' gives an error about an unterminated block comment.
  • fix interactions with doctests: rustdoc --test does not respect -Zcrate-attr #138491
  • we should improve diagnostics; currently we treat the attribute as surrounded by #![ /*...*/ ], but don't show the surrounding code in the error:
; rustc src/main.rs -Z crate-attr='#![crate_name="test"]'
error: expected identifier, found `#`
 --> <crate attribute>:1:1
  |
1 | #![crate_name="test"]
  | ^ expected identifier

Implementation history

@jyn514 jyn514 added the C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC label Mar 9, 2025
@jyn514
Copy link
Member Author

jyn514 commented Mar 9, 2025

some places where this has been mentioned as useful:

@fmease
Copy link
Member

fmease commented Mar 9, 2025

we have a bunch of attributes that are duplicated as flags

--edition

Not edition, there's no #![edition = …] (but it used to exist a long time ago for a brief period iirc)

@fmease fmease added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-CLI Area: Command-line interface (CLI) to the compiler labels Mar 9, 2025
@jieyouxu jieyouxu added the -Zcrate-attr Unstable option: -Zcrate-attr label Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Zcrate-attr Unstable option: -Zcrate-attr A-CLI Area: Command-line interface (CLI) to the compiler C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants