@@ -112,6 +112,7 @@ use std::cell::{Cell, Ref, RefCell};
112112use std:: mem:: replace;
113113use std:: rc:: Rc ;
114114use std:: iter:: repeat;
115+ use std:: slice;
115116use syntax:: { self , abi, attr} ;
116117use syntax:: ast:: { self , ProvidedMethod , RequiredMethod , TypeTraitItem , DefId } ;
117118use syntax:: ast_util:: { self , local_def, PostExpansionMethod } ;
@@ -2598,7 +2599,7 @@ fn check_method_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
25982599 sp : Span ,
25992600 method_fn_ty : Ty < ' tcx > ,
26002601 callee_expr : & ast:: Expr ,
2601- args_no_rcvr : & [ & P < ast:: Expr > ] ,
2602+ args_no_rcvr : & [ P < ast:: Expr > ] ,
26022603 autoref_args : AutorefArgs ,
26032604 tuple_arguments : TupleArgumentsFlag )
26042605 -> ty:: FnOutput < ' tcx > {
@@ -2624,7 +2625,7 @@ fn check_method_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
26242625 // HACK(eddyb) ignore self in the definition (see above).
26252626 check_argument_types ( fcx,
26262627 sp,
2627- fty. sig . 0 . inputs . slice_from ( 1 ) ,
2628+ & fty. sig . 0 . inputs [ 1 .. ] ,
26282629 args_no_rcvr,
26292630 autoref_args,
26302631 fty. sig . 0 . variadic ,
@@ -2644,7 +2645,7 @@ fn check_method_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
26442645fn check_argument_types < ' a , ' tcx > ( fcx : & FnCtxt < ' a , ' tcx > ,
26452646 sp : Span ,
26462647 fn_inputs : & [ Ty < ' tcx > ] ,
2647- args : & [ & P < ast:: Expr > ] ,
2648+ args : & [ P < ast:: Expr > ] ,
26482649 autoref_args : AutorefArgs ,
26492650 variadic : bool ,
26502651 tuple_arguments : TupleArgumentsFlag ) {
@@ -2767,7 +2768,7 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
27672768 AutorefArgs :: No => { }
27682769 }
27692770
2770- check_expr_coercable_to_type ( fcx, & * * * arg, formal_ty) ;
2771+ check_expr_coercable_to_type ( fcx, & * * arg, formal_ty) ;
27712772 }
27722773 }
27732774 }
@@ -2776,12 +2777,12 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
27762777 // arguments which we skipped above.
27772778 if variadic {
27782779 for arg in args. iter ( ) . skip ( expected_arg_count) {
2779- check_expr ( fcx, & * * * arg) ;
2780+ check_expr ( fcx, & * * arg) ;
27802781
27812782 // There are a few types which get autopromoted when passed via varargs
27822783 // in C but we just error out instead and require explicit casts.
27832784 let arg_ty = structurally_resolved_type ( fcx, arg. span ,
2784- fcx. expr_ty ( & * * * arg) ) ;
2785+ fcx. expr_ty ( & * * arg) ) ;
27852786 match arg_ty. sty {
27862787 ty:: ty_float( ast:: TyF32 ) => {
27872788 fcx. type_error_message ( arg. span ,
@@ -3064,12 +3065,11 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
30643065 } ;
30653066
30663067 // Call the generic checker.
3067- let args: Vec < _ > = args[ 1 ..] . iter ( ) . map ( |x| x) . collect ( ) ;
30683068 let ret_ty = check_method_argument_types ( fcx,
30693069 method_name. span ,
30703070 fn_ty,
30713071 expr,
3072- args. as_slice ( ) ,
3072+ & args[ 1 .. ] ,
30733073 AutorefArgs :: No ,
30743074 DontTupleArguments ) ;
30753075
@@ -3167,8 +3167,8 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
31673167 None => None
31683168 } ;
31693169 let args = match rhs {
3170- Some ( rhs) => vec ! [ rhs] ,
3171- None => vec ! [ ]
3170+ Some ( rhs) => slice :: ref_slice ( rhs) ,
3171+ None => & [ ] [ ]
31723172 } ;
31733173 match method {
31743174 Some ( method) => {
@@ -3177,12 +3177,12 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
31773177 let method_call = :: middle:: ty:: MethodCall :: expr ( op_ex. id ) ;
31783178 fcx. inh . method_map . borrow_mut ( ) . insert ( method_call, method) ;
31793179 match check_method_argument_types ( fcx,
3180- op_ex. span ,
3181- method_ty,
3182- op_ex,
3183- args. as_slice ( ) ,
3184- autoref_args,
3185- DontTupleArguments ) {
3180+ op_ex. span ,
3181+ method_ty,
3182+ op_ex,
3183+ args,
3184+ autoref_args,
3185+ DontTupleArguments ) {
31863186 ty:: FnConverging ( result_type) => result_type,
31873187 ty:: FnDiverging => fcx. tcx ( ) . types . err
31883188 }
@@ -3196,7 +3196,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
31963196 op_ex. span ,
31973197 expected_ty,
31983198 op_ex,
3199- args. as_slice ( ) ,
3199+ args,
32003200 autoref_args,
32013201 DontTupleArguments ) ;
32023202 fcx. tcx ( ) . types . err
@@ -4045,10 +4045,10 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
40454045 fcx. write_ty ( id, fcx. node_ty ( b. id ) ) ;
40464046 }
40474047 ast:: ExprCall ( ref callee, ref args) => {
4048- callee:: check_call ( fcx, expr, & * * callee, args. as_slice ( ) ) ;
4048+ callee:: check_call ( fcx, expr, & * * callee, & args[ ] ) ;
40494049 }
40504050 ast:: ExprMethodCall ( ident, ref tps, ref args) => {
4051- check_method_call ( fcx, expr, ident, args. as_slice ( ) , tps. as_slice ( ) , lvalue_pref) ;
4051+ check_method_call ( fcx, expr, ident, & args[ ] , & tps[ ] , lvalue_pref) ;
40524052 let arg_tys = args. iter ( ) . map ( |a| fcx. expr_ty ( & * * a) ) ;
40534053 let args_err = arg_tys. fold ( false ,
40544054 |rest_err, a| {
0 commit comments