aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir/src/lib.rs')
-rw-r--r--crates/hir/src/lib.rs27
1 files changed, 13 insertions, 14 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index d891d0ec1..c1af5f097 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -606,8 +606,12 @@ impl Module {
606 let node = ast.to_node(db.upcast()); 606 let node = ast.to_node(db.upcast());
607 // Must have a name, otherwise we wouldn't emit it. 607 // Must have a name, otherwise we wouldn't emit it.
608 let name = node.name().expect("unimplemented builtin macro with no name"); 608 let name = node.name().expect("unimplemented builtin macro with no name");
609 let ptr = SyntaxNodePtr::from(AstPtr::new(&name)); 609 acc.push(
610 sink.push(UnimplementedBuiltinMacro { file: ast.file_id, node: ptr }); 610 UnimplementedBuiltinMacro {
611 node: ast.with_value(SyntaxNodePtr::from(AstPtr::new(&name))),
612 }
613 .into(),
614 );
611 } 615 }
612 } 616 }
613 } 617 }
@@ -1073,22 +1077,20 @@ impl Function {
1073 match d { 1077 match d {
1074 hir_ty::InferenceDiagnostic::NoSuchField { expr } => { 1078 hir_ty::InferenceDiagnostic::NoSuchField { expr } => {
1075 let field = source_map.field_syntax(*expr); 1079 let field = source_map.field_syntax(*expr);
1076 sink.push(NoSuchField { file: field.file_id, field: field.value }) 1080 acc.push(NoSuchField { field }.into())
1077 } 1081 }
1078 hir_ty::InferenceDiagnostic::BreakOutsideOfLoop { expr } => { 1082 hir_ty::InferenceDiagnostic::BreakOutsideOfLoop { expr } => {
1079 let ptr = source_map 1083 let expr = source_map
1080 .expr_syntax(*expr) 1084 .expr_syntax(*expr)
1081 .expect("break outside of loop in synthetic syntax"); 1085 .expect("break outside of loop in synthetic syntax");
1082 sink.push(BreakOutsideOfLoop { file: ptr.file_id, expr: ptr.value }) 1086 acc.push(BreakOutsideOfLoop { expr }.into())
1083 } 1087 }
1084 } 1088 }
1085 } 1089 }
1086 1090
1087 for expr in hir_ty::diagnostics::missing_unsafe(db, self.id.into()) { 1091 for expr in hir_ty::diagnostics::missing_unsafe(db, self.id.into()) {
1088 match source_map.expr_syntax(expr) { 1092 match source_map.expr_syntax(expr) {
1089 Ok(in_file) => { 1093 Ok(expr) => acc.push(MissingUnsafe { expr }.into()),
1090 sink.push(MissingUnsafe { file: in_file.file_id, expr: in_file.value })
1091 }
1092 Err(SyntheticSyntax) => { 1094 Err(SyntheticSyntax) => {
1093 // FIXME: Here and eslwhere in this file, the `expr` was 1095 // FIXME: Here and eslwhere in this file, the `expr` was
1094 // desugared, report or assert that this doesn't happen. 1096 // desugared, report or assert that this doesn't happen.
@@ -1174,12 +1176,9 @@ impl Function {
1174 } 1176 }
1175 BodyValidationDiagnostic::MismatchedArgCount { call_expr, expected, found } => { 1177 BodyValidationDiagnostic::MismatchedArgCount { call_expr, expected, found } => {
1176 match source_map.expr_syntax(call_expr) { 1178 match source_map.expr_syntax(call_expr) {
1177 Ok(source_ptr) => sink.push(MismatchedArgCount { 1179 Ok(source_ptr) => acc.push(
1178 file: source_ptr.file_id, 1180 MismatchedArgCount { call_expr: source_ptr, expected, found }.into(),
1179 call_expr: source_ptr.value, 1181 ),
1180 expected,
1181 found,
1182 }),
1183 Err(SyntheticSyntax) => (), 1182 Err(SyntheticSyntax) => (),
1184 } 1183 }
1185 } 1184 }