3 #![allow(incomplete_features)]
4 #![feature(const_trait_impl)]
8 impl const std::ops::Add for Int {
11 fn add(self, rhs: Self) -> Self {
12 Int(self.0.plus(rhs.0))
16 impl const PartialEq for Int {
17 fn eq(&self, rhs: &Self) -> bool {
23 fn plus(self, rhs: Self) -> Self;
26 impl const Plus for i32 {
27 fn plus(self, rhs: Self) -> Self {
32 pub const fn add_i32(a: i32, b: i32) -> i32 {
36 const ADD_INT: Int = Int(1i32) + Int(2i32);
39 assert!(ADD_INT == Int(3i32));