]> git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-33387.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / issues / issue-33387.rs
1 // run-pass
2 #![feature(rustc_attrs)]
3
4 use std::sync::Arc;
5
6 trait Foo {
7 fn get(&self) -> [u8; 2];
8 }
9
10 impl Foo for [u8; 2] {
11 fn get(&self) -> [u8; 2] {
12 *self
13 }
14 }
15
16 struct Bar<T: ?Sized>(T);
17
18 fn unsize_fat_ptr<'a>(x: &'a Bar<dyn Foo + Send + 'a>) -> &'a Bar<dyn Foo + 'a> {
19 x
20 }
21
22 fn unsize_nested_fat_ptr(x: Arc<dyn Foo + Send>) -> Arc<dyn Foo> {
23 x
24 }
25
26 fn main() {
27 let x: Box<Bar<dyn Foo + Send>> = Box::new(Bar([1,2]));
28 assert_eq!(unsize_fat_ptr(&*x).0.get(), [1, 2]);
29
30 let x: Arc<dyn Foo + Send> = Arc::new([3, 4]);
31 assert_eq!(unsize_nested_fat_ptr(x).get(), [3, 4]);
32 }