2018-12-27 17:04:58 -08:00
|
|
|
error[E0308]: mismatched types
|
2021-04-18 09:37:47 -07:00
|
|
|
--> $DIR/as-ref.rs:7:29
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
2021-04-18 09:37:47 -07:00
|
|
|
LL | opt.map(|arg| takes_ref(arg));
|
|
|
|
| --- ^^^ expected `&Foo`, found struct `Foo`
|
|
|
|
| |
|
|
|
|
| help: consider using `as_ref` instead: `as_ref().map`
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2021-04-18 09:37:47 -07:00
|
|
|
--> $DIR/as-ref.rs:8:39
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
2021-04-18 09:37:47 -07:00
|
|
|
LL | opt.and_then(|arg| Some(takes_ref(arg)));
|
|
|
|
| -------- ^^^ expected `&Foo`, found struct `Foo`
|
|
|
|
| |
|
|
|
|
| help: consider using `as_ref` instead: `as_ref().and_then`
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2021-04-18 09:37:47 -07:00
|
|
|
--> $DIR/as-ref.rs:10:29
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
2021-04-18 09:37:47 -07:00
|
|
|
LL | opt.map(|arg| takes_ref(arg));
|
|
|
|
| --- ^^^ expected `&Foo`, found struct `Foo`
|
|
|
|
| |
|
|
|
|
| help: consider using `as_ref` instead: `as_ref().map`
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2021-04-18 09:37:47 -07:00
|
|
|
--> $DIR/as-ref.rs:11:37
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
2021-04-18 09:37:47 -07:00
|
|
|
LL | opt.and_then(|arg| Ok(takes_ref(arg)));
|
|
|
|
| -------- ^^^ expected `&Foo`, found struct `Foo`
|
|
|
|
| |
|
|
|
|
| help: consider using `as_ref` instead: `as_ref().and_then`
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2021-04-18 09:37:47 -07:00
|
|
|
--> $DIR/as-ref.rs:13:29
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
2021-04-18 09:37:47 -07:00
|
|
|
LL | let y: Option<&usize> = x;
|
|
|
|
| -------------- ^
|
|
|
|
| | |
|
|
|
|
| | expected enum `Option`, found `&Option<usize>`
|
|
|
|
| | help: you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()`: `x.as_ref()`
|
|
|
|
| expected due to this
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
2020-09-02 10:40:56 +03:00
|
|
|
= note: expected enum `Option<&usize>`
|
|
|
|
found reference `&Option<usize>`
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2021-04-18 09:37:47 -07:00
|
|
|
--> $DIR/as-ref.rs:15:37
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
2021-04-18 09:37:47 -07:00
|
|
|
LL | let y: Result<&usize, &usize> = x;
|
|
|
|
| ---------------------- ^ expected enum `Result`, found reference
|
|
|
|
| |
|
|
|
|
| expected due to this
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
2021-01-28 18:01:36 +02:00
|
|
|
= note: expected enum `Result<&usize, &usize>`
|
|
|
|
found reference `&Result<usize, usize>`
|
2018-12-27 17:04:58 -08:00
|
|
|
help: you can convert from `&Result<T, E>` to `Result<&T, &E>` using `.as_ref()`
|
|
|
|
|
|
2021-04-18 09:37:47 -07:00
|
|
|
LL | let y: Result<&usize, &usize> = x.as_ref();
|
2021-06-21 19:07:19 -07:00
|
|
|
| ~~~~~~~~~~
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2021-04-18 09:37:47 -07:00
|
|
|
--> $DIR/as-ref.rs:19:36
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
2021-04-18 09:37:47 -07:00
|
|
|
LL | let y: Result<&usize, usize> = x;
|
|
|
|
| --------------------- ^ expected enum `Result`, found reference
|
|
|
|
| |
|
|
|
|
| expected due to this
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
2021-01-28 18:01:36 +02:00
|
|
|
= note: expected enum `Result<&usize, usize>`
|
|
|
|
found reference `&Result<usize, usize>`
|
2018-12-27 17:04:58 -08:00
|
|
|
|
|
|
|
error: aborting due to 7 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|