]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs
Always format to internal String in FmtPrinter
[rust.git] / compiler / rustc_infer / src / infer / error_reporting / nice_region_error / placeholder_error.rs
index 7d82c60e6d3e073fd4f6bf952d8e32dce3b81021..bf9c2246dd8c5e3cad2b067a7d774ac0493bf550 100644 (file)
@@ -335,18 +335,19 @@ fn map<U>(self, f: impl FnOnce(T) -> U) -> Highlighted<'tcx, U> {
 
         impl<'tcx, T> fmt::Display for Highlighted<'tcx, T>
         where
-            T: for<'a, 'b, 'c> Print<
+            T: for<'a> Print<
                 'tcx,
-                FmtPrinter<'a, 'tcx, &'b mut fmt::Formatter<'c>>,
+                FmtPrinter<'a, 'tcx>,
                 Error = fmt::Error,
+                Output = FmtPrinter<'a, 'tcx>,
             >,
         {
             fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-                let mut printer = ty::print::FmtPrinter::new(self.tcx, f, Namespace::TypeNS);
+                let mut printer = ty::print::FmtPrinter::new(self.tcx, Namespace::TypeNS);
                 printer.region_highlight_mode = self.highlight;
 
-                self.value.print(printer)?;
-                Ok(())
+                let s = self.value.print(printer)?.into_buffer();
+                f.write_str(&s)
             }
         }