@@ -11,8 +11,13 @@ use std::fmt::Write;
1111use std:: sync:: Arc ;
1212
1313use hir_def:: {
14- body:: BodySourceMap , child_by_source:: ChildBySource , db:: DefDatabase , item_scope:: ItemScope ,
15- keys, nameres:: CrateDefMap , AssocItemId , DefWithBodyId , LocalModuleId , Lookup , ModuleDefId ,
14+ body:: { BodySourceMap , SyntheticSyntax } ,
15+ child_by_source:: ChildBySource ,
16+ db:: DefDatabase ,
17+ item_scope:: ItemScope ,
18+ keys,
19+ nameres:: CrateDefMap ,
20+ AssocItemId , DefWithBodyId , LocalModuleId , Lookup , ModuleDefId ,
1621} ;
1722use hir_expand:: InFile ;
1823use insta:: assert_snapshot;
@@ -67,20 +72,20 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
6772
6873 for ( pat, ty) in inference_result. type_of_pat . iter ( ) {
6974 let syntax_ptr = match body_source_map. pat_syntax ( pat) {
70- Some ( sp) => {
75+ Ok ( sp) => {
7176 sp. map ( |ast| ast. either ( |it| it. syntax_node_ptr ( ) , |it| it. syntax_node_ptr ( ) ) )
7277 }
73- None => continue ,
78+ Err ( SyntheticSyntax ) => continue ,
7479 } ;
7580 types. push ( ( syntax_ptr, ty) ) ;
7681 }
7782
7883 for ( expr, ty) in inference_result. type_of_expr . iter ( ) {
7984 let syntax_ptr = match body_source_map. expr_syntax ( expr) {
80- Some ( sp) => {
85+ Ok ( sp) => {
8186 sp. map ( |ast| ast. either ( |it| it. syntax_node_ptr ( ) , |it| it. syntax_node_ptr ( ) ) )
8287 }
83- None => continue ,
88+ Err ( SyntheticSyntax ) => continue ,
8489 } ;
8590 types. push ( ( syntax_ptr, ty) ) ;
8691 if let Some ( mismatch) = inference_result. type_mismatch_for_expr ( expr) {
0 commit comments