@@ -9,6 +9,7 @@ use hir_ty::{db::HirDatabase, diagnostics::BodyValidationDiagnostic, InferenceDi
9
9
use base_db:: CrateId ;
10
10
use cfg:: { CfgExpr , CfgOptions } ;
11
11
use either:: Either ;
12
+ pub use hir_def:: VariantId ;
12
13
use hir_def:: { body:: SyntheticSyntax , hir:: ExprOrPatId , path:: ModPath , AssocItemId , DefWithBodyId } ;
13
14
use hir_expand:: { name:: Name , HirFileId , InFile } ;
14
15
use syntax:: { ast, AstPtr , SyntaxError , SyntaxNodePtr , TextRange } ;
@@ -200,6 +201,7 @@ pub struct MalformedDerive {
200
201
pub struct NoSuchField {
201
202
pub field : InFile < AstPtr < Either < ast:: RecordExprField , ast:: RecordPatField > > > ,
202
203
pub private : bool ,
204
+ pub variant : VariantId ,
203
205
}
204
206
205
207
#[ derive( Debug ) ]
@@ -525,7 +527,7 @@ impl AnyDiagnostic {
525
527
source_map. pat_syntax ( pat) . inspect_err ( |_| tracing:: error!( "synthetic syntax" ) ) . ok ( )
526
528
} ;
527
529
Some ( match d {
528
- & InferenceDiagnostic :: NoSuchField { field : expr, private } => {
530
+ & InferenceDiagnostic :: NoSuchField { field : expr, private, variant } => {
529
531
let expr_or_pat = match expr {
530
532
ExprOrPatId :: ExprId ( expr) => {
531
533
source_map. field_syntax ( expr) . map ( AstPtr :: wrap_left)
@@ -534,7 +536,7 @@ impl AnyDiagnostic {
534
536
source_map. pat_field_syntax ( pat) . map ( AstPtr :: wrap_right)
535
537
}
536
538
} ;
537
- NoSuchField { field : expr_or_pat, private } . into ( )
539
+ NoSuchField { field : expr_or_pat, private, variant } . into ( )
538
540
}
539
541
& InferenceDiagnostic :: MismatchedArgCount { call_expr, expected, found } => {
540
542
MismatchedArgCount { call_expr : expr_syntax ( call_expr) ?, expected, found } . into ( )
0 commit comments