]> git.lizzy.rs Git - rust.git/blob - tests/ui/coercion/coerce-block-tail-57749.rs
Rollup merge of #106958 - jyn514:labels, r=m-ou-se
[rust.git] / tests / ui / coercion / coerce-block-tail-57749.rs
1 // check-fail
2 use std::ops::Deref;
3
4 fn main() {
5     fn save(who: &str) {
6         println!("I'll save you, {}!", who);
7     }
8
9     struct Madoka;
10
11     impl Deref for Madoka {
12         type Target = str;
13         fn deref(&self) -> &Self::Target {
14             "Madoka"
15         }
16     }
17
18     save(&{ Madoka });
19
20     fn reset(how: &u32) {
21         println!("Reset {} times", how);
22     }
23
24     struct Homura;
25
26     impl Deref for Homura {
27         type Target = u32;
28         fn deref(&self) -> &Self::Target {
29             &42
30         }
31     }
32
33     reset(&{ Homura });
34     //~^ ERROR mismatched types
35 }