]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-11205.rs
Enable full revision in const generics ui tests
[rust.git] / src / test / ui / issues / issue-11205.rs
1 // run-pass
2 // pretty-expanded FIXME #23616
3
4 #![allow(dead_code)]
5
6 trait Foo { fn dummy(&self) { } }
7 impl Foo for isize {}
8 fn foo(_: [&dyn Foo; 2]) {}
9 fn foos(_: &[&dyn Foo]) {}
10 fn foog<T>(_: &[T], _: &[T]) {}
11
12 fn bar(_: [Box<dyn Foo>; 2]) {}
13 fn bars(_: &[Box<dyn Foo+'static>]) {}
14
15 fn main() {
16     let x: [&dyn Foo; 2] = [&1, &2];
17     foo(x);
18     foo([&1, &2]);
19
20     let r = &1;
21     let x: [&dyn Foo; 2] = [r; 2];
22     foo(x);
23     foo([&1; 2]);
24
25     let x: &[&dyn Foo] = &[&1, &2];
26     foos(x);
27     foos(&[&1, &2]);
28
29     let x: &[&dyn Foo] = &[&1, &2];
30     let r = &1;
31     foog(x, &[r]);
32
33     let x: [Box<dyn Foo>; 2] = [Box::new(1), Box::new(2)];
34     bar(x);
35     bar([Box::new(1), Box::new(2)]);
36
37     let x: &[Box<dyn Foo+'static>] = &[Box::new(1), Box::new(2)];
38     bars(x);
39     bars(&[Box::new(1), Box::new(2)]);
40
41     let x: &[Box<dyn Foo+'static>] = &[Box::new(1), Box::new(2)];
42     foog(x, &[Box::new(1)]);
43
44     struct T<'a> {
45         t: [&'a (dyn Foo+'a); 2]
46     }
47     let _n = T {
48         t: [&1, &2]
49     };
50     let r = &1;
51     let _n = T {
52         t: [r; 2]
53     };
54     let x: [&dyn Foo; 2] = [&1, &2];
55     let _n = T {
56         t: x
57     };
58
59     struct F<'b> {
60         t: &'b [&'b (dyn Foo+'b)]
61     }
62     let _n = F {
63         t: &[&1, &2]
64     };
65     let r = &1;
66     let r: [&dyn Foo; 2] = [r; 2];
67     let _n = F {
68         t: &r
69     };
70     let x: [&dyn Foo; 2] = [&1, &2];
71     let _n = F {
72         t: &x
73     };
74
75     struct M<'a> {
76         t: &'a [Box<dyn Foo+'static>]
77     }
78     let _n = M {
79         t: &[Box::new(1), Box::new(2)]
80     };
81     let x: [Box<dyn Foo>; 2] = [Box::new(1), Box::new(2)];
82     let _n = M {
83         t: &x
84     };
85 }