fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[E0308]: `if` and `else` have incompatible types 2 --> $DIR/fn-pointer-mismatch.rs:11:43 3 | 4LL | let g = if n % 2 == 0 { &foo } else { &bar }; 5 | ---- ^^^^ expected `&fn(u32) -> u32 {foo}`, found `&fn(u32) -> u32 {bar}` 6 | | 7 | expected because of this 8 | 9 = note: expected reference `&fn(u32) -> u32 {foo}` 10 found reference `&fn(u32) -> u32 {bar}` 11 = note: different fn items have unique types, even if their signatures are the same 12 = help: consider casting both fn items to fn pointers using `as fn(u32) -> u32` 13 14error[E0308]: mismatched types 15 --> $DIR/fn-pointer-mismatch.rs:23:9 16 | 17LL | let mut a = foo; 18 | --- expected due to this value 19LL | a = bar; 20 | ^^^ expected fn item, found a different fn item 21 | 22 = note: expected fn item `fn(_) -> _ {foo}` 23 found fn item `fn(_) -> _ {bar}` 24 = note: different fn items have unique types, even if their signatures are the same 25 = help: consider casting both fn items to fn pointers using `as fn(u32) -> u32` 26 27error[E0308]: mismatched types 28 --> $DIR/fn-pointer-mismatch.rs:31:18 29 | 30LL | b = Box::new(bar); 31 | -------- ^^^ expected fn item, found a different fn item 32 | | 33 | arguments to this function are incorrect 34 | 35 = note: expected fn item `fn(_) -> _ {foo}` 36 found fn item `fn(_) -> _ {bar}` 37 = note: different fn items have unique types, even if their signatures are the same 38note: associated function defined here 39 --> $SRC_DIR/alloc/src/boxed.rs:LL:COL 40 = help: consider casting both fn items to fn pointers using `as fn(u32) -> u32` 41 42error[E0308]: mismatched types 43 --> $DIR/fn-pointer-mismatch.rs:36:29 44 | 45LL | let c: fn(u32) -> u32 = &foo; 46 | -------------- ^^^^ expected fn pointer, found `&fn(u32) -> u32 {foo}` 47 | | 48 | expected due to this 49 | 50 = note: expected fn pointer `fn(u32) -> u32` 51 found reference `&fn(u32) -> u32 {foo}` 52help: consider removing the reference 53 | 54LL | let c: fn(u32) -> u32 = foo; 55 | ~~~ 56 57error[E0308]: mismatched types 58 --> $DIR/fn-pointer-mismatch.rs:42:30 59 | 60LL | let d: &fn(u32) -> u32 = foo; 61 | --------------- ^^^ expected `&fn(u32) -> u32`, found fn item 62 | | 63 | expected due to this 64 | 65 = note: expected reference `&fn(u32) -> u32` 66 found fn item `fn(u32) -> u32 {foo}` 67help: consider using a reference 68 | 69LL | let d: &fn(u32) -> u32 = &foo; 70 | ~~~~ 71 72error[E0308]: mismatched types 73 --> $DIR/fn-pointer-mismatch.rs:48:30 74 | 75LL | let e: &fn(u32) -> u32 = &foo; 76 | --------------- ^^^^ expected `&fn(u32) -> u32`, found `&fn(u32) -> u32 {foo}` 77 | | 78 | expected due to this 79 | 80 = note: expected reference `&fn(u32) -> u32` 81 found reference `&fn(u32) -> u32 {foo}` 82 = note: fn items are distinct from fn pointers 83help: consider casting to a fn pointer 84 | 85LL | let e: &fn(u32) -> u32 = &(foo as fn(u32) -> u32); 86 | ~~~~~~~~~~~~~~~~~~~~~~~~ 87 88error: aborting due to 6 previous errors 89 90For more information about this error, try `rustc --explain E0308`.