Skip to content

Commit 7be059f

Browse files
committed
Propagate expected type more widely so that we can rewrite the
issue-14039 test in a more natural way. Previously the "type we will cast to" was hidden unless it was an integer.
1 parent 5a6a26a commit 7be059f

File tree

1 file changed

+1
-7
lines changed
  • src/librustc_typeck/check

1 file changed

+1
-7
lines changed

src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,13 +1390,7 @@ fn check_cast(fcx: &FnCtxt,
13901390
let t_1 = fcx.to_ty(t);
13911391
let t_1 = structurally_resolved_type(fcx, span, t_1);
13921392

1393-
if ty::type_is_scalar(t_1) {
1394-
// Supply the type as a hint so as to influence integer
1395-
// literals and other things that might care.
1396-
check_expr_with_expectation(fcx, e, ExpectCastableToType(t_1))
1397-
} else {
1398-
check_expr(fcx, e)
1399-
}
1393+
check_expr_with_expectation(fcx, e, ExpectCastableToType(t_1));
14001394

14011395
let t_e = fcx.expr_ty(e);
14021396

0 commit comments

Comments
 (0)