3 #![allow(incomplete_features)]
4 #![feature(const_trait_impl)]
9 impl const std::ops::Add for Int {
12 fn add(self, rhs: Self) -> Self {
13 Int(self.0.plus(rhs.0))
17 impl const PartialEq for Int {
18 fn eq(&self, rhs: &Self) -> bool {
24 fn plus(self, rhs: Self) -> Self;
27 impl const Plus for i32 {
28 fn plus(self, rhs: Self) -> Self {
33 pub const fn add_i32(a: i32, b: i32) -> i32 {
37 const ADD_INT: Int = Int(1i32) + Int(2i32);
40 assert!(ADD_INT == Int(3i32));