Skip to content

Commit 3af1885

Browse files
bors[bot]0xPoe
andauthored
Merge #8144
8144: bail out early for source code closures r=Veykril a=hi-rustin close #8084 Co-authored-by: hi-rustin <[email protected]>
2 parents e220d3d + 2e09714 commit 3af1885

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

crates/hir_ty/src/display.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ impl DisplayTarget {
190190
pub enum DisplaySourceCodeError {
191191
PathNotFound,
192192
UnknownType,
193+
Closure,
193194
}
194195

195196
pub enum HirDisplayError {
@@ -543,6 +544,11 @@ impl HirDisplay for Ty {
543544
}
544545
}
545546
TyKind::Closure(.., substs) => {
547+
if f.display_target.is_source_code() {
548+
return Err(HirDisplayError::DisplaySourceCodeError(
549+
DisplaySourceCodeError::Closure,
550+
));
551+
}
546552
let sig = substs[0].callable_sig(f.db);
547553
if let Some(sig) = sig {
548554
if sig.params().is_empty() {

0 commit comments

Comments
 (0)