]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/as-ref.stderr
d01c37351951f396eb6e19fdf80c2d40c6d66ad4
[rust.git] / src / test / ui / suggestions / as-ref.stderr
1 error[E0308]: mismatched types
2   --> $DIR/as-ref.rs:6:27
3    |
4 LL |   opt.map(|arg| takes_ref(arg));
5    |       ---                 ^^^ expected &Foo, found struct `Foo`
6    |       |
7    |       help: consider using `as_ref` instead: `as_ref().map`
8    |
9    = note: expected reference `&Foo`
10                  found struct `Foo`
11
12 error[E0308]: mismatched types
13   --> $DIR/as-ref.rs:8:37
14    |
15 LL |   opt.and_then(|arg| Some(takes_ref(arg)));
16    |       --------                      ^^^ expected &Foo, found struct `Foo`
17    |       |
18    |       help: consider using `as_ref` instead: `as_ref().and_then`
19    |
20    = note: expected reference `&Foo`
21                  found struct `Foo`
22
23 error[E0308]: mismatched types
24   --> $DIR/as-ref.rs:11:27
25    |
26 LL |   opt.map(|arg| takes_ref(arg));
27    |       ---                 ^^^ expected &Foo, found struct `Foo`
28    |       |
29    |       help: consider using `as_ref` instead: `as_ref().map`
30    |
31    = note: expected reference `&Foo`
32                  found struct `Foo`
33
34 error[E0308]: mismatched types
35   --> $DIR/as-ref.rs:13:35
36    |
37 LL |   opt.and_then(|arg| Ok(takes_ref(arg)));
38    |       --------                    ^^^ expected &Foo, found struct `Foo`
39    |       |
40    |       help: consider using `as_ref` instead: `as_ref().and_then`
41    |
42    = note: expected reference `&Foo`
43                  found struct `Foo`
44
45 error[E0308]: mismatched types
46   --> $DIR/as-ref.rs:16:27
47    |
48 LL |   let y: Option<&usize> = x;
49    |                           ^
50    |                           |
51    |                           expected enum `std::option::Option`, found reference
52    |                           help: you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()`: `x.as_ref()`
53    |
54    = note:   expected enum `std::option::Option<&usize>`
55            found reference `&std::option::Option<usize>`
56
57 error[E0308]: mismatched types
58   --> $DIR/as-ref.rs:19:35
59    |
60 LL |   let y: Result<&usize, &usize> = x;
61    |                                   ^ expected enum `std::result::Result`, found reference
62    |
63    = note:   expected enum `std::result::Result<&usize, &usize>`
64            found reference `&std::result::Result<usize, usize>`
65 help: you can convert from `&Result<T, E>` to `Result<&T, &E>` using `.as_ref()`
66    |
67 LL |   let y: Result<&usize, &usize> = x.as_ref();
68    |                                   ^^^^^^^^^^
69
70 error[E0308]: mismatched types
71   --> $DIR/as-ref.rs:23:34
72    |
73 LL |   let y: Result<&usize, usize> = x;
74    |                                  ^ expected enum `std::result::Result`, found reference
75    |
76    = note:   expected enum `std::result::Result<&usize, usize>`
77            found reference `&std::result::Result<usize, usize>`
78
79 error: aborting due to 7 previous errors
80
81 For more information about this error, try `rustc --explain E0308`.