diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2020-10-09 00:06:39 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2020-10-09 00:06:39 +0200 |
| commit | 390883e888c580d054ab4a2584c851aba50865e9 (patch) | |
| tree | 617b23cb9d694949378ced28dfe9929fae446b73 | |
| parent | 64839ee00ab4076d797901ddea55f2613c5b75b5 (diff) | |
| download | rust-390883e888c580d054ab4a2584c851aba50865e9.tar.gz rust-390883e888c580d054ab4a2584c851aba50865e9.zip | |
Make Pin::new_static const.
| -rw-r--r-- | library/core/src/pin.rs | 3 |
1 files changed, 2 insertions, 1 deletions
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<T: ?Sized> 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) } |
