diff options
author | hi-rustin <[email protected]> | 2021-03-22 07:17:01 +0000 |
---|---|---|
committer | hi-rustin <[email protected]> | 2021-03-22 11:40:07 +0000 |
commit | 2e09714dfe06f6cd252d0708a04741a5c36168e4 (patch) | |
tree | 18ac6ec96e593677be3766cfee78bb38cebd8443 /crates/hir_ty/src/display.rs | |
parent | 0d40ff5e623b3670ce3e0e324ecbab3e5197aaeb (diff) |
bail out early for source code closures
add closure error
Diffstat (limited to 'crates/hir_ty/src/display.rs')
-rw-r--r-- | crates/hir_ty/src/display.rs | 6 |
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 { | |||
190 | pub enum DisplaySourceCodeError { | 190 | pub enum DisplaySourceCodeError { |
191 | PathNotFound, | 191 | PathNotFound, |
192 | UnknownType, | 192 | UnknownType, |
193 | Closure, | ||
193 | } | 194 | } |
194 | 195 | ||
195 | pub enum HirDisplayError { | 196 | pub 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() { |