aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorhi-rustin <[email protected]>2021-03-22 07:17:01 +0000
committerhi-rustin <[email protected]>2021-03-22 11:40:07 +0000
commit2e09714dfe06f6cd252d0708a04741a5c36168e4 (patch)
tree18ac6ec96e593677be3766cfee78bb38cebd8443 /crates
parent0d40ff5e623b3670ce3e0e324ecbab3e5197aaeb (diff)
bail out early for source code closures
add closure error
Diffstat (limited to 'crates')
-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() {