]> git.lizzy.rs Git - rust.git/blob - src/test/ui/deref-suggestion.rs
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / deref-suggestion.rs
1 macro_rules! borrow {
2     ($x:expr) => { &$x } //~ ERROR mismatched types
3 }
4
5 fn foo(_: String) {}
6
7 fn foo2(s: &String) {
8     foo(s);
9     //~^ ERROR mismatched types
10 }
11
12 fn foo3(_: u32) {}
13 fn foo4(u: &u32) {
14     foo3(u);
15     //~^ ERROR mismatched types
16 }
17
18 fn main() {
19     let s = String::new();
20     let r_s = &s;
21     foo2(r_s);
22     foo(&"aaa".to_owned());
23     //~^ ERROR mismatched types
24     foo(&mut "aaa".to_owned());
25     //~^ ERROR mismatched types
26     foo3(borrow!(0));
27     foo4(&0);
28     assert_eq!(3i32, &3i32);
29     //~^ ERROR mismatched types
30 }