]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/copied-and-cloned.stderr
Rollup merge of #106805 - madsravn:master, r=compiler-errors
[rust.git] / tests / ui / suggestions / copied-and-cloned.stderr
1 error[E0308]: mismatched types
2   --> $DIR/copied-and-cloned.rs:7:26
3    |
4 LL |     expect::<Option<()>>(x);
5    |     -------------------- ^ expected `Option<()>`, found `Option<&()>`
6    |     |
7    |     arguments to this function are incorrect
8    |
9    = note: expected enum `Option<()>`
10               found enum `Option<&()>`
11 note: function defined here
12   --> $DIR/copied-and-cloned.rs:3:4
13    |
14 LL | fn expect<T>(_: T) {}
15    |    ^^^^^^    ----
16 help: use `Option::copied` to copy the value inside the `Option`
17    |
18 LL |     expect::<Option<()>>(x.copied());
19    |                           +++++++++
20
21 error[E0308]: mismatched types
22   --> $DIR/copied-and-cloned.rs:11:30
23    |
24 LL |     expect::<Result<(), ()>>(x);
25    |     ------------------------ ^ expected `Result<(), ()>`, found `Result<&(), _>`
26    |     |
27    |     arguments to this function are incorrect
28    |
29    = note: expected enum `Result<(), ()>`
30               found enum `Result<&(), _>`
31 note: function defined here
32   --> $DIR/copied-and-cloned.rs:3:4
33    |
34 LL | fn expect<T>(_: T) {}
35    |    ^^^^^^    ----
36 help: use `Result::copied` to copy the value inside the `Result`
37    |
38 LL |     expect::<Result<(), ()>>(x.copied());
39    |                               +++++++++
40
41 error[E0308]: mismatched types
42   --> $DIR/copied-and-cloned.rs:16:30
43    |
44 LL |     expect::<Option<String>>(x);
45    |     ------------------------ ^ expected `Option<String>`, found `Option<&String>`
46    |     |
47    |     arguments to this function are incorrect
48    |
49    = note: expected enum `Option<String>`
50               found enum `Option<&String>`
51 note: function defined here
52   --> $DIR/copied-and-cloned.rs:3:4
53    |
54 LL | fn expect<T>(_: T) {}
55    |    ^^^^^^    ----
56 help: use `Option::cloned` to clone the value inside the `Option`
57    |
58 LL |     expect::<Option<String>>(x.cloned());
59    |                               +++++++++
60
61 error[E0308]: mismatched types
62   --> $DIR/copied-and-cloned.rs:20:34
63    |
64 LL |     expect::<Result<String, ()>>(x);
65    |     ---------------------------- ^ expected `Result<String, ()>`, found `Result<&String, _>`
66    |     |
67    |     arguments to this function are incorrect
68    |
69    = note: expected enum `Result<String, ()>`
70               found enum `Result<&String, _>`
71 note: function defined here
72   --> $DIR/copied-and-cloned.rs:3:4
73    |
74 LL | fn expect<T>(_: T) {}
75    |    ^^^^^^    ----
76 help: use `Result::cloned` to clone the value inside the `Result`
77    |
78 LL |     expect::<Result<String, ()>>(x.cloned());
79    |                                   +++++++++
80
81 error: aborting due to 4 previous errors
82
83 For more information about this error, try `rustc --explain E0308`.