1 error[E0308]: mismatched types
2 --> $DIR/as-ref.rs:6:27
4 LL | opt.map(|arg| takes_ref(arg));
5 | - ^^^ expected &Foo, found struct `Foo`
7 | help: consider using `as_ref` instead: `as_ref().`
9 = note: expected type `&Foo`
12 error[E0308]: mismatched types
13 --> $DIR/as-ref.rs:8:37
15 LL | opt.and_then(|arg| Some(takes_ref(arg)));
16 | - ^^^ expected &Foo, found struct `Foo`
18 | help: consider using `as_ref` instead: `as_ref().`
20 = note: expected type `&Foo`
23 error[E0308]: mismatched types
24 --> $DIR/as-ref.rs:11:27
26 LL | opt.map(|arg| takes_ref(arg));
27 | - ^^^ expected &Foo, found struct `Foo`
29 | help: consider using `as_ref` instead: `as_ref().`
31 = note: expected type `&Foo`
34 error[E0308]: mismatched types
35 --> $DIR/as-ref.rs:13:35
37 LL | opt.and_then(|arg| Ok(takes_ref(arg)));
38 | - ^^^ expected &Foo, found struct `Foo`
40 | help: consider using `as_ref` instead: `as_ref().`
42 = note: expected type `&Foo`
45 error[E0308]: mismatched types
46 --> $DIR/as-ref.rs:16:27
48 LL | let y: Option<&usize> = x;
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()`
54 = note: expected type `std::option::Option<&usize>`
55 found type `&std::option::Option<usize>`
57 error[E0308]: mismatched types
58 --> $DIR/as-ref.rs:19:35
60 LL | let y: Result<&usize, &usize> = x;
61 | ^ expected enum `std::result::Result`, found reference
63 = note: expected type `std::result::Result<&usize, &usize>`
64 found type `&std::result::Result<usize, usize>`
65 help: you can convert from `&Result<T, E>` to `Result<&T, &E>` using `.as_ref()`
67 LL | let y: Result<&usize, &usize> = x.as_ref();
70 error[E0308]: mismatched types
71 --> $DIR/as-ref.rs:23:34
73 LL | let y: Result<&usize, usize> = x;
74 | ^ expected enum `std::result::Result`, found reference
76 = note: expected type `std::result::Result<&usize, usize>`
77 found type `&std::result::Result<usize, usize>`
79 error: aborting due to 7 previous errors
81 For more information about this error, try `rustc --explain E0308`.