mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 14:10:03 +03:00
handle array types
This commit is contained in:
committed by
Oliver Schneider
parent
4457a52d4f
commit
bb6e5224da
@@ -531,7 +531,7 @@ pub(super) fn validate(&mut self, lvalue: Lvalue<'tcx>, ty: Ty<'tcx>, mut vctx:
|
||||
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 @@ pub(super) fn validate(&mut self, lvalue: Lvalue<'tcx>, ty: Ty<'tcx>, mut vctx:
|
||||
}
|
||||
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()?;
|
||||
|
||||
Reference in New Issue
Block a user