Pretty print function pointer const values.

This commit is contained in:
ben 2019-10-02 20:29:16 +13:00
parent 2afd277bc3
commit a59eb6d554
6 changed files with 27 additions and 15 deletions

View file

@ -17,4 +17,4 @@ impl<const F: fn() -> u32> Wrapper<{F}> {
fn main() {
assert_eq!(Wrapper::<{function}>::call(), 17);
}
}

View file

@ -23,4 +23,4 @@ fn main() {
let _ = Checked::<{generic::<u16>}>;
let _: Checked<{generic::<u16>}> = Checked::<{generic::<u16>}>;
let _: Checked<{generic::<u32>}> = Checked::<{generic::<u16>}>; //~ mismatched types
}
}

View file

@ -10,7 +10,7 @@ error[E0308]: mismatched types
--> $DIR/fn-const-param-infer.rs:16:33
|
LL | let _: Checked<{not_one}> = Checked::<{not_two}>;
| ^^^^^^^^^^^^^^^^^^^^ expected `Scalar(AllocId(1).0x0) : fn(usize) -> bool`, found `Scalar(AllocId(10).0x0) : fn(usize) -> bool`
| ^^^^^^^^^^^^^^^^^^^^ expected `not_one`, found `not_two`
|
= note: expected type `Checked<>`
found type `Checked<>`
@ -34,7 +34,7 @@ error[E0308]: mismatched types
--> $DIR/fn-const-param-infer.rs:25:40
|
LL | let _: Checked<{generic::<u32>}> = Checked::<{generic::<u16>}>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Scalar(AllocId(7).0x0) : fn(usize) -> bool`, found `Scalar(AllocId(20).0x0) : fn(usize) -> bool`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `generic::<u32>`, found `generic::<u16>`
|
= note: expected type `Checked<>`
found type `Checked<>`