-
Notifications
You must be signed in to change notification settings - Fork 74
Eliminate ast::ptr::P #878
Copy link
Copy link
Closed
Labels
T-compilerAdd this label so rfcbot knows to poll the compiler teamAdd this label so rfcbot knows to poll the compiler teammajor-changeA proposal to make a major change to rustcA proposal to make a major change to rustcmajor-change-acceptedA major change proposal that was acceptedA major change proposal that was accepted
Metadata
Metadata
Assignees
Labels
T-compilerAdd this label so rfcbot knows to poll the compiler teamAdd this label so rfcbot knows to poll the compiler teammajor-changeA proposal to make a major change to rustcA proposal to make a major change to rustcmajor-change-acceptedA major change proposal that was acceptedA major change proposal that was accepted
Type
Fields
Give feedbackNo fields configured for issues without a type.
Proposal
ast::ptr::Pwas added in rust-lang/rust#13316, in the year 2014 CE. It was created as an alternative to the now-defunct@T. It is a thin wrapper aroundBoxand is used in many parts of the AST. It has a moderate-sized API, but a lot of the operations are unused, and the rest are barely used and easily replaced withBoxoperations.At this point
Pjust a useless layer of indirection and obfuscation. Many direct uses ofBoxhave crept into the AST alongside the uses ofP.Boxis superior in every way except brevity. (Especially box patterns!)Proposed transition:
P::map.P<[T]>.P<[T]>operations.P<T>operations (most of them).P<T>to a typedef ofBox<T>, plus thePconstructor fn.P<T>, by mass-convertingP<T>toBox<T>andP(x)calls toBox::new(x).rust-lang/rust#141603 does the first five steps.
Mentors or Reviewers
N/A
Process
The main points of the Major Change Process are as follows:
@rustbot second.-C flag, then full team check-off is required.@rfcbot fcp mergeon either the MCP or the PR.You can read more about Major Change Proposals on forge.