]>
Commit | Line | Data |
---|---|---|
60c5eb7d | 1 | // run-pass |
6a06907d | 2 | // compile-flags: -Z mir-opt-level=4 |
60c5eb7d XL |
3 | |
4 | // Checks that the compiler does not ICE when passing references to field of by-value struct | |
6a06907d | 5 | // with -Z mir-opt-level=4 |
60c5eb7d XL |
6 | |
7 | fn do_nothing(_: &()) {} | |
8 | ||
9 | pub struct Foo { | |
10 | bar: (), | |
11 | } | |
12 | ||
13 | pub fn by_value_1(foo: Foo) { | |
14 | do_nothing(&foo.bar); | |
15 | } | |
16 | ||
17 | pub fn by_value_2<T>(foo: Foo) { | |
18 | do_nothing(&foo.bar); | |
19 | } | |
20 | ||
21 | fn main() { | |
22 | by_value_1(Foo { bar: () }); | |
23 | by_value_2::<()>(Foo { bar: () }); | |
24 | } |