]> git.proxmox.com Git - rustc.git/blob - tests/ui/suggestions/as-ref.stderr
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / suggestions / as-ref.stderr
1 error[E0308]: mismatched types
2 --> $DIR/as-ref.rs:7:29
3 |
4 LL | opt.map(|arg| takes_ref(arg));
5 | --- --------- ^^^ expected `&Foo`, found struct `Foo`
6 | | |
7 | | arguments to this function are incorrect
8 | help: consider using `as_ref` instead: `as_ref().map`
9 |
10 note: function defined here
11 --> $DIR/as-ref.rs:3:4
12 |
13 LL | fn takes_ref(_: &Foo) {}
14 | ^^^^^^^^^ -------
15
16 error[E0308]: mismatched types
17 --> $DIR/as-ref.rs:8:39
18 |
19 LL | opt.and_then(|arg| Some(takes_ref(arg)));
20 | -------- --------- ^^^ expected `&Foo`, found struct `Foo`
21 | | |
22 | | arguments to this function are incorrect
23 | help: consider using `as_ref` instead: `as_ref().and_then`
24 |
25 note: function defined here
26 --> $DIR/as-ref.rs:3:4
27 |
28 LL | fn takes_ref(_: &Foo) {}
29 | ^^^^^^^^^ -------
30
31 error[E0308]: mismatched types
32 --> $DIR/as-ref.rs:10:29
33 |
34 LL | opt.map(|arg| takes_ref(arg));
35 | --- --------- ^^^ expected `&Foo`, found struct `Foo`
36 | | |
37 | | arguments to this function are incorrect
38 | help: consider using `as_ref` instead: `as_ref().map`
39 |
40 note: function defined here
41 --> $DIR/as-ref.rs:3:4
42 |
43 LL | fn takes_ref(_: &Foo) {}
44 | ^^^^^^^^^ -------
45
46 error[E0308]: mismatched types
47 --> $DIR/as-ref.rs:11:37
48 |
49 LL | opt.and_then(|arg| Ok(takes_ref(arg)));
50 | -------- --------- ^^^ expected `&Foo`, found struct `Foo`
51 | | |
52 | | arguments to this function are incorrect
53 | help: consider using `as_ref` instead: `as_ref().and_then`
54 |
55 note: function defined here
56 --> $DIR/as-ref.rs:3:4
57 |
58 LL | fn takes_ref(_: &Foo) {}
59 | ^^^^^^^^^ -------
60
61 error[E0308]: mismatched types
62 --> $DIR/as-ref.rs:13:29
63 |
64 LL | let y: Option<&usize> = x;
65 | -------------- ^
66 | | |
67 | | expected enum `Option`, found `&Option<usize>`
68 | | help: you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()`: `x.as_ref()`
69 | expected due to this
70 |
71 = note: expected enum `Option<&usize>`
72 found reference `&Option<usize>`
73
74 error[E0308]: mismatched types
75 --> $DIR/as-ref.rs:15:37
76 |
77 LL | let y: Result<&usize, &usize> = x;
78 | ---------------------- ^ expected enum `Result`, found reference
79 | |
80 | expected due to this
81 |
82 = note: expected enum `Result<&usize, &usize>`
83 found reference `&Result<usize, usize>`
84 help: you can convert from `&Result<T, E>` to `Result<&T, &E>` using `.as_ref()`
85 |
86 LL | let y: Result<&usize, &usize> = x.as_ref();
87 | ~~~~~~~~~~
88
89 error[E0308]: mismatched types
90 --> $DIR/as-ref.rs:19:36
91 |
92 LL | let y: Result<&usize, usize> = x;
93 | --------------------- ^ expected enum `Result`, found reference
94 | |
95 | expected due to this
96 |
97 = note: expected enum `Result<&usize, usize>`
98 found reference `&Result<usize, usize>`
99
100 error[E0308]: mismatched types
101 --> $DIR/as-ref.rs:22:42
102 |
103 LL | multiple_ref_opt.map(|arg| takes_ref(arg));
104 | --- --------- ^^^ expected `&Foo`, found struct `Foo`
105 | | |
106 | | arguments to this function are incorrect
107 | help: consider using `as_ref` instead: `as_ref().map`
108 |
109 note: function defined here
110 --> $DIR/as-ref.rs:3:4
111 |
112 LL | fn takes_ref(_: &Foo) {}
113 | ^^^^^^^^^ -------
114
115 error[E0308]: mismatched types
116 --> $DIR/as-ref.rs:23:52
117 |
118 LL | multiple_ref_opt.and_then(|arg| Some(takes_ref(arg)));
119 | -------- --------- ^^^ expected `&Foo`, found struct `Foo`
120 | | |
121 | | arguments to this function are incorrect
122 | help: consider using `as_ref` instead: `as_ref().and_then`
123 |
124 note: function defined here
125 --> $DIR/as-ref.rs:3:4
126 |
127 LL | fn takes_ref(_: &Foo) {}
128 | ^^^^^^^^^ -------
129
130 error[E0308]: mismatched types
131 --> $DIR/as-ref.rs:25:45
132 |
133 LL | multiple_ref_result.map(|arg| takes_ref(arg));
134 | --- --------- ^^^ expected `&Foo`, found struct `Foo`
135 | | |
136 | | arguments to this function are incorrect
137 | help: consider using `as_ref` instead: `as_ref().map`
138 |
139 note: function defined here
140 --> $DIR/as-ref.rs:3:4
141 |
142 LL | fn takes_ref(_: &Foo) {}
143 | ^^^^^^^^^ -------
144
145 error[E0308]: mismatched types
146 --> $DIR/as-ref.rs:26:53
147 |
148 LL | multiple_ref_result.and_then(|arg| Ok(takes_ref(arg)));
149 | -------- --------- ^^^ expected `&Foo`, found struct `Foo`
150 | | |
151 | | arguments to this function are incorrect
152 | help: consider using `as_ref` instead: `as_ref().and_then`
153 |
154 note: function defined here
155 --> $DIR/as-ref.rs:3:4
156 |
157 LL | fn takes_ref(_: &Foo) {}
158 | ^^^^^^^^^ -------
159
160 error: aborting due to 11 previous errors
161
162 For more information about this error, try `rustc --explain E0308`.