mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
Implement Rvalue::Aggregate(AggregateKind::Array, ...)
This commit is contained in:
parent
2fd0d52834
commit
e9422fd4d4
@ -166,3 +166,7 @@ fn float_cast(a: f32, b: f64) -> (f64, f32) {
|
||||
fn int_to_float(a: u8, b: i32) -> (f64, f32) {
|
||||
(a as f64, b as f32)
|
||||
}
|
||||
|
||||
fn make_array() -> [u8; 3] {
|
||||
[42, 0, 5]
|
||||
}
|
||||
|
@ -30,6 +30,21 @@ unsafe impl Copy for char {}
|
||||
unsafe impl<'a, T: ?Sized> Copy for &'a T {}
|
||||
unsafe impl<T: ?Sized> Copy for *const T {}
|
||||
|
||||
#[lang = "sync"]
|
||||
pub unsafe trait Sync {}
|
||||
|
||||
unsafe impl Sync for bool {}
|
||||
unsafe impl Sync for u8 {}
|
||||
unsafe impl Sync for u16 {}
|
||||
unsafe impl Sync for u32 {}
|
||||
unsafe impl Sync for u64 {}
|
||||
unsafe impl Sync for usize {}
|
||||
unsafe impl Sync for i8 {}
|
||||
unsafe impl Sync for i16 {}
|
||||
unsafe impl Sync for i32 {}
|
||||
unsafe impl Sync for isize {}
|
||||
unsafe impl Sync for char {}
|
||||
|
||||
#[lang = "freeze"]
|
||||
trait Freeze {}
|
||||
|
||||
|
12
src/base.rs
12
src/base.rs
@ -463,7 +463,17 @@ fn trans_stmt<'a, 'tcx: 'a>(fx: &mut FunctionCx<'a, 'tcx>, cur_ebb: Ebb, stmt: &
|
||||
let val = CValue::const_val(fx, fx.tcx.types.usize, ty_size as i64);
|
||||
lval.write_cvalue(fx, val);
|
||||
}
|
||||
Rvalue::Aggregate(_, _) => unimpl!("shouldn't exist at trans {:?}", rval),
|
||||
Rvalue::Aggregate(kind, operands) => match **kind {
|
||||
AggregateKind::Array(_ty) => {
|
||||
for (i, operand) in operands.into_iter().enumerate() {
|
||||
let operand = trans_operand(fx, operand);
|
||||
let index = fx.bcx.ins().iconst(types::I64, i as i64);
|
||||
let to = lval.place_index(fx, index);
|
||||
to.write_cvalue(fx, operand);
|
||||
}
|
||||
}
|
||||
_ => unimpl!("shouldn't exist at trans {:?}", rval),
|
||||
},
|
||||
}
|
||||
}
|
||||
StatementKind::StorageLive(_)
|
||||
|
Loading…
Reference in New Issue
Block a user