@@ -319,7 +319,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
319
319
pub fn is_trait_predicate_const ( & self , pred : ty:: TraitPredicate < ' _ > ) -> bool {
320
320
match pred. constness {
321
321
ty:: BoundConstness :: ConstIfConst if self . is_in_const_context => true ,
322
- _ => false
322
+ _ => false ,
323
323
}
324
324
}
325
325
@@ -1079,30 +1079,30 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1079
1079
let tcx = self . tcx ( ) ;
1080
1080
// Respect const trait obligations
1081
1081
if self . is_trait_predicate_const ( obligation. predicate . skip_binder ( ) ) {
1082
- if Some ( obligation. predicate . skip_binder ( ) . trait_ref . def_id )
1083
- != tcx. lang_items ( ) . sized_trait ( )
1084
- // const Sized bounds are skipped
1085
- {
1086
- match candidate {
1087
- // const impl
1088
- ImplCandidate ( def_id)
1089
- if tcx. impl_constness ( def_id) == hir:: Constness :: Const => { }
1090
- // const param
1091
- ParamCandidate ( ty:: ConstnessAnd {
1092
- constness : ty:: BoundConstness :: ConstIfConst ,
1093
- ..
1094
- } ) => { }
1095
- // auto trait impl
1096
- AutoImplCandidate ( ..) => { }
1097
- // generator, this will raise error in other places
1098
- // or ignore error with const_async_blocks feature
1099
- GeneratorCandidate => { }
1100
- _ => {
1101
- // reject all other types of candidates
1102
- return Err ( Unimplemented ) ;
1103
- }
1082
+ if Some ( obligation. predicate . skip_binder ( ) . trait_ref . def_id )
1083
+ != tcx. lang_items ( ) . sized_trait ( )
1084
+ // const Sized bounds are skipped
1085
+ {
1086
+ match candidate {
1087
+ // const impl
1088
+ ImplCandidate ( def_id)
1089
+ if tcx. impl_constness ( def_id) == hir:: Constness :: Const => { }
1090
+ // const param
1091
+ ParamCandidate ( ty:: ConstnessAnd {
1092
+ constness : ty:: BoundConstness :: ConstIfConst ,
1093
+ ..
1094
+ } ) => { }
1095
+ // auto trait impl
1096
+ AutoImplCandidate ( ..) => { }
1097
+ // generator, this will raise error in other places
1098
+ // or ignore error with const_async_blocks feature
1099
+ GeneratorCandidate => { }
1100
+ _ => {
1101
+ // reject all other types of candidates
1102
+ return Err ( Unimplemented ) ;
1104
1103
}
1105
1104
}
1105
+ }
1106
1106
}
1107
1107
// Treat negative impls as unimplemented, and reservation impls as ambiguity.
1108
1108
if let ImplCandidate ( def_id) = candidate {
@@ -1497,7 +1497,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1497
1497
// probably best characterized as a "hack", since we might prefer to just do our
1498
1498
// best to *not* create essentially duplicate candidates in the first place.
1499
1499
other. value . bound_vars ( ) . len ( ) <= victim. value . bound_vars ( ) . len ( )
1500
- } else if other. value == victim. value && victim. constness == ty:: BoundConstness :: NotConst {
1500
+ } else if other. value == victim. value
1501
+ && victim. constness == ty:: BoundConstness :: NotConst
1502
+ {
1501
1503
// Drop otherwise equivalent non-const candidates in favor of const candidates.
1502
1504
true
1503
1505
} else {
0 commit comments