Print function pointer type for function pointer const generics
This commit is contained in:
parent
b78dbf43f4
commit
fff2e0f806
2 changed files with 11 additions and 7 deletions
|
|
@ -1009,7 +1009,11 @@ pub trait PrettyPrinter<'tcx>:
|
|||
let alloc_map = self.tcx().alloc_map.lock();
|
||||
alloc_map.unwrap_fn(ptr.alloc_id)
|
||||
};
|
||||
p!(print_value_path(instance.def_id(), instance.substs));
|
||||
self = self.typed_value(
|
||||
|this| this.print_value_path(instance.def_id(), instance.substs),
|
||||
|this| this.print_type(ty),
|
||||
true,
|
||||
)?;
|
||||
}
|
||||
// For function type zsts just printing the type is enough
|
||||
(Scalar::Raw { size: 0, .. }, ty::FnDef(..)) => p!(print(ty)),
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ error[E0308]: mismatched types
|
|||
--> $DIR/fn-const-param-infer.rs:16:31
|
||||
|
|
||||
LL | let _: Checked<not_one> = Checked::<not_two>;
|
||||
| ---------------- ^^^^^^^^^^^^^^^^^^ expected `not_one`, found `not_two`
|
||||
| ---------------- ^^^^^^^^^^^^^^^^^^ expected `{not_one as fn(usize) -> bool}`, found `{not_two as fn(usize) -> bool}`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected struct `Checked<not_one>`
|
||||
found struct `Checked<not_two>`
|
||||
= note: expected struct `Checked<{not_one as fn(usize) -> bool}>`
|
||||
found struct `Checked<{not_two as fn(usize) -> bool}>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/fn-const-param-infer.rs:20:24
|
||||
|
|
@ -36,12 +36,12 @@ error[E0308]: mismatched types
|
|||
--> $DIR/fn-const-param-infer.rs:25:40
|
||||
|
|
||||
LL | let _: Checked<{generic::<u32>}> = Checked::<{generic::<u16>}>;
|
||||
| ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `generic::<u32>`, found `generic::<u16>`
|
||||
| ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{generic::<u32> as fn(usize) -> bool}`, found `{generic::<u16> as fn(usize) -> bool}`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected struct `Checked<generic::<u32>>`
|
||||
found struct `Checked<generic::<u16>>`
|
||||
= note: expected struct `Checked<{generic::<u32> as fn(usize) -> bool}>`
|
||||
found struct `Checked<{generic::<u16> as fn(usize) -> bool}>`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue