blob: 1fc2c4fe4456f9100cd95e588774a8f69a1d69e9 (
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_trait_bound)]
#![feature(const_trait_impl)]
#![feature(const_trait_bound_opt_out)]
#![allow(incomplete_features)]
struct S;
impl PartialEq for S {
fn eq(&self, _: &S) -> bool {
true
}
}
const fn equals_self<T: ?const PartialEq>(t: &T) -> bool {
true
}
pub const EQ: bool = equals_self(&S);
// Calling `equals_self` with a type that only has a non-const impl is fine, because we opted out.
fn main() {}
|