mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
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
1 changed files with 6 additions and 0 deletions
|
@ -190,6 +190,7 @@ impl DisplayTarget {
|
|||
pub enum DisplaySourceCodeError {
|
||||
PathNotFound,
|
||||
UnknownType,
|
||||
Closure,
|
||||
}
|
||||
|
||||
pub enum HirDisplayError {
|
||||
|
@ -543,6 +544,11 @@ impl HirDisplay for Ty {
|
|||
}
|
||||
}
|
||||
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 a new issue