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