From 390883e888c580d054ab4a2584c851aba50865e9 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Fri, 9 Oct 2020 00:06:39 +0200 Subject: [PATCH] Make Pin::new_static const. --- library/core/src/pin.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/core/src/pin.rs b/library/core/src/pin.rs index cc93f0fa5fc..3f058124d2b 100644 --- a/library/core/src/pin.rs +++ b/library/core/src/pin.rs @@ -787,7 +787,8 @@ impl Pin<&'static T> { /// This is safe, because the `'static` lifetime guarantees the data will /// never be moved. #[unstable(feature = "pin_static_ref", issue = "none")] - pub fn new_static(r: &'static T) -> Pin<&'static T> { + #[rustc_const_unstable(feature = "const_pin", issue = "76654")] + pub const fn new_static(r: &'static T) -> Pin<&'static T> { // SAFETY: The 'static lifetime guarantees the data will not be // moved/invalidated until it gets dropped (which is never). unsafe { Pin::new_unchecked(r) }