about summary refs log tree commit diff
path: root/src/librustc_codegen_utils
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2019-01-20 19:46:47 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2019-03-15 13:25:10 +0200
commit381fa7aa18d0440d122c476bdbd074281a93b6a9 (patch)
tree8ecc8f40eb2beb407bbe7dc5d2a9d275c797812f /src/librustc_codegen_utils
parent1a0f3a285697b6238793ce3c1353f0d2f0c28938 (diff)
downloadrust-381fa7aa18d0440d122c476bdbd074281a93b6a9.tar.gz
rust-381fa7aa18d0440d122c476bdbd074281a93b6a9.zip
rustc: move ty::print::PrintConfig's fields to FmtPrinter.
Diffstat (limited to 'src/librustc_codegen_utils')
-rw-r--r--src/librustc_codegen_utils/symbol_names.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs
index a17a554480e..b7e69f64f5a 100644
--- a/src/librustc_codegen_utils/symbol_names.rs
+++ b/src/librustc_codegen_utils/symbol_names.rs
@@ -224,11 +224,10 @@ fn get_symbol_hash<'a, 'tcx>(
 }
 
 fn def_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::SymbolName {
-    PrintCx::with(tcx, SymbolPath::new(tcx), |cx| {
-        cx.print_def_path(def_id, None, iter::empty())
-            .unwrap()
-            .into_interned()
-    })
+    PrintCx::new(tcx, SymbolPath::new(tcx))
+        .print_def_path(def_id, None, iter::empty())
+        .unwrap()
+        .into_interned()
 }
 
 fn symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance<'tcx>) -> ty::SymbolName {
@@ -415,7 +414,7 @@ impl Printer for SymbolPath {
         self: PrintCx<'_, '_, '_, Self>,
         _region: ty::Region<'_>,
     ) -> Result<Self::Region, Self::Error> {
-        Ok(self.printer)
+        self.ok()
     }
 
     fn print_type(
@@ -440,8 +439,8 @@ impl Printer for SymbolPath {
         mut self: PrintCx<'_, '_, '_, Self>,
         cnum: CrateNum,
     ) -> Result<Self::Path, Self::Error> {
-        self.printer.write_str(&self.tcx.original_crate_name(cnum).as_str())?;
-        Ok(self.printer)
+        self.write_str(&self.tcx.original_crate_name(cnum).as_str())?;
+        self.ok()
     }
     fn path_qualified(
         self: PrintCx<'_, '_, 'tcx, Self>,
@@ -524,10 +523,10 @@ impl PrettyPrinter for SymbolPath {
         mut self: PrintCx<'_, 'gcx, 'tcx, Self>,
         f: impl FnOnce(PrintCx<'_, 'gcx, 'tcx, Self>) -> Result<Self, Self::Error>,
     ) -> Result<Self, Self::Error> {
-        write!(self.printer, "<")?;
+        write!(self, "<")?;
 
         let kept_within_component =
-            mem::replace(&mut self.printer.keep_within_component, true);
+            mem::replace(&mut self.keep_within_component, true);
         let mut path = f(self)?;
         path.keep_within_component = kept_within_component;