|
1 | 1 | error[E0308]: mismatched types
|
2 |
| - --> $DIR/issue-89856.rs:6:20 |
| 2 | + --> $DIR/issue-89856.rs:8:20 |
3 | 3 | |
|
4 | 4 | LL | take_str_maybe(option);
|
5 |
| - | -------------- ^^^^^^ expected `Option<&str>`, found `Option<&String>` |
| 5 | + | -------------- ^^^^^^ expected `Option<&str>`, found `Option<String>` |
| 6 | + | | |
| 7 | + | arguments to this function are incorrect |
| 8 | + | |
| 9 | + = note: expected enum `Option<&str>` |
| 10 | + found enum `Option<String>` |
| 11 | +note: function defined here |
| 12 | + --> $DIR/issue-89856.rs:3:4 |
| 13 | + | |
| 14 | +LL | fn take_str_maybe(_: Option<&str>) { } |
| 15 | + | ^^^^^^^^^^^^^^ --------------- |
| 16 | +help: try converting the passed type into a `&str` |
| 17 | + | |
| 18 | +LL | take_str_maybe(option.as_deref()); |
| 19 | + | +++++++++++ |
| 20 | + |
| 21 | +error[E0308]: mismatched types |
| 22 | + --> $DIR/issue-89856.rs:12:20 |
| 23 | + | |
| 24 | +LL | take_str_maybe(option_ref); |
| 25 | + | -------------- ^^^^^^^^^^ expected `Option<&str>`, found `Option<&String>` |
6 | 26 | | |
|
7 | 27 | | arguments to this function are incorrect
|
8 | 28 | |
|
9 | 29 | = note: expected enum `Option<&str>`
|
10 | 30 | found enum `Option<&String>`
|
11 | 31 | note: function defined here
|
12 |
| - --> $DIR/issue-89856.rs:1:4 |
| 32 | + --> $DIR/issue-89856.rs:3:4 |
| 33 | + | |
| 34 | +LL | fn take_str_maybe(_: Option<&str>) { } |
| 35 | + | ^^^^^^^^^^^^^^ --------------- |
| 36 | +help: try converting the passed type into a `&str` |
| 37 | + | |
| 38 | +LL | take_str_maybe(option_ref.map(|x| x.as_str())); |
| 39 | + | ++++++++++++++++++++ |
| 40 | + |
| 41 | +error[E0308]: mismatched types |
| 42 | + --> $DIR/issue-89856.rs:16:20 |
| 43 | + | |
| 44 | +LL | take_str_maybe(option_ref_ref); |
| 45 | + | -------------- ^^^^^^^^^^^^^^ expected `Option<&str>`, found `Option<&&String>` |
| 46 | + | | |
| 47 | + | arguments to this function are incorrect |
| 48 | + | |
| 49 | + = note: expected enum `Option<&str>` |
| 50 | + found enum `Option<&&String>` |
| 51 | +note: function defined here |
| 52 | + --> $DIR/issue-89856.rs:3:4 |
13 | 53 | |
|
14 |
| -LL | fn take_str_maybe(x: Option<&str>) -> Option<&str> { None } |
| 54 | +LL | fn take_str_maybe(_: Option<&str>) { } |
15 | 55 | | ^^^^^^^^^^^^^^ ---------------
|
16 | 56 | help: try converting the passed type into a `&str`
|
17 | 57 | |
|
18 |
| -LL | take_str_maybe(option.map(|x| &**x)); |
19 |
| - | ++++++++++++++ |
| 58 | +LL | take_str_maybe(option_ref_ref.map(|x| x.as_str())); |
| 59 | + | ++++++++++++++++++++ |
20 | 60 |
|
21 |
| -error: aborting due to previous error |
| 61 | +error: aborting due to 3 previous errors |
22 | 62 |
|
23 | 63 | For more information about this error, try `rustc --explain E0308`.
|
0 commit comments