mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 04:56:25 +03:00
implement lvalue_len
no tests - sorry
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
use llvm::ValueRef;
|
||||
use rustc::middle::ty::Ty;
|
||||
use rustc::middle::ty::{self, Ty};
|
||||
use rustc_mir::repr as mir;
|
||||
use rustc_mir::tcx::LvalueTy;
|
||||
use trans::adt;
|
||||
@@ -52,10 +52,17 @@ pub fn alloca<'bcx>(bcx: Block<'bcx, 'tcx>,
|
||||
|
||||
impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
|
||||
pub fn lvalue_len(&mut self,
|
||||
_bcx: Block<'bcx, 'tcx>,
|
||||
_lvalue: LvalueRef<'tcx>)
|
||||
bcx: Block<'bcx, 'tcx>,
|
||||
lvalue: LvalueRef<'tcx>)
|
||||
-> ValueRef {
|
||||
unimplemented!()
|
||||
match lvalue.ty.to_ty(bcx.tcx()).sty {
|
||||
ty::TyArray(_, n) => common::C_uint(bcx.ccx(), n),
|
||||
ty::TySlice(_) | ty::TyStr => {
|
||||
assert!(lvalue.llextra != ptr::null_mut());
|
||||
lvalue.llextra
|
||||
}
|
||||
_ => bcx.sess().bug("unexpected type in get_base_and_len"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn trans_lvalue(&mut self,
|
||||
|
||||
Reference in New Issue
Block a user