@@ -421,8 +421,8 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>(
421
421
return_ty : Option < Ty < ' tcx > > ,
422
422
) {
423
423
let predicates = fcx. tcx . predicates_of ( def_id) ;
424
-
425
424
let generics = tcx. generics_of ( def_id) ;
425
+
426
426
let is_our_default = |def : & ty:: GenericParamDef | {
427
427
match def. kind {
428
428
GenericParamDefKind :: Type { has_default, .. } => {
@@ -465,6 +465,7 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>(
465
465
// All regions are identity.
466
466
fcx. tcx . mk_param_from_def ( param)
467
467
}
468
+
468
469
GenericParamDefKind :: Type { .. } => {
469
470
// If the param has a default,
470
471
if is_our_default ( param) {
@@ -478,25 +479,24 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>(
478
479
// Mark unwanted params as err.
479
480
fcx. tcx . types . err . into ( )
480
481
}
482
+
481
483
GenericParamDefKind :: Const => {
482
484
// FIXME(const_generics:defaults)
483
- fcx. tcx . types . err . into ( )
485
+ fcx. tcx . consts . err . into ( )
484
486
}
485
487
}
486
488
} ) ;
489
+
487
490
// Now we build the substituted predicates.
488
491
let default_obligations = predicates. predicates . iter ( ) . flat_map ( |& ( pred, _) | {
489
492
#[ derive( Default ) ]
490
493
struct CountParams { params : FxHashSet < u32 > }
491
494
impl < ' tcx > ty:: fold:: TypeVisitor < ' tcx > for CountParams {
492
495
fn visit_ty ( & mut self , t : Ty < ' tcx > ) -> bool {
493
- match t. sty {
494
- ty:: Param ( p) => {
495
- self . params . insert ( p. idx ) ;
496
- t. super_visit_with ( self )
497
- }
498
- _ => t. super_visit_with ( self )
496
+ if let ty:: Param ( param) = t. sty {
497
+ self . params . insert ( param. idx ) ;
499
498
}
499
+ t. super_visit_with ( self )
500
500
}
501
501
502
502
fn visit_region ( & mut self , _: ty:: Region < ' tcx > ) -> bool {
0 commit comments