fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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