diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-22 12:35:44 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-22 12:35:44 +0000 |
commit | 3af1885bd2c4d3470d203a216488946ee8572970 (patch) | |
tree | 740ab2281d5ab9c779bd834a01aee3d68cdec7b3 /crates/hir_ty/src/display.rs | |
parent | e220d3d5079eaabf485d8966e1eb3bb90d181c23 (diff) | |
parent | 2e09714dfe06f6cd252d0708a04741a5c36168e4 (diff) |
Merge #8144
8144: bail out early for source code closures r=Veykril a=hi-rustin
close https://github.com/rust-analyzer/rust-analyzer/issues/8084
Co-authored-by: hi-rustin <[email protected]>
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 cc6b93d37..6149067c7 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 { |
@@ -543,6 +544,11 @@ impl HirDisplay for Ty { | |||
543 | } | 544 | } |
544 | } | 545 | } |
545 | TyKind::Closure(.., substs) => { | 546 | TyKind::Closure(.., substs) => { |
547 | if f.display_target.is_source_code() { | ||
548 | return Err(HirDisplayError::DisplaySourceCodeError( | ||
549 | DisplaySourceCodeError::Closure, | ||
550 | )); | ||
551 | } | ||
546 | let sig = substs[0].callable_sig(f.db); | 552 | let sig = substs[0].callable_sig(f.db); |
547 | if let Some(sig) = sig { | 553 | if let Some(sig) = sig { |
548 | if sig.params().is_empty() { | 554 | if sig.params().is_empty() { |