fork/rust

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

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

master
4.3 KiB137 linesraw
1error[E0308]: mismatched types
2  --> $DIR/copied-and-cloned.rs:10:13
3   |
4LL |     lol.x = x.clone();
5   |     -----   ^^^^^^^^^ expected `Option<String>`, found `Option<&String>`
6   |     |
7   |     expected due to the type of this binding
8   |
9   = note: expected enum `Option<String>`
10              found enum `Option<&String>`
11help: use `Option::cloned` to clone the value inside the `Option`
12   |
13LL |     lol.x = x.clone().cloned();
14   |                      +++++++++
15
16error[E0308]: mismatched types
17  --> $DIR/copied-and-cloned.rs:17:26
18   |
19LL |     expect::<Option<()>>(x);
20   |     -------------------- ^ expected `Option<()>`, found `Option<&()>`
21   |     |
22   |     arguments to this function are incorrect
23   |
24   = note: expected enum `Option<()>`
25              found enum `Option<&()>`
26note: function defined here
27  --> $DIR/copied-and-cloned.rs:3:4
28   |
29LL | fn expect<T>(_: T) {}
30   |    ^^^^^^    ----
31help: use `Option::copied` to copy the value inside the `Option`
32   |
33LL |     expect::<Option<()>>(x.copied());
34   |                           +++++++++
35
36error[E0308]: mismatched types
37  --> $DIR/copied-and-cloned.rs:21:30
38   |
39LL |     expect::<Result<(), ()>>(x);
40   |     ------------------------ ^ expected `Result<(), ()>`, found `Result<&(), _>`
41   |     |
42   |     arguments to this function are incorrect
43   |
44   = note: expected enum `Result<(), ()>`
45              found enum `Result<&(), _>`
46note: function defined here
47  --> $DIR/copied-and-cloned.rs:3:4
48   |
49LL | fn expect<T>(_: T) {}
50   |    ^^^^^^    ----
51help: use `Result::copied` to copy the value inside the `Result`
52   |
53LL |     expect::<Result<(), ()>>(x.copied());
54   |                               +++++++++
55
56error[E0308]: mismatched types
57  --> $DIR/copied-and-cloned.rs:26:30
58   |
59LL |     expect::<Option<String>>(x);
60   |     ------------------------ ^ expected `Option<String>`, found `Option<&String>`
61   |     |
62   |     arguments to this function are incorrect
63   |
64   = note: expected enum `Option<String>`
65              found enum `Option<&String>`
66note: function defined here
67  --> $DIR/copied-and-cloned.rs:3:4
68   |
69LL | fn expect<T>(_: T) {}
70   |    ^^^^^^    ----
71help: use `Option::cloned` to clone the value inside the `Option`
72   |
73LL |     expect::<Option<String>>(x.cloned());
74   |                               +++++++++
75
76error[E0308]: mismatched types
77  --> $DIR/copied-and-cloned.rs:30:34
78   |
79LL |     expect::<Result<String, ()>>(x);
80   |     ---------------------------- ^ expected `Result<String, ()>`, found `Result<&String, _>`
81   |     |
82   |     arguments to this function are incorrect
83   |
84   = note: expected enum `Result<String, ()>`
85              found enum `Result<&String, _>`
86note: function defined here
87  --> $DIR/copied-and-cloned.rs:3:4
88   |
89LL | fn expect<T>(_: T) {}
90   |    ^^^^^^    ----
91help: use `Result::cloned` to clone the value inside the `Result`
92   |
93LL |     expect::<Result<String, ()>>(x.cloned());
94   |                                   +++++++++
95
96error[E0308]: mismatched types
97  --> $DIR/copied-and-cloned.rs:37:25
98   |
99LL |     println!("{}", x == y);
100   |                         ^ expected `Option<String>`, found `Option<&String>`
101   |
102   = note: expected enum `Option<String>`
103              found enum `Option<&String>`
104help: use `Option::cloned` to clone the value inside the `Option`
105   |
106LL |     println!("{}", x == y.cloned());
107   |                          +++++++++
108
109error[E0308]: mismatched types
110  --> $DIR/copied-and-cloned.rs:45:25
111   |
112LL |     println!("{}", x == y);
113   |                         ^ expected `Option<()>`, found `Option<&mut ()>`
114   |
115   = note: expected enum `Option<()>`
116              found enum `Option<&mut ()>`
117help: use `Option::copied` to copy the value inside the `Option`
118   |
119LL |     println!("{}", x == y.copied());
120   |                          +++++++++
121
122error[E0308]: mismatched types
123  --> $DIR/copied-and-cloned.rs:52:25
124   |
125LL |     println!("{}", x == y);
126   |                         ^ expected `Option<String>`, found `Option<&mut String>`
127   |
128   = note: expected enum `Option<String>`
129              found enum `Option<&mut String>`
130help: use `Option::cloned` to clone the value inside the `Option`
131   |
132LL |     println!("{}", x == y.cloned());
133   |                          +++++++++
134
135error: aborting due to 8 previous errors
136
137For more information about this error, try `rustc --explain E0308`.