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.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
index 3845009ae..981ba564d 100644
--- a/crates/hir_ty/src/display.rs
+++ b/crates/hir_ty/src/display.rs
@@ -190,6 +190,7 @@ impl DisplayTarget {
190pub enum DisplaySourceCodeError { 190pub enum DisplaySourceCodeError {
191 PathNotFound, 191 PathNotFound,
192 UnknownType, 192 UnknownType,
193 Closure,
193} 194}
194 195
195pub enum HirDisplayError { 196pub enum HirDisplayError {
@@ -539,6 +540,11 @@ impl HirDisplay for Ty {
539 } 540 }
540 } 541 }
541 TyKind::Closure(.., substs) => { 542 TyKind::Closure(.., substs) => {
543 if f.display_target.is_source_code() {
544 return Err(HirDisplayError::DisplaySourceCodeError(
545 DisplaySourceCodeError::Closure,
546 ));
547 }
542 let sig = substs[0].callable_sig(f.db); 548 let sig = substs[0].callable_sig(f.db);
543 if let Some(sig) = sig { 549 if let Some(sig) = sig {
544 if sig.params().is_empty() { 550 if sig.params().is_empty() {