Skip to content

Commit 9edb1ab

Browse files
m-ou-seMark-Simulacrum
authored andcommitted
Make Pin::new_static const.
1 parent 956238e commit 9edb1ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/pin.rs

+2-1
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)