diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-09-13 21:20:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-13 21:20:39 +0200 |
| commit | a9bc2ef89424091b435d7fb50343d64d6f05c9a3 (patch) | |
| tree | 4b0af60aae848bb02e457206cee63e506654e0d6 /compiler | |
| parent | 5eb77838eaa414319dfb50e57cb9d7b459aa0341 (diff) | |
| parent | a0b83f542f91699838c65d772b0eb6aeb276fb67 (diff) | |
| download | rust-a9bc2ef89424091b435d7fb50343d64d6f05c9a3.tar.gz rust-a9bc2ef89424091b435d7fb50343d64d6f05c9a3.zip | |
Rollup merge of #88851 - fee1-dead:dup-bound, r=oli-obk
Fix duplicate bounds for const_trait_impl Fixes #88383. Compare the constness of the candidates before winnowing and removing a `~const` `BoundCandidate`.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index f5be8bf0949..8adf9015933 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -1487,10 +1487,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { ) => false, (ParamCandidate(other), ParamCandidate(victim)) => { - let value_same_except_bound_vars = other.value.skip_binder() + let same_except_bound_vars = other.value.skip_binder() == victim.value.skip_binder() + && other.constness == victim.constness && !other.value.skip_binder().has_escaping_bound_vars(); - if value_same_except_bound_vars { + if same_except_bound_vars { // See issue #84398. In short, we can generate multiple ParamCandidates which are // the same except for unused bound vars. Just pick the one with the fewest bound vars // or the current one if tied (they should both evaluate to the same answer). This is |
