@@ -13,7 +13,7 @@ use rustc_ast::ast::{self};
13
13
use rustc_ast:: util:: comments:: strip_doc_comment_decoration;
14
14
use rustc_ast_pretty:: pprust:: attribute_to_string;
15
15
use rustc_hir as hir;
16
- use rustc_hir:: def:: { CtorOf , DefKind as HirDefKind , Res } ;
16
+ use rustc_hir:: def:: { DefKind as HirDefKind , Res } ;
17
17
use rustc_hir:: def_id:: { DefId , LOCAL_CRATE } ;
18
18
use rustc_hir:: intravisit:: { self , Visitor } ;
19
19
use rustc_hir:: Node ;
@@ -708,20 +708,16 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
708
708
Res :: Def ( HirDefKind :: ConstParam , def_id) => {
709
709
Some ( Ref { kind : RefKind :: Variable , span, ref_id : id_from_def_id ( def_id) } )
710
710
}
711
- Res :: Def ( HirDefKind :: Ctor ( CtorOf :: Struct , ..) , def_id) => {
712
- // This is a reference to a tuple struct where the def_id points
711
+ Res :: Def ( HirDefKind :: Ctor ( _ , ..) , def_id) => {
712
+ // This is a reference to a tuple struct or an enum variant where the def_id points
713
713
// to an invisible constructor function. That is not a very useful
714
- // def, so adjust to point to the tuple struct itself.
714
+ // def, so adjust to point to the tuple struct or enum variant itself.
715
715
let parent_def_id = self . tcx . parent ( def_id) . unwrap ( ) ;
716
716
Some ( Ref { kind : RefKind :: Type , span, ref_id : id_from_def_id ( parent_def_id) } )
717
717
}
718
- Res :: Def (
719
- HirDefKind :: Static
720
- | HirDefKind :: Const
721
- | HirDefKind :: AssocConst
722
- | HirDefKind :: Ctor ( ..) ,
723
- _,
724
- ) => Some ( Ref { kind : RefKind :: Variable , span, ref_id : id_from_def_id ( res. def_id ( ) ) } ) ,
718
+ Res :: Def ( HirDefKind :: Static | HirDefKind :: Const | HirDefKind :: AssocConst , _) => {
719
+ Some ( Ref { kind : RefKind :: Variable , span, ref_id : id_from_def_id ( res. def_id ( ) ) } )
720
+ }
725
721
Res :: Def ( HirDefKind :: AssocFn , decl_id) => {
726
722
let def_id = if decl_id. is_local ( ) {
727
723
let ti = self . tcx . associated_item ( decl_id) ;
0 commit comments