File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
src/librustc_trans/trans/mir Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 9
9
// except according to those terms.
10
10
11
11
use llvm:: ValueRef ;
12
- use rustc:: middle:: ty:: Ty ;
12
+ use rustc:: middle:: ty:: { self , Ty } ;
13
13
use rustc_mir:: repr as mir;
14
14
use rustc_mir:: tcx:: LvalueTy ;
15
15
use trans:: adt;
@@ -52,10 +52,17 @@ impl<'tcx> LvalueRef<'tcx> {
52
52
53
53
impl < ' bcx , ' tcx > MirContext < ' bcx , ' tcx > {
54
54
pub fn lvalue_len ( & mut self ,
55
- _bcx : Block < ' bcx , ' tcx > ,
56
- _lvalue : LvalueRef < ' tcx > )
55
+ bcx : Block < ' bcx , ' tcx > ,
56
+ lvalue : LvalueRef < ' tcx > )
57
57
-> ValueRef {
58
- unimplemented ! ( )
58
+ match lvalue. ty . to_ty ( bcx. tcx ( ) ) . sty {
59
+ ty:: TyArray ( _, n) => common:: C_uint ( bcx. ccx ( ) , n) ,
60
+ ty:: TySlice ( _) | ty:: TyStr => {
61
+ assert ! ( lvalue. llextra != ptr:: null_mut( ) ) ;
62
+ lvalue. llextra
63
+ }
64
+ _ => bcx. sess ( ) . bug ( "unexpected type in get_base_and_len" ) ,
65
+ }
59
66
}
60
67
61
68
pub fn trans_lvalue ( & mut self ,
You can’t perform that action at this time.
0 commit comments