]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/ty/print/mod.rs
Rollup merge of #61698 - davidtwco:ice-const-generic-length, r=varkor
[rust.git] / src / librustc / ty / print / mod.rs
index d5d4f648444630152aff6318204d807301e79268..a7cb7bd3956f00457b30c76b636bc204fe40d574 100644 (file)
@@ -9,6 +9,8 @@
 mod pretty;
 pub use self::pretty::*;
 
+pub mod obsolete;
+
 pub trait Print<'gcx, 'tcx, P> {
     type Output;
     type Error;
@@ -31,6 +33,7 @@ pub trait Printer<'gcx: 'tcx, 'tcx>: Sized {
     type Region;
     type Type;
     type DynExistential;
+    type Const;
 
     fn tcx(&'a self) -> TyCtxt<'a, 'gcx, 'tcx>;
 
@@ -66,6 +69,11 @@ fn print_dyn_existential(
         predicates: &'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
     ) -> Result<Self::DynExistential, Self::Error>;
 
+    fn print_const(
+        self,
+        ct: &'tcx ty::Const<'tcx>,
+    ) -> Result<Self::Const, Self::Error>;
+
     fn path_crate(
         self,
         cnum: CrateNum,
@@ -325,3 +333,11 @@ fn print(&self, cx: P) -> Result<Self::Output, Self::Error> {
         cx.print_dyn_existential(self)
     }
 }
+
+impl<'gcx: 'tcx, 'tcx, P: Printer<'gcx, 'tcx>> Print<'gcx, 'tcx, P> for &'tcx ty::Const<'tcx> {
+    type Output = P::Const;
+    type Error = P::Error;
+    fn print(&self, cx: P) -> Result<Self::Output, Self::Error> {
+        cx.print_const(self)
+    }
+}