]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.rs
Stabilize File::options()
[rust.git] / src / test / ui / rfc-2632-const-trait-impl / const-and-non-const-impl.rs
1 #![feature(const_trait_impl)]
2
3 pub struct Int(i32);
4
5 impl const std::ops::Add for i32 {
6     //~^ ERROR conflicting implementations of trait
7     //~| ERROR only traits defined in the current crate can be implemented for arbitrary types
8     type Output = Self;
9
10     fn add(self, rhs: Self) -> Self {
11         self + rhs
12     }
13 }
14
15 impl std::ops::Add for Int {
16     type Output = Self;
17
18     fn add(self, rhs: Self) -> Self {
19         Int(self.0 + rhs.0)
20     }
21 }
22
23 impl const std::ops::Add for Int {
24     //~^ ERROR conflicting implementations of trait
25     type Output = Self;
26
27     fn add(self, rhs: Self) -> Self {
28         Int(self.0 + rhs.0)
29     }
30 }
31
32 fn main() {}