Make Pin::new_static const.
This commit is contained in:
parent
64839ee00a
commit
390883e888
@ -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) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user