]> git.proxmox.com Git - rustc.git/blame - src/test/ui/rfc-2632-const-trait-impl/call-generic-method-pass.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / rfc-2632-const-trait-impl / call-generic-method-pass.rs
CommitLineData
fc512014
XL
1//! Basic test for calling methods on generic type parameters in `const fn`.
2
3// check-pass
4
fc512014 5#![feature(const_trait_impl)]
cdc7bbd5 6#![feature(const_fn_trait_bound)]
fc512014
XL
7
8struct S;
9
10impl const PartialEq for S {
11 fn eq(&self, _: &S) -> bool {
12 true
13 }
136023e0
XL
14 fn ne(&self, other: &S) -> bool {
15 !self.eq(other)
16 }
fc512014
XL
17}
18
19const fn equals_self<T: PartialEq>(t: &T) -> bool {
20 *t == *t
21}
22
23pub const EQ: bool = equals_self(&S);
24
25fn main() {}