Skip to content

Implement a naming convention for lint/diagnostic-only rustc_ attrs #1021

Description

@WaffleLapkin

Proposal

Make a naming convention such that all all rustc_ attributes that are used only for lint/diagnostic purposes are clearly distinguished from all other rustc_ attributes hich might have semantic implications.

This will make it clear that the lint/diagnostic-only attributes do not affect semantics and are not (as) important.

Personal anecdote

I was just reading sources of UnsafeCell and saw #[rustc_as_ptr] and #[rustc_never_returns_null_ptr] and had a minor heart attack thinking #[rustc_never_returns_null_ptr] changes the LLVM ir to exclude 0 from the valid range of the return (similarly to something I just removed some months ago: rust-lang/rust#154327).

However, it looks like both of these attributes are only used for lints.

Alternative

Add a #[rustc_diagnostic_item_group(...)] similarly to #[rustc_diagnostic_item], but allowing multiple items to have the same "diagnostic group", such that we have a unified way for lints to special-case certain item groups.

Mentors or Reviewers

If you have a reviewer or mentor in mind for this work, mention them here. You can put your own name here if you are planning to mentor the work.

Process

The main points of the Major Change Process are as follows:

  • File an issue describing the proposal.
  • A compiler team member who is knowledgeable in the area can second by writing @rustbot second or kickoff a team FCP with @rfcbot fcp $RESOLUTION.
  • Once an MCP is seconded, the Final Comment Period begins.
    • Final Comment Period lasts for 10 days after all outstanding concerns are solved.
    • Outstanding concerns will block the Final Comment Period from finishing. Once all concerns are resolved, the 10 day countdown is restarted.
    • If no concerns are raised after 10 days since the resolution of the last outstanding concern, the MCP is considered approved.

You can read more about Major Change Proposals on forge.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerAdd this label so rfcbot knows to poll the compiler teammajor-changeA proposal to make a major change to rustcmajor-change-acceptedA major change proposal that was accepted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions