Skip to content

Commit 390883e

Browse files
committed
Make Pin::new_static const.
1 parent 64839ee commit 390883e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/pin.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,8 @@ impl<T: ?Sized> Pin<&'static T> {
787787
/// This is safe, because the `'static` lifetime guarantees the data will
788788
/// never be moved.
789789
#[unstable(feature = "pin_static_ref", issue = "none")]
790-
pub fn new_static(r: &'static T) -> Pin<&'static T> {
790+
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
791+
pub const fn new_static(r: &'static T) -> Pin<&'static T> {
791792
// SAFETY: The 'static lifetime guarantees the data will not be
792793
// moved/invalidated until it gets dropped (which is never).
793794
unsafe { Pin::new_unchecked(r) }

0 commit comments

Comments
 (0)