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 {
26 fn plus(self, rhs: Self) -> Self;
29 impl const Plus for i32 {
30 fn plus(self, rhs: Self) -> Self {
35 pub const fn add_i32(a: i32, b: i32) -> i32 {
39 const ADD_INT: Int = Int(1i32) + Int(2i32);
42 assert!(ADD_INT == Int(3i32));