]> git.lizzy.rs Git - rust.git/blob - src/test/ui/inference/deref-suggestion.stderr
Rollup merge of #99064 - lyming2007:issue-97687-fix, r=estebank
[rust.git] / src / test / ui / inference / deref-suggestion.stderr
1 error[E0308]: mismatched types
2   --> $DIR/deref-suggestion.rs:8:9
3    |
4 LL |     foo(s);
5    |     --- ^- help: try using a conversion method: `.to_string()`
6    |     |   |
7    |     |   expected struct `String`, found `&String`
8    |     arguments to this function are incorrect
9    |
10 note: function defined here
11   --> $DIR/deref-suggestion.rs:5:4
12    |
13 LL | fn foo(_: String) {}
14    |    ^^^ ---------
15
16 error[E0308]: mismatched types
17   --> $DIR/deref-suggestion.rs:14:10
18    |
19 LL |     foo3(u);
20    |     ---- ^ expected `u32`, found `&u32`
21    |     |
22    |     arguments to this function are incorrect
23    |
24 note: function defined here
25   --> $DIR/deref-suggestion.rs:12:4
26    |
27 LL | fn foo3(_: u32) {}
28    |    ^^^^ ------
29 help: consider dereferencing the borrow
30    |
31 LL |     foo3(*u);
32    |          +
33
34 error[E0308]: mismatched types
35   --> $DIR/deref-suggestion.rs:30:9
36    |
37 LL |     foo(&"aaa".to_owned());
38    |     --- ^^^^^^^^^^^^^^^^^ expected struct `String`, found `&String`
39    |     |
40    |     arguments to this function are incorrect
41    |
42 note: function defined here
43   --> $DIR/deref-suggestion.rs:5:4
44    |
45 LL | fn foo(_: String) {}
46    |    ^^^ ---------
47 help: consider removing the borrow
48    |
49 LL -     foo(&"aaa".to_owned());
50 LL +     foo("aaa".to_owned());
51    |
52
53 error[E0308]: mismatched types
54   --> $DIR/deref-suggestion.rs:32:9
55    |
56 LL |     foo(&mut "aaa".to_owned());
57    |     --- ^^^^^^^^^^^^^^^^^^^^^ expected struct `String`, found `&mut String`
58    |     |
59    |     arguments to this function are incorrect
60    |
61 note: function defined here
62   --> $DIR/deref-suggestion.rs:5:4
63    |
64 LL | fn foo(_: String) {}
65    |    ^^^ ---------
66 help: consider removing the borrow
67    |
68 LL -     foo(&mut "aaa".to_owned());
69 LL +     foo("aaa".to_owned());
70    |
71
72 error[E0308]: mismatched types
73   --> $DIR/deref-suggestion.rs:34:10
74    |
75 LL |     foo3(borrow!(0));
76    |     ---- ^^^^^^^^^^ expected `u32`, found `&{integer}`
77    |     |
78    |     arguments to this function are incorrect
79    |
80 note: function defined here
81   --> $DIR/deref-suggestion.rs:12:4
82    |
83 LL | fn foo3(_: u32) {}
84    |    ^^^^ ------
85
86 error[E0308]: mismatched types
87   --> $DIR/deref-suggestion.rs:37:5
88    |
89 LL |     assert_eq!(3i32, &3i32);
90    |     ^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `&i32`
91    |
92    = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
93
94 error[E0308]: mismatched types
95   --> $DIR/deref-suggestion.rs:40:17
96    |
97 LL |     let s = S { u };
98    |                 ^
99    |                 |
100    |                 expected `&u32`, found integer
101    |                 help: consider borrowing here: `u: &u`
102
103 error[E0308]: mismatched types
104   --> $DIR/deref-suggestion.rs:42:20
105    |
106 LL |     let s = S { u: u };
107    |                    ^
108    |                    |
109    |                    expected `&u32`, found integer
110    |                    help: consider borrowing here: `&u`
111
112 error[E0308]: mismatched types
113   --> $DIR/deref-suggestion.rs:45:17
114    |
115 LL |     let r = R { i };
116    |                 ^ expected `u32`, found `&{integer}`
117    |
118 help: consider dereferencing the borrow
119    |
120 LL |     let r = R { i: *i };
121    |                 ++++
122
123 error[E0308]: mismatched types
124   --> $DIR/deref-suggestion.rs:47:20
125    |
126 LL |     let r = R { i: i };
127    |                    ^ expected `u32`, found `&{integer}`
128    |
129 help: consider dereferencing the borrow
130    |
131 LL |     let r = R { i: *i };
132    |                    +
133
134 error[E0308]: mismatched types
135   --> $DIR/deref-suggestion.rs:56:9
136    |
137 LL |         b
138    |         ^ expected `i32`, found `&{integer}`
139    |
140 help: consider dereferencing the borrow
141    |
142 LL |         *b
143    |         +
144
145 error[E0308]: mismatched types
146   --> $DIR/deref-suggestion.rs:64:9
147    |
148 LL |         b
149    |         ^ expected `i32`, found `&{integer}`
150    |
151 help: consider dereferencing the borrow
152    |
153 LL |         *b
154    |         +
155
156 error[E0308]: `if` and `else` have incompatible types
157   --> $DIR/deref-suggestion.rs:69:12
158    |
159 LL |        let val = if true {
160    |   _______________-
161 LL |  |         *a
162    |  |         -- expected because of this
163 LL |  |     } else if true {
164    |  |____________^
165 LL | ||
166 LL | ||         b
167 LL | ||     } else {
168 LL | ||         &0
169 LL | ||     };
170    | ||     ^
171    | ||_____|
172    | |______`if` and `else` have incompatible types
173    |        expected `i32`, found `&{integer}`
174
175 error: aborting due to 13 previous errors
176
177 For more information about this error, try `rustc --explain E0308`.