summaryrefslogtreecommitdiffstats
path: root/tests/ui/transmute/lifetimes.rs
blob: 943191551396de4afc1491f8567317676d6a5798 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// check-pass

use std::ptr::NonNull;

struct Foo<'a, T: ?Sized>(&'a (), NonNull<T>);

fn foo<'a, 'b, T: ?Sized>(x: Foo<'a, T>) -> Foo<'b, T> {
    unsafe { std::mem::transmute(x) }
}

struct Bar<'a, T: ?Sized>(&'a T);

fn bar<'a, 'b, T: ?Sized>(x: Bar<'a, T>) -> Bar<'b, T> {
    unsafe { std::mem::transmute(x) }
}

struct Boo<'a, T: ?Sized>(&'a T, u32);

fn boo<'a, 'b, T: ?Sized>(x: Boo<'a, T>) -> Boo<'b, T> {
    unsafe { std::mem::transmute(x) }
}

fn main() {}