3 #![feature(const_trait_impl)]
7 impl const std::ops::Add for Int {
10 fn add(self, rhs: Self) -> Self {
11 Int(self.0.plus(rhs.0))
15 impl const PartialEq for Int {
16 fn eq(&self, rhs: &Self) -> bool {
19 fn ne(&self, other: &Self) -> bool {
25 fn plus(self, rhs: Self) -> Self;
28 impl const Plus for i32 {
29 fn plus(self, rhs: Self) -> Self {
34 pub const fn add_i32(a: i32, b: i32) -> i32 {
38 const ADD_INT: Int = Int(1i32) + Int(2i32);
41 assert!(ADD_INT == Int(3i32));