Skip to content

Tracking Issue for -Z crate-attr #138287

@jyn514

Description

@jyn514

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    -Zcrate-attrUnstable option: -Zcrate-attrA-CLIArea: Command-line interface (CLI) to the compilerB-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-impl-incompleteStatus: The implementation is incomplete.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions