Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/diagnostics.rs')
-rw-r--r--crates/hir/src/diagnostics.rs18
1 files changed, 15 insertions, 3 deletions
diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs
index d0801d8efd..0c4191ce2d 100644
--- a/crates/hir/src/diagnostics.rs
+++ b/crates/hir/src/diagnostics.rs
@@ -441,6 +441,9 @@ pub struct MismatchedArgCount {
pub call_expr: InFile<ExprOrPatPtr>,
pub expected: usize,
pub found: usize,
+ /// True when the call is through a `Fn`/`FnMut`/`FnOnce` trait (E0057)
+ /// rather than a regular function call (E0061).
+ pub is_fn_trait_call: bool,
}
#[derive(Debug)]
@@ -885,9 +888,18 @@ impl<'db> AnyDiagnostic<'db> {
};
DuplicateField { field: expr_or_pat, variant: variant.into() }.into()
}
- &InferenceDiagnostic::MismatchedArgCount { call_expr, expected, found } => {
- MismatchedArgCount { call_expr: expr_syntax(call_expr)?, expected, found }.into()
- }
+ &InferenceDiagnostic::MismatchedArgCount {
+ call_expr,
+ expected,
+ found,
+ is_fn_trait_call,
+ } => MismatchedArgCount {
+ call_expr: expr_syntax(call_expr)?,
+ expected,
+ found,
+ is_fn_trait_call,
+ }
+ .into(),
&InferenceDiagnostic::PrivateField { expr, field } => {
let expr = expr_syntax(expr)?;
let field = field.into();