]> git.lizzy.rs Git - rust.git/blob - src/librustc_mir/interpret/validity.rs
fix Miri visiting generators
[rust.git] / src / librustc_mir / interpret / validity.rs
1 use std::fmt::Write;
2 use std::hash::Hash;
3 use std::ops::RangeInclusive;
4
5 use syntax_pos::symbol::Symbol;
6 use rustc::hir;
7 use rustc::ty::layout::{self, Size, Align, TyLayout, LayoutOf, VariantIdx};
8 use rustc::ty;
9 use rustc_data_structures::fx::FxHashSet;
10 use rustc::mir::interpret::{
11     Scalar, AllocKind, EvalResult, InterpError,
12 };
13
14 use super::{
15     OpTy, Machine, InterpretCx, ValueVisitor, MPlaceTy,
16 };
17
18 macro_rules! validation_failure {
19     ($what:expr, $where:expr, $details:expr) => {{
20         let where_ = path_format(&$where);
21         let where_ = if where_.is_empty() {
22             String::new()
23         } else {
24             format!(" at {}", where_)
25         };
26         err!(ValidationFailure(format!(
27             "encountered {}{}, but expected {}",
28             $what, where_, $details,
29         )))
30     }};
31     ($what:expr, $where:expr) => {{
32         let where_ = path_format(&$where);
33         let where_ = if where_.is_empty() {
34             String::new()
35         } else {
36             format!(" at {}", where_)
37         };
38         err!(ValidationFailure(format!(
39             "encountered {}{}",
40             $what, where_,
41         )))
42     }};
43 }
44
45 macro_rules! try_validation {
46     ($e:expr, $what:expr, $where:expr, $details:expr) => {{
47         match $e {
48             Ok(x) => x,
49             Err(_) => return validation_failure!($what, $where, $details),
50         }
51     }};
52
53     ($e:expr, $what:expr, $where:expr) => {{
54         match $e {
55             Ok(x) => x,
56             Err(_) => return validation_failure!($what, $where),
57         }
58     }}
59 }
60
61 /// We want to show a nice path to the invalid field for diagnostics,
62 /// but avoid string operations in the happy case where no error happens.
63 /// So we track a `Vec<PathElem>` where `PathElem` contains all the data we
64 /// need to later print something for the user.
65 #[derive(Copy, Clone, Debug)]
66 pub enum PathElem {
67     Field(Symbol),
68     Variant(Symbol),
69     GeneratoreState(VariantIdx),
70     ClosureVar(Symbol),
71     ArrayElem(usize),
72     TupleElem(usize),
73     Deref,
74     Tag,
75     DynDowncast,
76 }
77
78 /// State for tracking recursive validation of references
79 pub struct RefTracking<T> {
80     pub seen: FxHashSet<T>,
81     pub todo: Vec<(T, Vec<PathElem>)>,
82 }
83
84 impl<'tcx, T: Copy + Eq + Hash> RefTracking<T> {
85     pub fn new(op: T) -> Self {
86         let mut ref_tracking = RefTracking {
87             seen: FxHashSet::default(),
88             todo: vec![(op, Vec::new())],
89         };
90         ref_tracking.seen.insert(op);
91         ref_tracking
92     }
93 }
94
95 /// Format a path
96 fn path_format(path: &Vec<PathElem>) -> String {
97     use self::PathElem::*;
98
99     let mut out = String::new();
100     for elem in path.iter() {
101         match elem {
102             Field(name) => write!(out, ".{}", name),
103             Variant(name) => write!(out, ".<downcast-variant({})>", name),
104             GeneratoreState(idx) => write!(out, ".<generator-state({})>", idx.index()),
105             ClosureVar(name) => write!(out, ".<closure-var({})>", name),
106             TupleElem(idx) => write!(out, ".{}", idx),
107             ArrayElem(idx) => write!(out, "[{}]", idx),
108             Deref =>
109                 // This does not match Rust syntax, but it is more readable for long paths -- and
110                 // some of the other items here also are not Rust syntax.  Actually we can't
111                 // even use the usual syntax because we are just showing the projections,
112                 // not the root.
113                 write!(out, ".<deref>"),
114             Tag => write!(out, ".<enum-tag>"),
115             DynDowncast => write!(out, ".<dyn-downcast>"),
116         }.unwrap()
117     }
118     out
119 }
120
121 // Test if a range that wraps at overflow contains `test`
122 fn wrapping_range_contains(r: &RangeInclusive<u128>, test: u128) -> bool {
123     let (lo, hi) = r.clone().into_inner();
124     if lo > hi {
125         // Wrapped
126         (..=hi).contains(&test) || (lo..).contains(&test)
127     } else {
128         // Normal
129         r.contains(&test)
130     }
131 }
132
133 // Formats such that a sentence like "expected something {}" to mean
134 // "expected something <in the given range>" makes sense.
135 fn wrapping_range_format(r: &RangeInclusive<u128>, max_hi: u128) -> String {
136     let (lo, hi) = r.clone().into_inner();
137     debug_assert!(hi <= max_hi);
138     if lo > hi {
139         format!("less or equal to {}, or greater or equal to {}", hi, lo)
140     } else {
141         if lo == 0 {
142             debug_assert!(hi < max_hi, "should not be printing if the range covers everything");
143             format!("less or equal to {}", hi)
144         } else if hi == max_hi {
145             format!("greater or equal to {}", lo)
146         } else {
147             format!("in the range {:?}", r)
148         }
149     }
150 }
151
152 struct ValidityVisitor<'rt, 'a: 'rt, 'mir: 'rt, 'tcx: 'a+'rt+'mir, M: Machine<'a, 'mir, 'tcx>+'rt> {
153     /// The `path` may be pushed to, but the part that is present when a function
154     /// starts must not be changed!  `visit_fields` and `visit_array` rely on
155     /// this stack discipline.
156     path: Vec<PathElem>,
157     ref_tracking: Option<&'rt mut RefTracking<MPlaceTy<'tcx, M::PointerTag>>>,
158     const_mode: bool,
159     ecx: &'rt InterpretCx<'a, 'mir, 'tcx, M>,
160 }
161
162 impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> ValidityVisitor<'rt, 'a, 'mir, 'tcx, M> {
163     fn aggregate_field_path_elem(
164         &mut self,
165         layout: TyLayout<'tcx>,
166         field: usize,
167     ) -> PathElem {
168         match layout.ty.sty {
169             // generators and closures.
170             ty::Closure(def_id, _) | ty::Generator(def_id, _, _) => {
171                 let mut name = None;
172                 if def_id.is_local() {
173                     let tables = self.ecx.tcx.typeck_tables_of(def_id);
174                     if let Some(upvars) = tables.upvar_list.get(&def_id) {
175                         // Sometimes the index is beyond the number of freevars (seen
176                         // for a generator).
177                         if let Some(upvar_id) = upvars.get(field) {
178                             let var_hir_id = upvar_id.var_path.hir_id;
179                             let var_node_id = self.ecx.tcx.hir().hir_to_node_id(var_hir_id);
180                             if let hir::Node::Binding(pat) = self.ecx.tcx.hir().get(var_node_id) {
181                                 if let hir::PatKind::Binding(_, _, ident, _) = pat.node {
182                                     name = Some(ident.name);
183                                 }
184                             }
185                         }
186                     }
187                 }
188
189                 PathElem::ClosureVar(name.unwrap_or_else(|| {
190                     // Fall back to showing the field index.
191                     Symbol::intern(&field.to_string())
192                 }))
193             }
194
195             // tuples
196             ty::Tuple(_) => PathElem::TupleElem(field),
197
198             // enums
199             ty::Adt(def, ..) if def.is_enum() => {
200                 // we might be projecting *to* a variant, or to a field *in*a variant.
201                 match layout.variants {
202                     layout::Variants::Single { index } =>
203                         // Inside a variant
204                         PathElem::Field(def.variants[index].fields[field].ident.name),
205                     _ => bug!(),
206                 }
207             }
208
209             // other ADTs
210             ty::Adt(def, _) => PathElem::Field(def.non_enum_variant().fields[field].ident.name),
211
212             // arrays/slices
213             ty::Array(..) | ty::Slice(..) => PathElem::ArrayElem(field),
214
215             // dyn traits
216             ty::Dynamic(..) => PathElem::DynDowncast,
217
218             // nothing else has an aggregate layout
219             _ => bug!("aggregate_field_path_elem: got non-aggregate type {:?}", layout.ty),
220         }
221     }
222
223     fn visit_elem(
224         &mut self,
225         new_op: OpTy<'tcx, M::PointerTag>,
226         elem: PathElem,
227     ) -> EvalResult<'tcx> {
228         // Remember the old state
229         let path_len = self.path.len();
230         // Perform operation
231         self.path.push(elem);
232         self.visit_value(new_op)?;
233         // Undo changes
234         self.path.truncate(path_len);
235         Ok(())
236     }
237 }
238
239 impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>>
240     ValueVisitor<'a, 'mir, 'tcx, M> for ValidityVisitor<'rt, 'a, 'mir, 'tcx, M>
241 {
242     type V = OpTy<'tcx, M::PointerTag>;
243
244     #[inline(always)]
245     fn ecx(&self) -> &InterpretCx<'a, 'mir, 'tcx, M> {
246         &self.ecx
247     }
248
249     #[inline]
250     fn visit_field(
251         &mut self,
252         old_op: OpTy<'tcx, M::PointerTag>,
253         field: usize,
254         new_op: OpTy<'tcx, M::PointerTag>
255     ) -> EvalResult<'tcx> {
256         let elem = self.aggregate_field_path_elem(old_op.layout, field);
257         self.visit_elem(new_op, elem)
258     }
259
260     #[inline]
261     fn visit_variant(
262         &mut self,
263         old_op: OpTy<'tcx, M::PointerTag>,
264         variant_id: VariantIdx,
265         new_op: OpTy<'tcx, M::PointerTag>
266     ) -> EvalResult<'tcx> {
267         let name = match old_op.layout.ty.ty_adt_def() {
268             Some(def) => PathElem::Variant(def.variants[variant_id].ident.name),
269             // Generators also have variants but no def
270             None => PathElem::GeneratoreState(variant_id),
271         };
272         self.visit_elem(new_op, name)
273     }
274
275     #[inline]
276     fn visit_value(&mut self, op: OpTy<'tcx, M::PointerTag>) -> EvalResult<'tcx>
277     {
278         trace!("visit_value: {:?}, {:?}", *op, op.layout);
279         // Translate some possible errors to something nicer.
280         match self.walk_value(op) {
281             Ok(()) => Ok(()),
282             Err(err) => match err.kind {
283                 InterpError::InvalidDiscriminant(val) =>
284                     validation_failure!(
285                         val, self.path, "a valid enum discriminant"
286                     ),
287                 InterpError::ReadPointerAsBytes =>
288                     validation_failure!(
289                         "a pointer", self.path, "plain (non-pointer) bytes"
290                     ),
291                 _ => Err(err),
292             }
293         }
294     }
295
296     fn visit_primitive(&mut self, value: OpTy<'tcx, M::PointerTag>) -> EvalResult<'tcx>
297     {
298         let value = self.ecx.read_immediate(value)?;
299         // Go over all the primitive types
300         let ty = value.layout.ty;
301         match ty.sty {
302             ty::Bool => {
303                 let value = value.to_scalar_or_undef();
304                 try_validation!(value.to_bool(),
305                     value, self.path, "a boolean");
306             },
307             ty::Char => {
308                 let value = value.to_scalar_or_undef();
309                 try_validation!(value.to_char(),
310                     value, self.path, "a valid unicode codepoint");
311             },
312             ty::Float(_) | ty::Int(_) | ty::Uint(_) => {
313                 // NOTE: Keep this in sync with the array optimization for int/float
314                 // types below!
315                 let size = value.layout.size;
316                 let value = value.to_scalar_or_undef();
317                 if self.const_mode {
318                     // Integers/floats in CTFE: Must be scalar bits, pointers are dangerous
319                     try_validation!(value.to_bits(size),
320                         value, self.path, "initialized plain (non-pointer) bytes");
321                 } else {
322                     // At run-time, for now, we accept *anything* for these types, including
323                     // undef. We should fix that, but let's start low.
324                 }
325             }
326             ty::RawPtr(..) => {
327                 if self.const_mode {
328                     // Integers/floats in CTFE: For consistency with integers, we do not
329                     // accept undef.
330                     let _ptr = try_validation!(value.to_scalar_ptr(),
331                         "undefined address in raw pointer", self.path);
332                     let _meta = try_validation!(value.to_meta(),
333                         "uninitialized data in raw fat pointer metadata", self.path);
334                 } else {
335                     // Remain consistent with `usize`: Accept anything.
336                 }
337             }
338             _ if ty.is_box() || ty.is_region_ptr() => {
339                 // Handle fat pointers.
340                 // Check metadata early, for better diagnostics
341                 let ptr = try_validation!(value.to_scalar_ptr(),
342                     "undefined address in pointer", self.path);
343                 let meta = try_validation!(value.to_meta(),
344                     "uninitialized data in fat pointer metadata", self.path);
345                 let layout = self.ecx.layout_of(value.layout.ty.builtin_deref(true).unwrap().ty)?;
346                 if layout.is_unsized() {
347                     let tail = self.ecx.tcx.struct_tail(layout.ty);
348                     match tail.sty {
349                         ty::Dynamic(..) => {
350                             let vtable = try_validation!(meta.unwrap().to_ptr(),
351                                 "non-pointer vtable in fat pointer", self.path);
352                             try_validation!(self.ecx.read_drop_type_from_vtable(vtable),
353                                 "invalid drop fn in vtable", self.path);
354                             try_validation!(self.ecx.read_size_and_align_from_vtable(vtable),
355                                 "invalid size or align in vtable", self.path);
356                             // FIXME: More checks for the vtable.
357                         }
358                         ty::Slice(..) | ty::Str => {
359                             try_validation!(meta.unwrap().to_usize(self.ecx),
360                                 "non-integer slice length in fat pointer", self.path);
361                         }
362                         ty::Foreign(..) => {
363                             // Unsized, but not fat.
364                         }
365                         _ =>
366                             bug!("Unexpected unsized type tail: {:?}", tail),
367                     }
368                 }
369                 // Make sure this is non-NULL and aligned
370                 let (size, align) = self.ecx.size_and_align_of(meta, layout)?
371                     // for the purpose of validity, consider foreign types to have
372                     // alignment and size determined by the layout (size will be 0,
373                     // alignment should take attributes into account).
374                     .unwrap_or_else(|| (layout.size, layout.align.abi));
375                 match self.ecx.memory.check_align(ptr, align) {
376                     Ok(_) => {},
377                     Err(err) => {
378                         info!("{:?} is not aligned to {:?}", ptr, align);
379                         match err.kind {
380                             InterpError::InvalidNullPointerUsage =>
381                                 return validation_failure!("NULL reference", self.path),
382                             InterpError::AlignmentCheckFailed { required, has } =>
383                                 return validation_failure!(format!("unaligned reference \
384                                     (required {} byte alignment but found {})",
385                                     required.bytes(), has.bytes()), self.path),
386                             _ =>
387                                 return validation_failure!(
388                                     "dangling (out-of-bounds) reference (might be NULL at \
389                                         run-time)",
390                                     self.path
391                                 ),
392                         }
393                     }
394                 }
395                 // Recursive checking
396                 if let Some(ref mut ref_tracking) = self.ref_tracking {
397                     assert!(self.const_mode, "We should only do recursie checking in const mode");
398                     let place = self.ecx.ref_to_mplace(value)?;
399                     if size != Size::ZERO {
400                         // Non-ZST also have to be dereferencable
401                         let ptr = try_validation!(place.ptr.to_ptr(),
402                             "integer pointer in non-ZST reference", self.path);
403                         // Skip validation entirely for some external statics
404                         let alloc_kind = self.ecx.tcx.alloc_map.lock().get(ptr.alloc_id);
405                         if let Some(AllocKind::Static(did)) = alloc_kind {
406                             // `extern static` cannot be validated as they have no body.
407                             // FIXME: Statics from other crates are also skipped.
408                             // They might be checked at a different type, but for now we
409                             // want to avoid recursing too deeply.  This is not sound!
410                             if !did.is_local() || self.ecx.tcx.is_foreign_item(did) {
411                                 return Ok(());
412                             }
413                         }
414                         // Maintain the invariant that the place we are checking is
415                         // already verified to be in-bounds.
416                         try_validation!(
417                             self.ecx.memory
418                                 .get(ptr.alloc_id)?
419                                 .check_bounds(self.ecx, ptr, size),
420                             "dangling (not entirely in bounds) reference", self.path);
421                     }
422                     // Check if we have encountered this pointer+layout combination
423                     // before.  Proceed recursively even for integer pointers, no
424                     // reason to skip them! They are (recursively) valid for some ZST,
425                     // but not for others (e.g., `!` is a ZST).
426                     if ref_tracking.seen.insert(place) {
427                         trace!("Recursing below ptr {:#?}", *place);
428                         // We need to clone the path anyway, make sure it gets created
429                         // with enough space for the additional `Deref`.
430                         let mut new_path = Vec::with_capacity(self.path.len()+1);
431                         new_path.clone_from(&self.path);
432                         new_path.push(PathElem::Deref);
433                         // Remember to come back to this later.
434                         ref_tracking.todo.push((place, new_path));
435                     }
436                 }
437             }
438             ty::FnPtr(_sig) => {
439                 let value = value.to_scalar_or_undef();
440                 let ptr = try_validation!(value.to_ptr(),
441                     value, self.path, "a pointer");
442                 let _fn = try_validation!(self.ecx.memory.get_fn(ptr),
443                     value, self.path, "a function pointer");
444                 // FIXME: Check if the signature matches
445             }
446             // This should be all the primitive types
447             _ => bug!("Unexpected primitive type {}", value.layout.ty)
448         }
449         Ok(())
450     }
451
452     fn visit_uninhabited(&mut self) -> EvalResult<'tcx>
453     {
454         validation_failure!("a value of an uninhabited type", self.path)
455     }
456
457     fn visit_scalar(
458         &mut self,
459         op: OpTy<'tcx, M::PointerTag>,
460         layout: &layout::Scalar,
461     ) -> EvalResult<'tcx> {
462         let value = self.ecx.read_scalar(op)?;
463         // Determine the allowed range
464         let (lo, hi) = layout.valid_range.clone().into_inner();
465         // `max_hi` is as big as the size fits
466         let max_hi = u128::max_value() >> (128 - op.layout.size.bits());
467         assert!(hi <= max_hi);
468         // We could also write `(hi + 1) % (max_hi + 1) == lo` but `max_hi + 1` overflows for `u128`
469         if (lo == 0 && hi == max_hi) || (hi + 1 == lo) {
470             // Nothing to check
471             return Ok(());
472         }
473         // At least one value is excluded. Get the bits.
474         let value = try_validation!(value.not_undef(),
475             value,
476             self.path,
477             format!(
478                 "something {}",
479                 wrapping_range_format(&layout.valid_range, max_hi),
480             )
481         );
482         let bits = match value {
483             Scalar::Ptr(ptr) => {
484                 if lo == 1 && hi == max_hi {
485                     // only NULL is not allowed.
486                     // We can call `check_align` to check non-NULL-ness, but have to also look
487                     // for function pointers.
488                     let non_null =
489                         self.ecx.memory.check_align(
490                             Scalar::Ptr(ptr), Align::from_bytes(1).unwrap()
491                         ).is_ok() ||
492                         self.ecx.memory.get_fn(ptr).is_ok();
493                     if !non_null {
494                         // could be NULL
495                         return validation_failure!("a potentially NULL pointer", self.path);
496                     }
497                     return Ok(());
498                 } else {
499                     // Conservatively, we reject, because the pointer *could* have this
500                     // value.
501                     return validation_failure!(
502                         "a pointer",
503                         self.path,
504                         format!(
505                             "something that cannot possibly fail to be {}",
506                             wrapping_range_format(&layout.valid_range, max_hi)
507                         )
508                     );
509                 }
510             }
511             Scalar::Bits { bits, size } => {
512                 assert_eq!(size as u64, op.layout.size.bytes());
513                 bits
514             }
515         };
516         // Now compare. This is slightly subtle because this is a special "wrap-around" range.
517         if wrapping_range_contains(&layout.valid_range, bits) {
518             Ok(())
519         } else {
520             validation_failure!(
521                 bits,
522                 self.path,
523                 format!("something {}", wrapping_range_format(&layout.valid_range, max_hi))
524             )
525         }
526     }
527
528     fn visit_aggregate(
529         &mut self,
530         op: OpTy<'tcx, M::PointerTag>,
531         fields: impl Iterator<Item=EvalResult<'tcx, Self::V>>,
532     ) -> EvalResult<'tcx> {
533         match op.layout.ty.sty {
534             ty::Str => {
535                 let mplace = op.to_mem_place(); // strings are never immediate
536                 try_validation!(self.ecx.read_str(mplace),
537                     "uninitialized or non-UTF-8 data in str", self.path);
538             }
539             ty::Array(tys, ..) | ty::Slice(tys) if {
540                 // This optimization applies only for integer and floating point types
541                 // (i.e., types that can hold arbitrary bytes).
542                 match tys.sty {
543                     ty::Int(..) | ty::Uint(..) | ty::Float(..) => true,
544                     _ => false,
545                 }
546             } => {
547                 // bailing out for zsts is ok, since the array element type can only be int/float
548                 if op.layout.is_zst() {
549                     return Ok(());
550                 }
551                 // non-ZST array cannot be immediate, slices are never immediate
552                 let mplace = op.to_mem_place();
553                 // This is the length of the array/slice.
554                 let len = mplace.len(self.ecx)?;
555                 // zero length slices have nothing to be checked
556                 if len == 0 {
557                     return Ok(());
558                 }
559                 // This is the element type size.
560                 let ty_size = self.ecx.layout_of(tys)?.size;
561                 // This is the size in bytes of the whole array.
562                 let size = ty_size * len;
563
564                 let ptr = mplace.ptr.to_ptr()?;
565
566                 // NOTE: Keep this in sync with the handling of integer and float
567                 // types above, in `visit_primitive`.
568                 // In run-time mode, we accept pointers in here.  This is actually more
569                 // permissive than a per-element check would be, e.g., we accept
570                 // an &[u8] that contains a pointer even though bytewise checking would
571                 // reject it.  However, that's good: We don't inherently want
572                 // to reject those pointers, we just do not have the machinery to
573                 // talk about parts of a pointer.
574                 // We also accept undef, for consistency with the type-based checks.
575                 match self.ecx.memory.get(ptr.alloc_id)?.check_bytes(
576                     self.ecx,
577                     ptr,
578                     size,
579                     /*allow_ptr_and_undef*/!self.const_mode,
580                 ) {
581                     // In the happy case, we needn't check anything else.
582                     Ok(()) => {},
583                     // Some error happened, try to provide a more detailed description.
584                     Err(err) => {
585                         // For some errors we might be able to provide extra information
586                         match err.kind {
587                             InterpError::ReadUndefBytes(offset) => {
588                                 // Some byte was undefined, determine which
589                                 // element that byte belongs to so we can
590                                 // provide an index.
591                                 let i = (offset.bytes() / ty_size.bytes()) as usize;
592                                 self.path.push(PathElem::ArrayElem(i));
593
594                                 return validation_failure!(
595                                     "undefined bytes", self.path
596                                 )
597                             },
598                             // Other errors shouldn't be possible
599                             _ => return Err(err),
600                         }
601                     }
602                 }
603             }
604             _ => {
605                 self.walk_aggregate(op, fields)? // default handler
606             }
607         }
608         Ok(())
609     }
610 }
611
612 impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> {
613     /// This function checks the data at `op`. `op` is assumed to cover valid memory if it
614     /// is an indirect operand.
615     /// It will error if the bits at the destination do not match the ones described by the layout.
616     ///
617     /// `ref_tracking` can be None to avoid recursive checking below references.
618     /// This also toggles between "run-time" (no recursion) and "compile-time" (with recursion)
619     /// validation (e.g., pointer values are fine in integers at runtime).
620     pub fn validate_operand(
621         &self,
622         op: OpTy<'tcx, M::PointerTag>,
623         path: Vec<PathElem>,
624         ref_tracking: Option<&mut RefTracking<MPlaceTy<'tcx, M::PointerTag>>>,
625         const_mode: bool,
626     ) -> EvalResult<'tcx> {
627         trace!("validate_operand: {:?}, {:?}", *op, op.layout.ty);
628
629         // Construct a visitor
630         let mut visitor = ValidityVisitor {
631             path,
632             ref_tracking,
633             const_mode,
634             ecx: self,
635         };
636
637         // Run it
638         visitor.visit_value(op)
639     }
640 }