@@ -569,7 +569,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
569
569
570
570
let has_self = generic_params. has_self ;
571
571
let ( _, potential_assoc_types) = Self :: check_generic_arg_count (
572
- self . tcx ( ) ,
572
+ tcx,
573
573
span,
574
574
& generic_params,
575
575
& generic_args,
@@ -594,7 +594,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
594
594
} ;
595
595
596
596
let substs = Self :: create_substs_for_generic_args (
597
- self . tcx ( ) ,
597
+ tcx,
598
598
def_id,
599
599
& [ ] [ ..] ,
600
600
self_ty. is_some ( ) ,
@@ -1293,8 +1293,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
1293
1293
self . prohibit_generics ( slice:: from_ref ( item_segment) ) ;
1294
1294
1295
1295
// Check if we have an enum variant here.
1296
- if let ty :: Adt ( adt_def , _ ) = ty. sty {
1297
- if adt_def. is_enum ( ) {
1296
+ match ty. sty {
1297
+ ty :: Adt ( adt_def , _ ) if adt_def. is_enum ( ) => {
1298
1298
let variant_def = adt_def. variants . iter ( ) . find ( |vd| {
1299
1299
tcx. hygienic_eq ( assoc_name, vd. ident , adt_def. did )
1300
1300
} ) ;
@@ -1305,7 +1305,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
1305
1305
tcx. check_stability ( def. def_id ( ) , Some ( ref_id) , span) ;
1306
1306
return ( ty, def) ;
1307
1307
}
1308
- }
1308
+ } ,
1309
+ _ => ( ) ,
1309
1310
}
1310
1311
1311
1312
// Find the type of the associated item, and the trait where the associated
@@ -1339,7 +1340,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
1339
1340
}
1340
1341
( & ty:: Adt ( adt_def, _substs) , Def :: Enum ( _did) ) => {
1341
1342
let ty_str = ty. to_string ( ) ;
1342
- // Incorrect enum variant
1343
+ // Incorrect enum variant.
1343
1344
let mut err = tcx. sess . struct_span_err (
1344
1345
span,
1345
1346
& format ! ( "no variant `{}` on enum `{}`" , & assoc_name. as_str( ) , ty_str) ,
@@ -1669,23 +1670,24 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
1669
1670
tcx. mk_ty_param ( index, tcx. hir ( ) . name ( node_id) . as_interned_str ( ) )
1670
1671
}
1671
1672
Def :: SelfTy ( _, Some ( def_id) ) => {
1672
- // `Self` in impl (we know the concrete type)
1673
+ // `Self` in impl (we know the concrete type).
1673
1674
assert_eq ! ( opt_self_ty, None ) ;
1674
1675
self . prohibit_generics ( & path. segments ) ;
1675
1676
tcx. at ( span) . type_of ( def_id)
1676
1677
}
1677
1678
Def :: SelfTy ( Some ( _) , None ) => {
1678
- // `Self` in trait
1679
+ // `Self` in trait.
1679
1680
assert_eq ! ( opt_self_ty, None ) ;
1680
1681
self . prohibit_generics ( & path. segments ) ;
1681
1682
tcx. mk_self_type ( )
1682
1683
}
1683
1684
Def :: AssociatedTy ( def_id) => {
1684
- self . prohibit_generics ( & path. segments [ ..path. segments . len ( ) -2 ] ) ;
1685
+ debug_assert ! ( path. segments. len( ) >= 2 ) ;
1686
+ self . prohibit_generics ( & path. segments [ ..path. segments . len ( ) - 2 ] ) ;
1685
1687
self . qpath_to_ty ( span,
1686
1688
opt_self_ty,
1687
1689
def_id,
1688
- & path. segments [ path. segments . len ( ) - 2 ] ,
1690
+ & path. segments [ path. segments . len ( ) - 2 ] ,
1689
1691
path. segments . last ( ) . unwrap ( ) )
1690
1692
}
1691
1693
Def :: PrimTy ( prim_ty) => {
0 commit comments