2022-01-23 18:34:46 -06:00
|
|
|
//@ edition:2018
|
2023-03-09 14:54:53 -06:00
|
|
|
#![forbid(internal_features, unsafe_code)]
|
2022-01-23 18:34:46 -06:00
|
|
|
#![feature(unsafe_pin_internals)]
|
2023-03-09 14:54:53 -06:00
|
|
|
//~^ ERROR the feature `unsafe_pin_internals` is internal to the compiler or standard library
|
2022-01-23 18:34:46 -06:00
|
|
|
|
|
|
|
use core::{marker::PhantomPinned, pin::Pin};
|
|
|
|
|
|
|
|
/// The `unsafe_pin_internals` is indeed unsound.
|
|
|
|
fn non_unsafe_pin_new_unchecked<T>(pointer: &mut T) -> Pin<&mut T> {
|
2024-01-16 13:58:42 -06:00
|
|
|
Pin { __pointer: pointer }
|
2022-01-23 18:34:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut self_referential = PhantomPinned;
|
|
|
|
let _: Pin<&mut PhantomPinned> = non_unsafe_pin_new_unchecked(&mut self_referential);
|
|
|
|
}
|