@@ -2490,7 +2490,7 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
2490
2490
// The special-cased logic below has three functions:
2491
2491
// 1. Provide as good of an expected type as possible.
2492
2492
let expected = expected_arg_tys. get ( i) . map ( |& ty| {
2493
- Expectation :: rvalue_hint ( ty)
2493
+ Expectation :: rvalue_hint ( fcx . tcx ( ) , ty)
2494
2494
} ) ;
2495
2495
2496
2496
check_expr_with_unifier ( fcx, & * * arg,
@@ -3268,7 +3268,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
3268
3268
match unop {
3269
3269
ast:: UnUniq => match ty. sty {
3270
3270
ty:: TyBox ( ty) => {
3271
- Expectation :: rvalue_hint ( ty)
3271
+ Expectation :: rvalue_hint ( tcx , ty)
3272
3272
}
3273
3273
_ => {
3274
3274
NoExpectation
@@ -3345,7 +3345,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
3345
3345
// the last field of a struct can be unsized.
3346
3346
ExpectHasType ( mt. ty )
3347
3347
} else {
3348
- Expectation :: rvalue_hint ( mt. ty )
3348
+ Expectation :: rvalue_hint ( tcx , mt. ty )
3349
3349
}
3350
3350
}
3351
3351
_ => NoExpectation
@@ -3982,8 +3982,8 @@ impl<'tcx> Expectation<'tcx> {
3982
3982
/// which still is useful, because it informs integer literals and the like.
3983
3983
/// See the test case `test/run-pass/coerce-expect-unsized.rs` and #20169
3984
3984
/// for examples of where this comes up,.
3985
- fn rvalue_hint ( ty : Ty < ' tcx > ) -> Expectation < ' tcx > {
3986
- match ty . sty {
3985
+ fn rvalue_hint ( tcx : & ty :: ctxt < ' tcx > , ty : Ty < ' tcx > ) -> Expectation < ' tcx > {
3986
+ match tcx . struct_tail ( ty ) . sty {
3987
3987
ty:: TySlice ( _) | ty:: TyTrait ( ..) => {
3988
3988
ExpectRvalueLikeUnsized ( ty)
3989
3989
}
0 commit comments