fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
960 B26 linesraw
1error[E0308]: mismatched types
2  --> $DIR/closure-reform-bad.rs:11:15
3   |
4LL |     let f = |s: &str| println!("{}{}", s, string);
5   |             --------- the found closure
6LL |     call_bare(f)
7   |     --------- ^ expected fn pointer, found closure
8   |     |
9   |     arguments to this function are incorrect
10   |
11   = note: expected fn pointer `for<'a> fn(&'a str)`
12                 found closure `{closure@$DIR/closure-reform-bad.rs:10:13: 10:22}`
13note: closures can only be coerced to `fn` types if they do not capture any variables
14  --> $DIR/closure-reform-bad.rs:10:43
15   |
16LL |     let f = |s: &str| println!("{}{}", s, string);
17   |                                           ^^^^^^ `string` captured here
18note: function defined here
19  --> $DIR/closure-reform-bad.rs:4:4
20   |
21LL | fn call_bare(f: fn(&str)) {
22   |    ^^^^^^^^^ -----------
23
24error: aborting due to previous error
25
26For more information about this error, try `rustc --explain E0308`.