Eliminate ast::ptr::P
#878
Labels
final-comment-period
The FCP has started, most (if not all) team members are in agreement
major-change
A proposal to make a major change to rustc
T-compiler
Add this label so rfcbot knows to poll the compiler team
Proposal
ast::ptr::P
was 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 aroundBox
and 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 withBox
operations.At this point
P
just a useless layer of indirection and obfuscation. Many direct uses ofBox
have crept into the AST alongside the uses ofP
.Box
is 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 theP
constructor 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 merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
The text was updated successfully, but these errors were encountered: