diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-03-25 01:34:30 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-25 01:34:30 +0100 |
| commit | 1fcb8fc3e0bc82fc63bbb8baa6c6325d361115fc (patch) | |
| tree | 5453b5ffbb5164b6b6afde0b0b1e45ecb978cb54 /compiler/rustc_trait_selection/src/traits/select | |
| parent | c66e0c87267859a46f1a8851f30892985760cfd6 (diff) | |
| parent | 11a70dbc8ac49416598b0ff4525096845a0dc498 (diff) | |
Rollup merge of #95179 - b-naber:eval-in-try-unify, r=lcnr
Try to evaluate in try unify and postpone resolution of constants that contain inference variables We want code like that in [`ui/const-generics/generic_const_exprs/eval-try-unify.rs`](https://github.com/rust-lang/rust/compare/master...b-naber:eval-in-try-unify?expand=1#diff-8027038201cf07a6c96abf3cbf0b0f4fdd8a64ce6292435f01c8ed995b87fe9b) to compile. To do that we need to try to evaluate constants in `try_unify_abstract_consts`, this requires us to be more careful about what constants we try to resolve, specifically we cannot try to resolve constants that still contain inference variables. r? `@lcnr`
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/select')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/mod.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index b7c2f0f4832..6d232d86d8a 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -639,7 +639,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { if let (ty::ConstKind::Unevaluated(a), ty::ConstKind::Unevaluated(b)) = (c1.val(), c2.val()) { - if self.infcx.try_unify_abstract_consts(a.shrink(), b.shrink()) { + if self.infcx.try_unify_abstract_consts( + a.shrink(), + b.shrink(), + obligation.param_env, + ) { return Ok(EvaluatedToOk); } } |
