]> git.lizzy.rs Git - rust.git/blob - tests/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.rs
Rollup merge of #106625 - Swatinem:ref/cov6, r=nagisa
[rust.git] / tests / 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 only traits defined in the current crate can be implemented for primitive types
7     type Output = Self;
8
9     fn add(self, rhs: Self) -> Self {
10         self + rhs
11     }
12 }
13
14 impl std::ops::Add for Int {
15     type Output = Self;
16
17     fn add(self, rhs: Self) -> Self {
18         Int(self.0 + rhs.0)
19     }
20 }
21
22 impl const std::ops::Add for Int {
23     //~^ ERROR conflicting implementations of trait
24     type Output = Self;
25
26     fn add(self, rhs: Self) -> Self {
27         Int(self.0 + rhs.0)
28     }
29 }
30
31 fn main() {}