aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r--crates/hir_ty/src/display.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
index 0d968cc68..0e827a29e 100644
--- a/crates/hir_ty/src/display.rs
+++ b/crates/hir_ty/src/display.rs
@@ -178,6 +178,7 @@ impl DisplayTarget {
178#[derive(Debug)] 178#[derive(Debug)]
179pub enum DisplaySourceCodeError { 179pub enum DisplaySourceCodeError {
180 PathNotFound, 180 PathNotFound,
181 UnknownType,
181} 182}
182 183
183pub enum HirDisplayError { 184pub enum HirDisplayError {
@@ -558,7 +559,14 @@ impl HirDisplay for Ty {
558 } 559 }
559 }; 560 };
560 } 561 }
561 Ty::Unknown => write!(f, "{{unknown}}")?, 562 Ty::Unknown => {
563 if f.display_target.is_source_code() {
564 return Err(HirDisplayError::DisplaySourceCodeError(
565 DisplaySourceCodeError::UnknownType,
566 ));
567 }
568 write!(f, "{{unknown}}")?;
569 }
562 Ty::Infer(..) => write!(f, "_")?, 570 Ty::Infer(..) => write!(f, "_")?,
563 } 571 }
564 Ok(()) 572 Ok(())