@@ -585,36 +585,40 @@ fn trans_datum_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
585
585
trans_rec_tup_field ( bcx, & * * base, idx. node )
586
586
}
587
587
ast:: ExprIndex ( ref base, ref idx) => {
588
- trans_index ( bcx, expr, & * * base, & * * idx, MethodCall :: expr ( expr. id ) )
589
- }
590
- ast:: ExprSlice ( ref base, ref start, ref end, _) => {
591
- let _icx = push_ctxt ( "trans_slice" ) ;
592
- let ccx = bcx. ccx ( ) ;
593
-
594
- let method_call = MethodCall :: expr ( expr. id ) ;
595
- let method_ty = ccx. tcx ( )
596
- . method_map
597
- . borrow ( )
598
- . get ( & method_call)
599
- . map ( |method| method. ty ) ;
600
- let base_datum = unpack_datum ! ( bcx, trans( bcx, & * * base) ) ;
601
-
602
- let mut args = vec ! [ ] ;
603
- start. as_ref ( ) . map ( |e| args. push ( ( unpack_datum ! ( bcx, trans( bcx, & * * e) ) , e. id ) ) ) ;
604
- end. as_ref ( ) . map ( |e| args. push ( ( unpack_datum ! ( bcx, trans( bcx, & * * e) ) , e. id ) ) ) ;
605
-
606
- let result_ty = ty:: ty_fn_ret ( monomorphize_type ( bcx, method_ty. unwrap ( ) ) ) . unwrap ( ) ;
607
- let scratch = rvalue_scratch_datum ( bcx, result_ty, "trans_slice" ) ;
608
-
609
- unpack_result ! ( bcx,
610
- trans_overloaded_op( bcx,
611
- expr,
612
- method_call,
613
- base_datum,
614
- args,
615
- Some ( SaveIn ( scratch. val) ) ,
616
- true ) ) ;
617
- DatumBlock :: new ( bcx, scratch. to_expr_datum ( ) )
588
+ match idx. node {
589
+ ast:: ExprRange ( ref start, ref end) => {
590
+ // Special case for slicing syntax (KILLME).
591
+ let _icx = push_ctxt ( "trans_slice" ) ;
592
+ let ccx = bcx. ccx ( ) ;
593
+
594
+ let method_call = MethodCall :: expr ( expr. id ) ;
595
+ let method_ty = ccx. tcx ( )
596
+ . method_map
597
+ . borrow ( )
598
+ . get ( & method_call)
599
+ . map ( |method| method. ty ) ;
600
+ let base_datum = unpack_datum ! ( bcx, trans( bcx, & * * base) ) ;
601
+
602
+ let mut args = vec ! [ ] ;
603
+ start. as_ref ( ) . map ( |e| args. push ( ( unpack_datum ! ( bcx, trans( bcx, & * * e) ) , e. id ) ) ) ;
604
+ end. as_ref ( ) . map ( |e| args. push ( ( unpack_datum ! ( bcx, trans( bcx, & * * e) ) , e. id ) ) ) ;
605
+
606
+ let result_ty = ty:: ty_fn_ret ( monomorphize_type ( bcx,
607
+ method_ty. unwrap ( ) ) ) . unwrap ( ) ;
608
+ let scratch = rvalue_scratch_datum ( bcx, result_ty, "trans_slice" ) ;
609
+
610
+ unpack_result ! ( bcx,
611
+ trans_overloaded_op( bcx,
612
+ expr,
613
+ method_call,
614
+ base_datum,
615
+ args,
616
+ Some ( SaveIn ( scratch. val) ) ,
617
+ true ) ) ;
618
+ DatumBlock :: new ( bcx, scratch. to_expr_datum ( ) )
619
+ }
620
+ _ => trans_index ( bcx, expr, & * * base, & * * idx, MethodCall :: expr ( expr. id ) )
621
+ }
618
622
}
619
623
ast:: ExprBox ( _, ref contents) => {
620
624
// Special case for `Box<T>`
0 commit comments