We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8c097d5 + 75cc403 commit 0a6d177Copy full SHA for 0a6d177
src/librustc_typeck/check/cast.rs
@@ -536,7 +536,10 @@ impl<'a, 'tcx> CastCheck<'tcx> {
536
match self.expr_ty.kind {
537
ty::FnDef(..) => {
538
// Attempt a coercion to a fn pointer type.
539
- let f = self.expr_ty.fn_sig(fcx.tcx);
+ let f = fcx.normalize_associated_types_in(
540
+ self.expr.span,
541
+ &self.expr_ty.fn_sig(fcx.tcx),
542
+ );
543
let res = fcx.try_coerce(
544
self.expr,
545
self.expr_ty,
src/test/ui/issues/issue-54094.rs
@@ -0,0 +1,14 @@
1
+// check-pass
2
+trait Zoo {
3
+ type X;
4
+}
5
+
6
+impl Zoo for u16 {
7
+ type X = usize;
8
9
10
+fn foo(abc: <u16 as Zoo>::X) {}
11
12
+fn main() {
13
+ let x: *const u8 = foo as _;
14
0 commit comments