2018-12-28 01:04:58 +00:00
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/as-ref.rs:6:27
|
|
|
|
|
|
|
|
|
LL | opt.map(|arg| takes_ref(arg));
|
2019-11-15 17:37:01 +00:00
|
|
|
| --- ^^^ expected `&Foo`, found struct `Foo`
|
2018-12-28 01:04:58 +00:00
|
|
|
| |
|
2019-02-13 17:52:22 +00:00
|
|
|
| help: consider using `as_ref` instead: `as_ref().map`
|
2018-12-28 01:04:58 +00:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/as-ref.rs:8:37
|
|
|
|
|
|
|
|
|
LL | opt.and_then(|arg| Some(takes_ref(arg)));
|
2019-11-15 17:37:01 +00:00
|
|
|
| -------- ^^^ expected `&Foo`, found struct `Foo`
|
2018-12-28 01:04:58 +00:00
|
|
|
| |
|
2019-02-13 17:52:22 +00:00
|
|
|
| help: consider using `as_ref` instead: `as_ref().and_then`
|
2018-12-28 01:04:58 +00:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/as-ref.rs:11:27
|
|
|
|
|
|
|
|
|
LL | opt.map(|arg| takes_ref(arg));
|
2019-11-15 17:37:01 +00:00
|
|
|
| --- ^^^ expected `&Foo`, found struct `Foo`
|
2018-12-28 01:04:58 +00:00
|
|
|
| |
|
2019-02-13 17:52:22 +00:00
|
|
|
| help: consider using `as_ref` instead: `as_ref().map`
|
2018-12-28 01:04:58 +00:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/as-ref.rs:13:35
|
|
|
|
|
|
|
|
|
LL | opt.and_then(|arg| Ok(takes_ref(arg)));
|
2019-11-15 17:37:01 +00:00
|
|
|
| -------- ^^^ expected `&Foo`, found struct `Foo`
|
2018-12-28 01:04:58 +00:00
|
|
|
| |
|
2019-02-13 17:52:22 +00:00
|
|
|
| help: consider using `as_ref` instead: `as_ref().and_then`
|
2018-12-28 01:04:58 +00:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/as-ref.rs:16:27
|
|
|
|
|
|
|
|
|
LL | let y: Option<&usize> = x;
|
2019-11-19 05:00:24 +00:00
|
|
|
| -------------- ^
|
|
|
|
| | |
|
2020-09-02 07:40:56 +00:00
|
|
|
| | expected enum `Option`, found `&Option<usize>`
|
2019-11-19 05:00:24 +00:00
|
|
|
| | help: you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()`: `x.as_ref()`
|
|
|
|
| expected due to this
|
2018-12-28 01:04:58 +00:00
|
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
= note: expected enum `Option<&usize>`
|
|
|
|
found reference `&Option<usize>`
|
2018-12-28 01:04:58 +00:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/as-ref.rs:19:35
|
|
|
|
|
|
|
|
|
LL | let y: Result<&usize, &usize> = x;
|
2019-11-19 05:00:24 +00:00
|
|
|
| ---------------------- ^ expected enum `std::result::Result`, found reference
|
|
|
|
| |
|
|
|
|
| expected due to this
|
2018-12-28 01:04:58 +00:00
|
|
|
|
|
2019-11-13 22:16:56 +00:00
|
|
|
= note: expected enum `std::result::Result<&usize, &usize>`
|
|
|
|
found reference `&std::result::Result<usize, usize>`
|
2018-12-28 01:04:58 +00:00
|
|
|
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:23:34
|
|
|
|
|
|
|
|
|
LL | let y: Result<&usize, usize> = x;
|
2019-11-19 05:00:24 +00:00
|
|
|
| --------------------- ^ expected enum `std::result::Result`, found reference
|
|
|
|
| |
|
|
|
|
| expected due to this
|
2018-12-28 01:04:58 +00:00
|
|
|
|
|
2019-11-13 22:16:56 +00:00
|
|
|
= note: expected enum `std::result::Result<&usize, usize>`
|
|
|
|
found reference `&std::result::Result<usize, usize>`
|
2018-12-28 01:04:58 +00:00
|
|
|
|
|
|
|
error: aborting due to 7 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|