@@ -112,6 +112,7 @@ use std::cell::{Cell, Ref, RefCell};
112
112
use std:: mem:: replace;
113
113
use std:: rc:: Rc ;
114
114
use std:: iter:: repeat;
115
+ use std:: slice;
115
116
use syntax:: { self , abi, attr} ;
116
117
use syntax:: ast:: { self , ProvidedMethod , RequiredMethod , TypeTraitItem , DefId } ;
117
118
use syntax:: ast_util:: { self , local_def, PostExpansionMethod } ;
@@ -2598,7 +2599,7 @@ fn check_method_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
2598
2599
sp : Span ,
2599
2600
method_fn_ty : Ty < ' tcx > ,
2600
2601
callee_expr : & ast:: Expr ,
2601
- args_no_rcvr : & [ & P < ast:: Expr > ] ,
2602
+ args_no_rcvr : & [ P < ast:: Expr > ] ,
2602
2603
autoref_args : AutorefArgs ,
2603
2604
tuple_arguments : TupleArgumentsFlag )
2604
2605
-> ty:: FnOutput < ' tcx > {
@@ -2624,7 +2625,7 @@ fn check_method_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
2624
2625
// HACK(eddyb) ignore self in the definition (see above).
2625
2626
check_argument_types ( fcx,
2626
2627
sp,
2627
- fty. sig . 0 . inputs . slice_from ( 1 ) ,
2628
+ & fty. sig . 0 . inputs [ 1 .. ] ,
2628
2629
args_no_rcvr,
2629
2630
autoref_args,
2630
2631
fty. sig . 0 . variadic ,
@@ -2644,7 +2645,7 @@ fn check_method_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
2644
2645
fn check_argument_types < ' a , ' tcx > ( fcx : & FnCtxt < ' a , ' tcx > ,
2645
2646
sp : Span ,
2646
2647
fn_inputs : & [ Ty < ' tcx > ] ,
2647
- args : & [ & P < ast:: Expr > ] ,
2648
+ args : & [ P < ast:: Expr > ] ,
2648
2649
autoref_args : AutorefArgs ,
2649
2650
variadic : bool ,
2650
2651
tuple_arguments : TupleArgumentsFlag ) {
@@ -2767,7 +2768,7 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
2767
2768
AutorefArgs :: No => { }
2768
2769
}
2769
2770
2770
- check_expr_coercable_to_type ( fcx, & * * * arg, formal_ty) ;
2771
+ check_expr_coercable_to_type ( fcx, & * * arg, formal_ty) ;
2771
2772
}
2772
2773
}
2773
2774
}
@@ -2776,12 +2777,12 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
2776
2777
// arguments which we skipped above.
2777
2778
if variadic {
2778
2779
for arg in args. iter ( ) . skip ( expected_arg_count) {
2779
- check_expr ( fcx, & * * * arg) ;
2780
+ check_expr ( fcx, & * * arg) ;
2780
2781
2781
2782
// There are a few types which get autopromoted when passed via varargs
2782
2783
// in C but we just error out instead and require explicit casts.
2783
2784
let arg_ty = structurally_resolved_type ( fcx, arg. span ,
2784
- fcx. expr_ty ( & * * * arg) ) ;
2785
+ fcx. expr_ty ( & * * arg) ) ;
2785
2786
match arg_ty. sty {
2786
2787
ty:: ty_float( ast:: TyF32 ) => {
2787
2788
fcx. type_error_message ( arg. span ,
@@ -3064,12 +3065,11 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
3064
3065
} ;
3065
3066
3066
3067
// Call the generic checker.
3067
- let args: Vec < _ > = args[ 1 ..] . iter ( ) . map ( |x| x) . collect ( ) ;
3068
3068
let ret_ty = check_method_argument_types ( fcx,
3069
3069
method_name. span ,
3070
3070
fn_ty,
3071
3071
expr,
3072
- args. as_slice ( ) ,
3072
+ & args[ 1 .. ] ,
3073
3073
AutorefArgs :: No ,
3074
3074
DontTupleArguments ) ;
3075
3075
@@ -3167,8 +3167,8 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
3167
3167
None => None
3168
3168
} ;
3169
3169
let args = match rhs {
3170
- Some ( rhs) => vec ! [ rhs] ,
3171
- None => vec ! [ ]
3170
+ Some ( rhs) => slice :: ref_slice ( rhs) ,
3171
+ None => & [ ] [ ]
3172
3172
} ;
3173
3173
match method {
3174
3174
Some ( method) => {
@@ -3177,12 +3177,12 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
3177
3177
let method_call = :: middle:: ty:: MethodCall :: expr ( op_ex. id ) ;
3178
3178
fcx. inh . method_map . borrow_mut ( ) . insert ( method_call, method) ;
3179
3179
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 ) {
3186
3186
ty:: FnConverging ( result_type) => result_type,
3187
3187
ty:: FnDiverging => fcx. tcx ( ) . types . err
3188
3188
}
@@ -3196,7 +3196,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
3196
3196
op_ex. span ,
3197
3197
expected_ty,
3198
3198
op_ex,
3199
- args. as_slice ( ) ,
3199
+ args,
3200
3200
autoref_args,
3201
3201
DontTupleArguments ) ;
3202
3202
fcx. tcx ( ) . types . err
@@ -4045,10 +4045,10 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
4045
4045
fcx. write_ty ( id, fcx. node_ty ( b. id ) ) ;
4046
4046
}
4047
4047
ast:: ExprCall ( ref callee, ref args) => {
4048
- callee:: check_call ( fcx, expr, & * * callee, args. as_slice ( ) ) ;
4048
+ callee:: check_call ( fcx, expr, & * * callee, & args[ ] ) ;
4049
4049
}
4050
4050
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) ;
4052
4052
let arg_tys = args. iter ( ) . map ( |a| fcx. expr_ty ( & * * a) ) ;
4053
4053
let args_err = arg_tys. fold ( false ,
4054
4054
|rest_err, a| {
0 commit comments