about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2022-11-17 09:24:46 -0800
committerEsteban Küber <esteban@kuber.com.ar>2022-11-18 08:46:48 -0800
commitbcb2655a9a3af867c3e48a332870acc36d92df88 (patch)
tree44c6b3104f1451ef3444ec94df11e5a2a36ee192 /compiler/rustc_middle
parent3debf5006aa9d6810e4691fa03c6660ab998bae7 (diff)
downloadrust-bcb2655a9a3af867c3e48a332870acc36d92df88.tar.gz
rust-bcb2655a9a3af867c3e48a332870acc36d92df88.zip
review comment
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/ty/error.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_middle/src/ty/error.rs b/compiler/rustc_middle/src/ty/error.rs
index 36261e7a1f3..d6044ceb0ca 100644
--- a/compiler/rustc_middle/src/ty/error.rs
+++ b/compiler/rustc_middle/src/ty/error.rs
@@ -990,7 +990,7 @@ fn foo(&self) -> Self::T { String::new() }
         false
     }
 
-    pub fn short_ty_string(self, ty: Ty<'tcx>) -> Result<String, (String, PathBuf)> {
+    pub fn short_ty_string(self, ty: Ty<'tcx>) -> (String, Option<PathBuf>) {
         let length_limit = 50;
         let type_limit = 4;
         let regular = FmtPrinter::new(self, hir::def::Namespace::TypeNS)
@@ -998,7 +998,7 @@ fn foo(&self) -> Self::T { String::new() }
             .expect("could not write to `String`")
             .into_buffer();
         if regular.len() <= length_limit {
-            return Ok(regular);
+            return (regular, None);
         }
         let short = FmtPrinter::new_with_limit(
             self,
@@ -1009,7 +1009,7 @@ fn foo(&self) -> Self::T { String::new() }
         .expect("could not write to `String`")
         .into_buffer();
         if regular == short {
-            return Ok(regular);
+            return (regular, None);
         }
         // Multiple types might be shortened in a single error, ensure we create a file for each.
         let mut s = DefaultHasher::new();
@@ -1017,8 +1017,8 @@ fn foo(&self) -> Self::T { String::new() }
         let hash = s.finish();
         let path = self.output_filenames(()).temp_path_ext(&format!("long-type-{hash}.txt"), None);
         match std::fs::write(&path, &regular) {
-            Ok(_) => Err((short, path)),
-            Err(_) => Ok(regular),
+            Ok(_) => (short, Some(path)),
+            Err(_) => (regular, None),
         }
     }