Skip to content

replace box_patterns in the compiler with deref_patterns #984

@cyrgani

Description

@cyrgani

Proposal

A lot of types in the compiler are wrapped in Boxes. To make matching on them more ergonomic, the box_patterns (tracking issue) feature is used at the moment. The current plan for this feature is that it will not be stabilized; instead, deref_patterns (tracking issue) supersedes it.

I propose to replace the usage of box_patterns in the compiler with deref_patterns. This has several advantages:

  • It makes it possible to remove box_patterns entirely in the future
  • It removes the need for using the weird box keyword in the compiler, making the code slightly easier to read
  • We might find possible bugs in the deref_patterns implementation by using it in practice

The feature was previously moved from incomplete to unstable in rust-lang/rust#153053.

Mentors or Reviewers

I am willing to create the PRs that update the affected compiler crates to use the newer feature.

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.

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 acceptedto-announceAnnounce this issue on triage meeting

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions