@@ -17,11 +17,11 @@ use rustc_hir::def::{CtorKind, DefKind, Res};
17
17
use rustc_hir:: def_id:: { CrateNum , DefId , CRATE_DEF_INDEX , LOCAL_CRATE } ;
18
18
use rustc_index:: vec:: { Idx , IndexVec } ;
19
19
use rustc_infer:: infer:: region_constraints:: { Constraint , RegionConstraintData } ;
20
- use rustc_middle:: bug;
21
20
use rustc_middle:: middle:: resolve_lifetime as rl;
22
21
use rustc_middle:: ty:: fold:: TypeFolder ;
23
22
use rustc_middle:: ty:: subst:: { InternalSubsts , Subst } ;
24
23
use rustc_middle:: ty:: { self , AdtKind , Lift , Ty , TyCtxt } ;
24
+ use rustc_middle:: { bug, span_bug} ;
25
25
use rustc_mir:: const_eval:: { is_const_fn, is_unstable_const_fn} ;
26
26
use rustc_span:: hygiene:: { AstPass , MacroKind } ;
27
27
use rustc_span:: symbol:: { kw, sym, Ident , Symbol } ;
@@ -157,11 +157,14 @@ impl Clean<GenericBound> for hir::GenericBound<'_> {
157
157
impl Clean < Type > for ( ty:: TraitRef < ' _ > , & [ TypeBinding ] ) {
158
158
fn clean ( & self , cx : & mut DocContext < ' _ > ) -> Type {
159
159
let ( trait_ref, bounds) = * self ;
160
- let kind = match cx. tcx . def_kind ( trait_ref. def_id ) {
161
- DefKind :: Trait => ItemType :: Trait ,
162
- DefKind :: TraitAlias => ItemType :: TraitAlias ,
163
- other => bug ! ( "`TraitRef` had unexpected kind {:?}" , other) ,
164
- } ;
160
+ let kind = cx. tcx . def_kind ( trait_ref. def_id ) . into ( ) ;
161
+ if !matches ! ( kind, ItemType :: Trait | ItemType :: TraitAlias ) {
162
+ span_bug ! (
163
+ cx. tcx. def_span( trait_ref. def_id) ,
164
+ "`TraitRef` had unexpected kind {:?}" ,
165
+ kind
166
+ ) ;
167
+ }
165
168
inline:: record_extern_fqn ( cx, trait_ref. def_id , kind) ;
166
169
let path = external_path (
167
170
cx,
0 commit comments