about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-07-03 10:57:39 +0000
committerbors <bors@rust-lang.org>2019-07-03 10:57:39 +0000
commit8c6fb028ca887dff9ec2fe0a90398b6d5bf5fb45 (patch)
tree71228e2259622360b017d90b88686ba181e21856 /src/libsyntax
parent8301de16dafc81a3b5d94aa0707ad83bdb56a599 (diff)
parentc6374cfbe2de22e46b4e7687fa733549114bf070 (diff)
downloadrust-8c6fb028ca887dff9ec2fe0a90398b6d5bf5fb45.tar.gz
rust-8c6fb028ca887dff9ec2fe0a90398b6d5bf5fb45.zip
Auto merge of #61995 - eddyb:hir-sep-ptr, r=petrochenkov
rustc: use a separate copy of P for HIR than for AST.

Note: this currently includes/is based on top of #61987.

Like #61968, but goes one step further and uses a separate `P<...>` for the HIR, with no `Clone`, or the ability to mutate after allocation.
There is still `into_inner`/`into_iter`, but they're only exposed for `hir::lowering`, and they would take more work to untangle.

r? @petrochenkov cc @rust-lang/compiler
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/lib.rs1
-rw-r--r--src/libsyntax/ptr.rs4
2 files changed, 3 insertions, 2 deletions
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index 337b8424736..1fe3dfa40ee 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -12,6 +12,7 @@
 #![deny(unused_lifetimes)]
 
 #![feature(bind_by_move_pattern_guards)]
+#![feature(box_syntax)]
 #![feature(const_fn)]
 #![feature(const_transmute)]
 #![feature(crate_visibility_modifier)]
diff --git a/src/libsyntax/ptr.rs b/src/libsyntax/ptr.rs
index f0cfa5a84a8..be580dc2e6a 100644
--- a/src/libsyntax/ptr.rs
+++ b/src/libsyntax/ptr.rs
@@ -41,11 +41,11 @@ pub struct P<T: ?Sized> {
     ptr: Box<T>
 }
 
-#[allow(non_snake_case)]
 /// Construct a `P<T>` from a `T` value.
+#[allow(non_snake_case)]
 pub fn P<T: 'static>(value: T) -> P<T> {
     P {
-        ptr: Box::new(value)
+        ptr: box value
     }
 }