@@ -167,6 +167,7 @@ pub struct DeepRejectCtxt {
167167}
168168
169169impl DeepRejectCtxt {
170+ #[ inline]
170171 pub fn args_may_unify < ' tcx > (
171172 self ,
172173 obligation_args : GenericArgsRef < ' tcx > ,
@@ -329,21 +330,22 @@ impl DeepRejectCtxt {
329330 }
330331 }
331332
333+ #[ inline( always) ]
332334 pub fn consts_may_unify ( self , obligation_ct : ty:: Const < ' _ > , impl_ct : ty:: Const < ' _ > ) -> bool {
333- match impl_ct. kind ( ) {
335+ let k = impl_ct. kind ( ) ;
336+ let impl_val = match k {
334337 ty:: ConstKind :: Expr ( _)
335338 | ty:: ConstKind :: Param ( _)
336339 | ty:: ConstKind :: Unevaluated ( _)
337340 | ty:: ConstKind :: Error ( _) => {
338341 return true ;
339342 }
340- ty:: ConstKind :: Value ( _ ) => { }
343+ ty:: ConstKind :: Value ( impl_val ) => impl_val ,
341344 ty:: ConstKind :: Infer ( _) | ty:: ConstKind :: Bound ( ..) | ty:: ConstKind :: Placeholder ( _) => {
342345 bug ! ( "unexpected impl arg: {:?}" , impl_ct)
343346 }
344- }
347+ } ;
345348
346- let k = impl_ct. kind ( ) ;
347349 match obligation_ct. kind ( ) {
348350 ty:: ConstKind :: Param ( _) => match self . treat_obligation_params {
349351 TreatParams :: ForLookup => false ,
@@ -358,10 +360,7 @@ impl DeepRejectCtxt {
358360 ty:: ConstKind :: Expr ( _) | ty:: ConstKind :: Unevaluated ( _) | ty:: ConstKind :: Error ( _) => {
359361 true
360362 }
361- ty:: ConstKind :: Value ( obl) => match k {
362- ty:: ConstKind :: Value ( imp) => obl == imp,
363- _ => true ,
364- } ,
363+ ty:: ConstKind :: Value ( obl_val) => obl_val == impl_val,
365364
366365 ty:: ConstKind :: Infer ( _) => true ,
367366
0 commit comments