summaryrefslogtreecommitdiffstats
path: root/third_party/rust/extend/tests/compile_pass/hello_world.rs
blob: 75c61183b4e3bb56e8edb4961b5c15be3817ad93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use extend::ext;

#[ext]
impl i32 {
    fn add_one(&self) -> Self {
        self + 1
    }

    fn foo() -> MyType {
        MyType
    }
}

#[derive(Debug, Eq, PartialEq)]
struct MyType;

fn main() {
    assert_eq!(i32::foo(), MyType);
    assert_eq!(1.add_one(), 2);
}