summaryrefslogtreecommitdiffstats
path: root/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs
blob: 134ea25b75afb853551e3a7b706526392e13c93f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// edition:2018
#![forbid(internal_features, unsafe_code)]
#![feature(unsafe_pin_internals)]
//~^ ERROR the feature `unsafe_pin_internals` is internal to the compiler or standard library

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> {
    Pin { pointer }
}

fn main() {
    let mut self_referential = PhantomPinned;
    let _: Pin<&mut PhantomPinned> = non_unsafe_pin_new_unchecked(&mut self_referential);
}