diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-05-03 06:04:22 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-03 06:04:22 +0200 |
| commit | a9edd38d186640464ab259f5a1422fa3c4c632f2 (patch) | |
| tree | 8159c722e08d2d6806502ca91012b5a65da2d22d | |
| parent | c412751d193ebfb46f53087e9c2b6e56489e6e9e (diff) | |
| parent | 3722eb0b8f07e759dc857865c1b0fbc906253105 (diff) | |
| download | rust-a9edd38d186640464ab259f5a1422fa3c4c632f2.tar.gz rust-a9edd38d186640464ab259f5a1422fa3c4c632f2.zip | |
Rollup merge of #124610 - nnethercote:typenum, r=lcnr
Tweak `consts_may_unify` r? ````@lcnr````
| -rw-r--r-- | compiler/rustc_middle/src/ty/fast_reject.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/compiler/rustc_middle/src/ty/fast_reject.rs b/compiler/rustc_middle/src/ty/fast_reject.rs index 15f048ab598..8d7489f5f7e 100644 --- a/compiler/rustc_middle/src/ty/fast_reject.rs +++ b/compiler/rustc_middle/src/ty/fast_reject.rs @@ -330,20 +330,19 @@ impl DeepRejectCtxt { } pub fn consts_may_unify(self, obligation_ct: ty::Const<'_>, impl_ct: ty::Const<'_>) -> bool { - match impl_ct.kind() { + let impl_val = match impl_ct.kind() { ty::ConstKind::Expr(_) | ty::ConstKind::Param(_) | ty::ConstKind::Unevaluated(_) | ty::ConstKind::Error(_) => { return true; } - ty::ConstKind::Value(_) => {} + ty::ConstKind::Value(impl_val) => impl_val, ty::ConstKind::Infer(_) | ty::ConstKind::Bound(..) | ty::ConstKind::Placeholder(_) => { bug!("unexpected impl arg: {:?}", impl_ct) } - } + }; - let k = impl_ct.kind(); match obligation_ct.kind() { ty::ConstKind::Param(_) => match self.treat_obligation_params { TreatParams::ForLookup => false, @@ -358,10 +357,7 @@ impl DeepRejectCtxt { ty::ConstKind::Expr(_) | ty::ConstKind::Unevaluated(_) | ty::ConstKind::Error(_) => { true } - ty::ConstKind::Value(obl) => match k { - ty::ConstKind::Value(imp) => obl == imp, - _ => true, - }, + ty::ConstKind::Value(obl_val) => obl_val == impl_val, ty::ConstKind::Infer(_) => true, |
