@@ -41,7 +41,7 @@ use either::Either;
4141use hir_def:: {
4242 adt:: VariantData ,
4343 body:: { BodyDiagnostic , SyntheticSyntax } ,
44- expr:: { BindingAnnotation , LabelId , Pat , PatId } ,
44+ expr:: { BindingAnnotation , ExprOrPatId , LabelId , Pat , PatId } ,
4545 generics:: { TypeOrConstParamData , TypeParamProvenance } ,
4646 item_tree:: ItemTreeNode ,
4747 lang_item:: LangItemTarget ,
@@ -85,9 +85,10 @@ pub use crate::{
8585 diagnostics:: {
8686 AnyDiagnostic , BreakOutsideOfLoop , InactiveCode , IncorrectCase , InvalidDeriveTarget ,
8787 MacroError , MalformedDerive , MismatchedArgCount , MissingFields , MissingMatchArms ,
88- MissingUnsafe , NoSuchField , PrivateField , ReplaceFilterMapNextWithFindMap , TypeMismatch ,
89- UnimplementedBuiltinMacro , UnresolvedExternCrate , UnresolvedImport , UnresolvedMacroCall ,
90- UnresolvedModule , UnresolvedProcMacro ,
88+ MissingUnsafe , NoSuchField , PrivateAssocItem , PrivateField ,
89+ ReplaceFilterMapNextWithFindMap , TypeMismatch , UnimplementedBuiltinMacro ,
90+ UnresolvedExternCrate , UnresolvedImport , UnresolvedMacroCall , UnresolvedModule ,
91+ UnresolvedProcMacro ,
9192 } ,
9293 has_source:: HasSource ,
9394 semantics:: { PathResolution , Semantics , SemanticsScope , TypeInfo , VisibleTraits } ,
@@ -1358,6 +1359,20 @@ impl DefWithBody {
13581359 let field = field. into ( ) ;
13591360 acc. push ( PrivateField { expr, field } . into ( ) )
13601361 }
1362+ & hir_ty:: InferenceDiagnostic :: PrivateAssocItem { id, item } => {
1363+ let expr_or_pat = match id {
1364+ ExprOrPatId :: ExprId ( expr) => source_map
1365+ . expr_syntax ( expr)
1366+ . expect ( "unexpected synthetic" )
1367+ . map ( Either :: Left ) ,
1368+ ExprOrPatId :: PatId ( pat) => source_map
1369+ . pat_syntax ( pat)
1370+ . expect ( "unexpected synthetic" )
1371+ . map ( Either :: Right ) ,
1372+ } ;
1373+ let item = item. into ( ) ;
1374+ acc. push ( PrivateAssocItem { expr_or_pat, item } . into ( ) )
1375+ }
13611376 }
13621377 }
13631378 for ( expr, mismatch) in infer. expr_type_mismatches ( ) {
0 commit comments