@@ -579,8 +579,8 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
579
579
Node :: NodeItem ( & hir:: Item { node : hir:: ItemUse ( ref path, _) , .. } ) |
580
580
Node :: NodeVisibility ( & hir:: Visibility :: Restricted { ref path, .. } ) => path. def ,
581
581
582
- Node :: NodeExpr ( & hir:: Expr { node : hir:: ExprPath ( ref qpath) , .. } ) |
583
582
Node :: NodeExpr ( & hir:: Expr { node : hir:: ExprStruct ( ref qpath, ..) , .. } ) |
583
+ Node :: NodeExpr ( & hir:: Expr { node : hir:: ExprPath ( ref qpath) , .. } ) |
584
584
Node :: NodePat ( & hir:: Pat { node : hir:: PatKind :: Path ( ref qpath) , .. } ) |
585
585
Node :: NodePat ( & hir:: Pat { node : hir:: PatKind :: Struct ( ref qpath, ..) , .. } ) |
586
586
Node :: NodePat ( & hir:: Pat { node : hir:: PatKind :: TupleStruct ( ref qpath, ..) , .. } ) => {
@@ -643,7 +643,6 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
643
643
HirDef :: Static ( ..) |
644
644
HirDef :: Const ( ..) |
645
645
HirDef :: AssociatedConst ( ..) |
646
- HirDef :: StructCtor ( ..) |
647
646
HirDef :: VariantCtor ( ..) => {
648
647
let span = self . span_from_span ( sub_span. unwrap ( ) ) ;
649
648
Some ( Ref {
@@ -678,6 +677,18 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
678
677
ref_id : id_from_def_id ( def_id) ,
679
678
} )
680
679
}
680
+ HirDef :: StructCtor ( def_id, _) => {
681
+ // This is a reference to a tuple struct where the def_id points
682
+ // to an invisible constructor function. That is not a very useful
683
+ // def, so adjust to point to the tuple struct itself.
684
+ let span = self . span_from_span ( sub_span. unwrap ( ) ) ;
685
+ let parent_def_id = self . tcx . parent_def_id ( def_id) . unwrap ( ) ;
686
+ Some ( Ref {
687
+ kind : RefKind :: Type ,
688
+ span,
689
+ ref_id : id_from_def_id ( parent_def_id) ,
690
+ } )
691
+ }
681
692
HirDef :: Method ( decl_id) => {
682
693
let sub_span = self . span_utils . sub_span_for_meth_name ( path. span ) ;
683
694
filter ! ( self . span_utils, sub_span, path. span, None ) ;
0 commit comments