]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/issue-66345.rs
Do not suggest `let_else` if no bindings would be introduced
[rust.git] / src / test / ui / consts / issue-66345.rs
1 // run-pass
2 // compile-flags: -Z mir-opt-level=4
3
4 // Checks that the compiler does not ICE when passing references to field of by-value struct
5 // with -Z mir-opt-level=4
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 }