]> git.proxmox.com Git - rustc.git/blame - src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / rfc-2632-const-trait-impl / const-and-non-const-impl.rs
CommitLineData
74b04a01
XL
1#![feature(const_trait_impl)]
2
3pub struct Int(i32);
4
923072b8 5impl const std::ops::Add for i32 {
04454e1e 6 //~^ ERROR only traits defined in the current crate can be implemented for primitive types
74b04a01
XL
7 type Output = Self;
8
9 fn add(self, rhs: Self) -> Self {
10 self + rhs
11 }
12}
13
923072b8 14impl std::ops::Add for Int {
74b04a01
XL
15 type Output = Self;
16
17 fn add(self, rhs: Self) -> Self {
18 Int(self.0 + rhs.0)
19 }
20}
21
923072b8 22impl const std::ops::Add for Int {
74b04a01
XL
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
31fn main() {}