Tracking Issue for -Z crate-attr
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
This is a tracking issue for the -Z crate-attr unstable option (RFC 3791).
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
- Adjust documentation (see instructions on rustc-dev-guide)
- Stabilization PR (see instructions on rustc-dev-guide)
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,explicitly rejected by the RFC-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: https://github.com/rust-lang/rust/issues/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
- fix lint controls to desugar to
crate-attr, as described in the RFC - test that editions and
file!/line!/column!behave as specified in the RFC
Implementation history
- Initial implementation: https://github.com/rust-lang/rust/pull/52355
- Recommended in other diagnostics: https://github.com/rust-lang/rust/pull/114959
- Documentation and tests: https://github.com/rust-lang/rust/pull/138288
- Improve diagnostics for crate-attr itself: https://github.com/rust-lang/rust/pull/138336
- Fix rustdoc support: https://github.com/rust-lang/rust/pull/147292
- Additional tests: https://github.com/rust-lang/rust/pull/160145
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read RFC 3791 and the rustc-dev-guide instructions linked in the checklist, then review the remaining lint-control and edition/file!/line!/column! requirements. Done means those behaviors are tested, the documentation is updated, and a stabilization PR is prepared.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100