handle array types
This commit is contained in:
parent
4457a52d4f
commit
bb6e5224da
1 changed files with 8 additions and 1 deletions
|
|
@ -531,7 +531,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
|||
TyBool | TyFloat(_) | TyChar | TyStr |
|
||||
TyRef(..) => true,
|
||||
TyAdt(adt, _) if adt.is_box() => true,
|
||||
TyAdt(_, _) | TyTuple(..) | TyClosure(..) => false,
|
||||
TySlice(_) | TyAdt(_, _) | TyTuple(..) | TyClosure(..) | TyArray(..) => false,
|
||||
TyParam(_) | TyInfer(_) => bug!("I got an incomplete type for validation"),
|
||||
_ => return Err(EvalError::Unimplemented(format!("Unimplemented type encountered when checking validity."))),
|
||||
};
|
||||
|
|
@ -622,6 +622,13 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
TyArray(elem_ty, len) => {
|
||||
for i in 0..len {
|
||||
let inner_lvalue = self.lvalue_index(lvalue, ty, i as u64)?;
|
||||
self.validate(inner_lvalue, elem_ty, vctx)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
TyFnPtr(_sig) => {
|
||||
// TODO: The function names here could need some improvement.
|
||||
let ptr = self.read_lvalue(lvalue)?.into_ptr(&mut self.memory)?.to_ptr()?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue