rust/src/test/ui/suggestions/as-ref.stderr

70 lines
2.4 KiB
Plaintext
Raw Normal View History

error[E0308]: mismatched types
--> $DIR/as-ref.rs:6:27
|
LL | opt.map(|arg| takes_ref(arg));
| --- ^^^ expected `&Foo`, found struct `Foo`
| |
| help: consider using `as_ref` instead: `as_ref().map`
error[E0308]: mismatched types
--> $DIR/as-ref.rs:8:37
|
LL | opt.and_then(|arg| Some(takes_ref(arg)));
| -------- ^^^ expected `&Foo`, found struct `Foo`
| |
| help: consider using `as_ref` instead: `as_ref().and_then`
error[E0308]: mismatched types
--> $DIR/as-ref.rs:11:27
|
LL | opt.map(|arg| takes_ref(arg));
| --- ^^^ expected `&Foo`, found struct `Foo`
| |
| help: consider using `as_ref` instead: `as_ref().map`
error[E0308]: mismatched types
--> $DIR/as-ref.rs:13:35
|
LL | opt.and_then(|arg| Ok(takes_ref(arg)));
| -------- ^^^ expected `&Foo`, found struct `Foo`
| |
| help: consider using `as_ref` instead: `as_ref().and_then`
error[E0308]: mismatched types
--> $DIR/as-ref.rs:16:27
|
LL | let y: Option<&usize> = x;
| ^
| |
| expected enum `std::option::Option`, found reference
| help: you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()`: `x.as_ref()`
|
= note: expected enum `std::option::Option<&usize>`
found reference `&std::option::Option<usize>`
error[E0308]: mismatched types
--> $DIR/as-ref.rs:19:35
|
LL | let y: Result<&usize, &usize> = x;
| ^ expected enum `std::result::Result`, found reference
|
= note: expected enum `std::result::Result<&usize, &usize>`
found reference `&std::result::Result<usize, usize>`
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;
| ^ expected enum `std::result::Result`, found reference
|
= note: expected enum `std::result::Result<&usize, usize>`
found reference `&std::result::Result<usize, usize>`
error: aborting due to 7 previous errors
For more information about this error, try `rustc --explain E0308`.