Skip to content

Commit dc76e67

Browse files
authored
Rollup merge of rust-lang#124610 - nnethercote:typenum, r=lcnr
Tweak `consts_may_unify` r? ``@lcnr``
2 parents ab8fda5 + 3722eb0 commit dc76e67

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

compiler/rustc_middle/src/ty/fast_reject.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -330,20 +330,19 @@ impl DeepRejectCtxt {
330330
}
331331

332332
pub fn consts_may_unify(self, obligation_ct: ty::Const<'_>, impl_ct: ty::Const<'_>) -> bool {
333-
match impl_ct.kind() {
333+
let impl_val = match impl_ct.kind() {
334334
ty::ConstKind::Expr(_)
335335
| ty::ConstKind::Param(_)
336336
| ty::ConstKind::Unevaluated(_)
337337
| ty::ConstKind::Error(_) => {
338338
return true;
339339
}
340-
ty::ConstKind::Value(_) => {}
340+
ty::ConstKind::Value(impl_val) => impl_val,
341341
ty::ConstKind::Infer(_) | ty::ConstKind::Bound(..) | ty::ConstKind::Placeholder(_) => {
342342
bug!("unexpected impl arg: {:?}", impl_ct)
343343
}
344-
}
344+
};
345345

346-
let k = impl_ct.kind();
347346
match obligation_ct.kind() {
348347
ty::ConstKind::Param(_) => match self.treat_obligation_params {
349348
TreatParams::ForLookup => false,
@@ -358,10 +357,7 @@ impl DeepRejectCtxt {
358357
ty::ConstKind::Expr(_) | ty::ConstKind::Unevaluated(_) | ty::ConstKind::Error(_) => {
359358
true
360359
}
361-
ty::ConstKind::Value(obl) => match k {
362-
ty::ConstKind::Value(imp) => obl == imp,
363-
_ => true,
364-
},
360+
ty::ConstKind::Value(obl_val) => obl_val == impl_val,
365361

366362
ty::ConstKind::Infer(_) => true,
367363

0 commit comments

Comments
 (0)