]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/issue-66345.rs
New upstream version 1.52.0~beta.3+dfsg1
[rustc.git] / src / test / ui / consts / issue-66345.rs
CommitLineData
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
7fn do_nothing(_: &()) {}
8
9pub struct Foo {
10 bar: (),
11}
12
13pub fn by_value_1(foo: Foo) {
14 do_nothing(&foo.bar);
15}
16
17pub fn by_value_2<T>(foo: Foo) {
18 do_nothing(&foo.bar);
19}
20
21fn main() {
22 by_value_1(Foo { bar: () });
23 by_value_2::<()>(Foo { bar: () });
24}