fork/rust

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

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
2.7 KiB81 linesraw
1error[E0308]: mismatched types
2  --> $DIR/as-ref.rs:6:27
3   |
4LL |   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 type `&Foo`
10              found type `Foo`
11
12error[E0308]: mismatched types
13  --> $DIR/as-ref.rs:8:37
14   |
15LL |   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 type `&Foo`
21              found type `Foo`
22
23error[E0308]: mismatched types
24  --> $DIR/as-ref.rs:11:27
25   |
26LL |   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 type `&Foo`
32              found type `Foo`
33
34error[E0308]: mismatched types
35  --> $DIR/as-ref.rs:13:35
36   |
37LL |   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 type `&Foo`
43              found type `Foo`
44
45error[E0308]: mismatched types
46  --> $DIR/as-ref.rs:16:27
47   |
48LL |   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 type `std::option::Option<&usize>`
55              found type `&std::option::Option<usize>`
56
57error[E0308]: mismatched types
58  --> $DIR/as-ref.rs:19:35
59   |
60LL |   let y: Result<&usize, &usize> = x;
61   |                                   ^ expected enum `std::result::Result`, found reference
62   |
63   = note: expected type `std::result::Result<&usize, &usize>`
64              found type `&std::result::Result<usize, usize>`
65help: you can convert from `&Result<T, E>` to `Result<&T, &E>` using `.as_ref()`
66   |
67LL |   let y: Result<&usize, &usize> = x.as_ref();
68   |                                   ^^^^^^^^^^
69
70error[E0308]: mismatched types
71  --> $DIR/as-ref.rs:23:34
72   |
73LL |   let y: Result<&usize, usize> = x;
74   |                                  ^ expected enum `std::result::Result`, found reference
75   |
76   = note: expected type `std::result::Result<&usize, usize>`
77              found type `&std::result::Result<usize, usize>`
78
79error: aborting due to 7 previous errors
80
81For more information about this error, try `rustc --explain E0308`.