summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/as-ref.stderr
blob: 0ee343ebf9f1114913e085a4d3b9cfb3426439f3 (plain)
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
error[E0308]: mismatched types
  --> $DIR/as-ref.rs:7:29
   |
LL |     opt.map(|arg| takes_ref(arg));
   |         ---       --------- ^^^ expected `&Foo`, found `Foo`
   |         |         |
   |         |         arguments to this function are incorrect
   |         help: consider using `as_ref` instead: `as_ref().map`
   |
note: function defined here
  --> $DIR/as-ref.rs:3:4
   |
LL | fn takes_ref(_: &Foo) {}
   |    ^^^^^^^^^ -------

error[E0308]: mismatched types
  --> $DIR/as-ref.rs:8:39
   |
LL |     opt.and_then(|arg| Some(takes_ref(arg)));
   |         --------            --------- ^^^ expected `&Foo`, found `Foo`
   |         |                   |
   |         |                   arguments to this function are incorrect
   |         help: consider using `as_ref` instead: `as_ref().and_then`
   |
note: function defined here
  --> $DIR/as-ref.rs:3:4
   |
LL | fn takes_ref(_: &Foo) {}
   |    ^^^^^^^^^ -------

error[E0308]: mismatched types
  --> $DIR/as-ref.rs:10:29
   |
LL |     opt.map(|arg| takes_ref(arg));
   |         ---       --------- ^^^ expected `&Foo`, found `Foo`
   |         |         |
   |         |         arguments to this function are incorrect
   |         help: consider using `as_ref` instead: `as_ref().map`
   |
note: function defined here
  --> $DIR/as-ref.rs:3:4
   |
LL | fn takes_ref(_: &Foo) {}
   |    ^^^^^^^^^ -------

error[E0308]: mismatched types
  --> $DIR/as-ref.rs:11:37
   |
LL |     opt.and_then(|arg| Ok(takes_ref(arg)));
   |         --------          --------- ^^^ expected `&Foo`, found `Foo`
   |         |                 |
   |         |                 arguments to this function are incorrect
   |         help: consider using `as_ref` instead: `as_ref().and_then`
   |
note: function defined here
  --> $DIR/as-ref.rs:3:4
   |
LL | fn takes_ref(_: &Foo) {}
   |    ^^^^^^^^^ -------

error[E0308]: mismatched types
  --> $DIR/as-ref.rs:13:29
   |
LL |     let y: Option<&usize> = x;
   |            --------------   ^
   |            |                |
   |            |                expected `Option<&usize>`, found `&Option<usize>`
   |            |                help: you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()`: `x.as_ref()`
   |            expected due to this
   |
   = note:   expected enum `Option<&usize>`
           found reference `&Option<usize>`

error[E0308]: mismatched types
  --> $DIR/as-ref.rs:15:37
   |
LL |     let y: Result<&usize, &usize> = x;
   |            ----------------------   ^ expected `Result<&usize, &usize>`, found `&Result<usize, usize>`
   |            |
   |            expected due to this
   |
   = note:   expected enum `Result<&usize, &usize>`
           found reference `&Result<usize, usize>`
help: you can convert from `&Result<T, E>` to `Result<&T, &E>` using `.as_ref()`
   |
LL |     let y: Result<&usize, &usize> = x.as_ref();
   |                                     ~~~~~~~~~~

error[E0308]: mismatched types
  --> $DIR/as-ref.rs:19:36
   |
LL |     let y: Result<&usize, usize> = x;
   |            ---------------------   ^ expected `Result<&usize, usize>`, found `&Result<usize, usize>`
   |            |
   |            expected due to this
   |
   = note:   expected enum `Result<&usize, usize>`
           found reference `&Result<usize, usize>`

error[E0308]: mismatched types
  --> $DIR/as-ref.rs:22:42
   |
LL |     multiple_ref_opt.map(|arg| takes_ref(arg));
   |                      ---       --------- ^^^ expected `&Foo`, found `Foo`
   |                      |         |
   |                      |         arguments to this function are incorrect
   |                      help: consider using `as_ref` instead: `as_ref().map`
   |
note: function defined here
  --> $DIR/as-ref.rs:3:4
   |
LL | fn takes_ref(_: &Foo) {}
   |    ^^^^^^^^^ -------

error[E0308]: mismatched types
  --> $DIR/as-ref.rs:23:52
   |
LL |     multiple_ref_opt.and_then(|arg| Some(takes_ref(arg)));
   |                      --------            --------- ^^^ expected `&Foo`, found `Foo`
   |                      |                   |
   |                      |                   arguments to this function are incorrect
   |                      help: consider using `as_ref` instead: `as_ref().and_then`
   |
note: function defined here
  --> $DIR/as-ref.rs:3:4
   |
LL | fn takes_ref(_: &Foo) {}
   |    ^^^^^^^^^ -------

error[E0308]: mismatched types
  --> $DIR/as-ref.rs:25:45
   |
LL |     multiple_ref_result.map(|arg| takes_ref(arg));
   |                         ---       --------- ^^^ expected `&Foo`, found `Foo`
   |                         |         |
   |                         |         arguments to this function are incorrect
   |                         help: consider using `as_ref` instead: `as_ref().map`
   |
note: function defined here
  --> $DIR/as-ref.rs:3:4
   |
LL | fn takes_ref(_: &Foo) {}
   |    ^^^^^^^^^ -------

error[E0308]: mismatched types
  --> $DIR/as-ref.rs:26:53
   |
LL |     multiple_ref_result.and_then(|arg| Ok(takes_ref(arg)));
   |                         --------          --------- ^^^ expected `&Foo`, found `Foo`
   |                         |                 |
   |                         |                 arguments to this function are incorrect
   |                         help: consider using `as_ref` instead: `as_ref().and_then`
   |
note: function defined here
  --> $DIR/as-ref.rs:3:4
   |
LL | fn takes_ref(_: &Foo) {}
   |    ^^^^^^^^^ -------

error: aborting due to 11 previous errors

For more information about this error, try `rustc --explain E0308`.