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 /src/test | |
| parent | 5eb77838eaa414319dfb50e57cb9d7b459aa0341 (diff) | |
| parent | a0b83f542f91699838c65d772b0eb6aeb276fb67 (diff) | |
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 'src/test')
| -rw-r--r-- | src/test/ui/rfc-2632-const-trait-impl/call-generic-method-dup-bound.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-dup-bound.rs b/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-dup-bound.rs index 7185376b440..cc24dbd96d2 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-dup-bound.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-dup-bound.rs @@ -16,12 +16,17 @@ impl const PartialEq for S { // This duplicate bound should not result in ambiguities. It should be equivalent to a single ~const // bound. -// const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool { -// FIXME(fee1-dead)^ why should the order matter here? -const fn equals_self<T: ~const PartialEq + PartialEq>(t: &T) -> bool { +const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool { *t == *t } -pub const EQ: bool = equals_self(&S); +trait A: PartialEq {} +impl<T: PartialEq> A for T {} + +const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool { + *t == *t +} + +pub const EQ: bool = equals_self(&S) && equals_self2(&S); fn main() {} |
