@@ -2432,6 +2432,12 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
2432
2432
1
2433
2433
} ;
2434
2434
2435
+ // All the input types from the fn signature must outlive the call
2436
+ // so as to validate implied bounds.
2437
+ for & fn_input_ty in fn_inputs {
2438
+ fcx. register_wf_obligation ( fn_input_ty, sp, traits:: MiscObligation ) ;
2439
+ }
2440
+
2435
2441
let mut expected_arg_tys = expected_arg_tys;
2436
2442
let expected_arg_count = fn_inputs. len ( ) ;
2437
2443
let formal_tys = if tuple_arguments == TupleArguments {
@@ -3541,16 +3547,18 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
3541
3547
}
3542
3548
ast:: ExprCall ( ref callee, ref args) => {
3543
3549
callee:: check_call ( fcx, expr, & * * callee, & args[ ..] , expected) ;
3550
+
3551
+ // we must check that return type of called functions is WF:
3552
+ let ret_ty = fcx. expr_ty ( expr) ;
3553
+ fcx. register_wf_obligation ( ret_ty, expr. span , traits:: MiscObligation ) ;
3544
3554
}
3545
3555
ast:: ExprMethodCall ( ident, ref tps, ref args) => {
3546
- check_method_call ( fcx, expr, ident, & args[ ..] , & tps[ ..] , expected, lvalue_pref) ;
3547
- let arg_tys = args. iter ( ) . map ( |a| fcx. expr_ty ( & * * a) ) ;
3548
- let args_err = arg_tys. fold ( false ,
3549
- |rest_err, a| {
3550
- rest_err || a. references_error ( ) } ) ;
3551
- if args_err {
3552
- fcx. write_error ( id) ;
3553
- }
3556
+ check_method_call ( fcx, expr, ident, & args[ ..] , & tps[ ..] , expected, lvalue_pref) ;
3557
+ let arg_tys = args. iter ( ) . map ( |a| fcx. expr_ty ( & * * a) ) ;
3558
+ let args_err = arg_tys. fold ( false , |rest_err, a| rest_err || a. references_error ( ) ) ;
3559
+ if args_err {
3560
+ fcx. write_error ( id) ;
3561
+ }
3554
3562
}
3555
3563
ast:: ExprCast ( ref e, ref t) => {
3556
3564
if let ast:: TyFixedLengthVec ( _, ref count_expr) = t. node {
0 commit comments