about summary refs log tree commit diff
path: root/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-dup-bound.rs
blob: b39d27779f45f72f5f546e2370d01e61881c37a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// check-pass

#![feature(const_fn)]
#![feature(const_trait_impl)]
#![feature(const_trait_bound_opt_out)]
#![allow(incomplete_features)]

struct S;

impl const PartialEq for S {
    fn eq(&self, _: &S) -> bool {
        true
    }
}

// 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 {
    *t == *t
}

pub const EQ: bool = equals_self(&S);

fn main() {}