@@ -84,9 +84,9 @@ use crate::db::{DefDatabase, HirDatabase};
84
84
pub use crate :: {
85
85
attrs:: { HasAttrs , Namespace } ,
86
86
diagnostics:: {
87
- AnyDiagnostic , BreakOutsideOfLoop , InactiveCode , IncorrectCase , InvalidDeriveTarget ,
88
- MacroError , MalformedDerive , MismatchedArgCount , MissingFields , MissingMatchArms ,
89
- MissingUnsafe , NoSuchField , PrivateAssocItem , PrivateField ,
87
+ AnyDiagnostic , BreakOutsideOfLoop , ExpectedFunction , InactiveCode , IncorrectCase ,
88
+ InvalidDeriveTarget , MacroError , MalformedDerive , MismatchedArgCount , MissingFields ,
89
+ MissingMatchArms , MissingUnsafe , NoSuchField , PrivateAssocItem , PrivateField ,
90
90
ReplaceFilterMapNextWithFindMap , TypeMismatch , UnimplementedBuiltinMacro ,
91
91
UnresolvedExternCrate , UnresolvedImport , UnresolvedMacroCall , UnresolvedModule ,
92
92
UnresolvedProcMacro ,
@@ -1377,8 +1377,8 @@ impl DefWithBody {
1377
1377
let source_map = Lazy :: new ( || db. body_with_source_map ( self . into ( ) ) . 1 ) ;
1378
1378
for d in & infer. diagnostics {
1379
1379
match d {
1380
- hir_ty:: InferenceDiagnostic :: NoSuchField { expr } => {
1381
- let field = source_map. field_syntax ( * expr) ;
1380
+ & hir_ty:: InferenceDiagnostic :: NoSuchField { expr } => {
1381
+ let field = source_map. field_syntax ( expr) ;
1382
1382
acc. push ( NoSuchField { field } . into ( ) )
1383
1383
}
1384
1384
& hir_ty:: InferenceDiagnostic :: BreakOutsideOfLoop {
@@ -1391,15 +1391,10 @@ impl DefWithBody {
1391
1391
. expect ( "break outside of loop in synthetic syntax" ) ;
1392
1392
acc. push ( BreakOutsideOfLoop { expr, is_break, bad_value_break } . into ( ) )
1393
1393
}
1394
- hir_ty:: InferenceDiagnostic :: MismatchedArgCount { call_expr, expected, found } => {
1395
- match source_map. expr_syntax ( * call_expr) {
1394
+ & hir_ty:: InferenceDiagnostic :: MismatchedArgCount { call_expr, expected, found } => {
1395
+ match source_map. expr_syntax ( call_expr) {
1396
1396
Ok ( source_ptr) => acc. push (
1397
- MismatchedArgCount {
1398
- call_expr : source_ptr,
1399
- expected : * expected,
1400
- found : * found,
1401
- }
1402
- . into ( ) ,
1397
+ MismatchedArgCount { call_expr : source_ptr, expected, found } . into ( ) ,
1403
1398
) ,
1404
1399
Err ( SyntheticSyntax ) => ( ) ,
1405
1400
}
@@ -1423,6 +1418,18 @@ impl DefWithBody {
1423
1418
let item = item. into ( ) ;
1424
1419
acc. push ( PrivateAssocItem { expr_or_pat, item } . into ( ) )
1425
1420
}
1421
+ hir_ty:: InferenceDiagnostic :: ExpectedFunction { call_expr, found } => {
1422
+ let call_expr =
1423
+ source_map. expr_syntax ( * call_expr) . expect ( "unexpected synthetic" ) ;
1424
+
1425
+ acc. push (
1426
+ ExpectedFunction {
1427
+ call : call_expr,
1428
+ found : Type :: new ( db, DefWithBodyId :: from ( self ) , found. clone ( ) ) ,
1429
+ }
1430
+ . into ( ) ,
1431
+ )
1432
+ }
1426
1433
}
1427
1434
}
1428
1435
for ( pat_or_expr, mismatch) in infer. type_mismatches ( ) {
0 commit comments