about summary refs log tree commit diff
path: root/src/librustc/mir
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2017-07-21 14:49:01 -0700
committerRalf Jung <post@ralfj.de>2017-07-30 01:11:59 -0700
commite869cf2be74372db55b64eb549f4dc0e6b5a667b (patch)
tree0f1cf2eba8a6f9d30e9b207d02bf3f55f1a0f926 /src/librustc/mir
parent60096b9e8259ba227a0a85fc1a16dca5d3fd2217 (diff)
downloadrust-e869cf2be74372db55b64eb549f4dc0e6b5a667b.tar.gz
rust-e869cf2be74372db55b64eb549f4dc0e6b5a667b.zip
make ValidationOperand generic so that we can reuse it in miri with a different Lvalue type
Diffstat (limited to 'src/librustc/mir')
-rw-r--r--src/librustc/mir/mod.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index 4655f8a9c15..f8261f80629 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -826,7 +826,7 @@ pub enum StatementKind<'tcx> {
     },
 
     /// Assert the given lvalues to be valid inhabitants of their type.
-    Validate(ValidationOp, Vec<ValidationOperand<'tcx>>),
+    Validate(ValidationOp, Vec<ValidationOperand<'tcx, Lvalue<'tcx>>>),
 
     /// Mark one terminating point of an extent (i.e. static region).
     /// (The starting point(s) arise implicitly from borrows.)
@@ -855,15 +855,16 @@ impl Debug for ValidationOp {
     }
 }
 
+// This is generic so that it can be reused by miri
 #[derive(Clone, RustcEncodable, RustcDecodable)]
-pub struct ValidationOperand<'tcx> {
-    pub lval: Lvalue<'tcx>,
+pub struct ValidationOperand<'tcx, T> {
+    pub lval: T,
     pub ty: Ty<'tcx>,
     pub re: Option<CodeExtent>,
     pub mutbl: hir::Mutability,
 }
 
-impl<'tcx> Debug for ValidationOperand<'tcx> {
+impl<'tcx, T: Debug> Debug for ValidationOperand<'tcx, T> {
     fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
         write!(fmt, "{:?}@{:?}", self.lval, self.ty)?;
         if let Some(ce) = self.re {
@@ -1527,7 +1528,7 @@ impl<'tcx> TypeFoldable<'tcx> for BasicBlockData<'tcx> {
     }
 }
 
-impl<'tcx> TypeFoldable<'tcx> for ValidationOperand<'tcx> {
+impl<'tcx> TypeFoldable<'tcx> for ValidationOperand<'tcx, Lvalue<'tcx>> {
     fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
         ValidationOperand {
             lval: self.lval.fold_with(folder),