Implement Rvalue::Repeat
This commit is contained in:
parent
efd203aa0b
commit
1305d1ef23
@ -146,3 +146,7 @@ unsafe fn call_uninit() -> u8 {
|
||||
fn use_array(arr: [u8; 3]) -> u8 {
|
||||
arr[1]
|
||||
}
|
||||
|
||||
fn repeat_array() -> [u8; 3] {
|
||||
[0; 3]
|
||||
}
|
||||
|
@ -412,7 +412,12 @@ fn trans_stmt<'a, 'tcx: 'a>(
|
||||
lval.write_cvalue(fx, discr);
|
||||
}
|
||||
Rvalue::Repeat(operand, times) => {
|
||||
unimplemented!("rval repeat {:?} {:?}", operand, times)
|
||||
let operand = trans_operand(fx, operand);
|
||||
for i in 0..*times {
|
||||
let index = fx.bcx.ins().iconst(types::I64, i as i64);
|
||||
let to = lval.place_index(fx, index);
|
||||
to.write_cvalue(fx, operand);
|
||||
}
|
||||
}
|
||||
Rvalue::Len(lval) => return Err(format!("rval len {:?}", lval)),
|
||||
Rvalue::NullaryOp(NullOp::Box, ty) => unimplemented!("rval box {:?}", ty),
|
||||
|
Loading…
Reference in New Issue
Block a user