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 <rustin.liu@gmail.com>
This commit is contained in:
commit
3af1885bd2
@ -190,6 +190,7 @@ fn is_test(&self) -> bool {
|
||||
pub enum DisplaySourceCodeError {
|
||||
PathNotFound,
|
||||
UnknownType,
|
||||
Closure,
|
||||
}
|
||||
|
||||
pub enum HirDisplayError {
|
||||
@ -543,6 +544,11 @@ fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
}
|
||||
}
|
||||
TyKind::Closure(.., substs) => {
|
||||
if f.display_target.is_source_code() {
|
||||
return Err(HirDisplayError::DisplaySourceCodeError(
|
||||
DisplaySourceCodeError::Closure,
|
||||
));
|
||||
}
|
||||
let sig = substs[0].callable_sig(f.db);
|
||||
if let Some(sig) = sig {
|
||||
if sig.params().is_empty() {
|
||||
|
Loading…
Reference in New Issue
Block a user