Normalize function signature in function casting check
This commit is contained in:
parent
0c835b0cca
commit
68b38c3bd9
@ -536,7 +536,10 @@ impl<'a, 'tcx> CastCheck<'tcx> {
|
||||
match self.expr_ty.kind {
|
||||
ty::FnDef(..) => {
|
||||
// Attempt a coercion to a fn pointer type.
|
||||
let f = self.expr_ty.fn_sig(fcx.tcx);
|
||||
let f = fcx.normalize_associated_types_in(
|
||||
self.expr.span,
|
||||
&self.expr_ty.fn_sig(fcx.tcx),
|
||||
);
|
||||
let res = fcx.try_coerce(
|
||||
self.expr,
|
||||
self.expr_ty,
|
||||
|
14
src/test/ui/issues/issue-54094.rs
Normal file
14
src/test/ui/issues/issue-54094.rs
Normal file
@ -0,0 +1,14 @@
|
||||
// check-pass
|
||||
trait Zoo {
|
||||
type X;
|
||||
}
|
||||
|
||||
impl Zoo for u16 {
|
||||
type X = usize;
|
||||
}
|
||||
|
||||
fn foo(abc: <u16 as Zoo>::X) {}
|
||||
|
||||
fn main() {
|
||||
let x: *const u8 = foo as _;
|
||||
}
|
Loading…
Reference in New Issue
Block a user