]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_middle/src/mir/type_visitable.rs
merge rustc history
[rust.git] / compiler / rustc_middle / src / mir / type_visitable.rs
1 //! `TypeVisitable` implementations for MIR types
2
3 use super::*;
4
5 impl<'tcx, R: Idx, C: Idx> TypeVisitable<'tcx> for BitMatrix<R, C> {
6     fn visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> ControlFlow<V::BreakTy> {
7         ControlFlow::CONTINUE
8     }
9 }
10
11 impl<'tcx> TypeVisitable<'tcx> for ConstantKind<'tcx> {
12     fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
13         visitor.visit_mir_const(*self)
14     }
15 }
16
17 impl<'tcx> TypeSuperVisitable<'tcx> for ConstantKind<'tcx> {
18     fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
19         match *self {
20             ConstantKind::Ty(c) => c.visit_with(visitor),
21             ConstantKind::Val(_, t) => t.visit_with(visitor),
22             ConstantKind::Unevaluated(uv, t) => {
23                 uv.visit_with(visitor)?;
24                 t.visit_with(visitor)
25             }
26         }
27     }
28 }