31 lines
1.4 KiB
Plaintext
31 lines
1.4 KiB
Plaintext
error[E0308]: mismatched types
|
|
--> tests/compile-fail/with_closure_capture.rs:12:16
|
|
|
|
|
12 | with = |m| Ok(
|
|
| ^ arguments to this function are incorrect
|
|
| ________________|
|
|
| |
|
|
13 | | String::from_meta(m)?.to_uppercase()
|
|
14 | | + example1.1.as_ref().map(|s| s.as_str()).unwrap_or("")
|
|
15 | | ),
|
|
| |_________^ expected fn pointer, found closure
|
|
|
|
|
= note: expected fn pointer `for<'a> fn(&'a syn::Meta) -> Result<String, darling::Error>`
|
|
found closure `{closure@$DIR/tests/compile-fail/with_closure_capture.rs:12:16: 12:19}`
|
|
note: closures can only be coerced to `fn` types if they do not capture any variables
|
|
--> tests/compile-fail/with_closure_capture.rs:14:15
|
|
|
|
|
14 | + example1.1.as_ref().map(|s| s.as_str()).unwrap_or("")
|
|
| ^^^^^^^^ `example1` captured here
|
|
help: the return type of this call is `{closure@$DIR/tests/compile-fail/with_closure_capture.rs:12:16: 12:19}` due to the type of the argument passed
|
|
--> tests/compile-fail/with_closure_capture.rs:12:16
|
|
|
|
|
12 | with = |m| Ok(
|
|
| ________________^
|
|
13 | | String::from_meta(m)?.to_uppercase()
|
|
14 | | + example1.1.as_ref().map(|s| s.as_str()).unwrap_or("")
|
|
15 | | ),
|
|
| |_________- this argument influences the return type of `{{root}}`
|
|
note: function defined here
|
|
--> $RUST/core/src/convert/mod.rs
|