about summary refs log tree commit diff
path: root/tests/ui/modules/impl-cross-module.rs
blob: 3ed8c18ff3cd2dcbdf80c35a07f23db6fa14b0d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! Test implementing methods for types defined in other modules

//@ run-pass

mod foo {
    pub struct Point {
        pub x: i32,
        #[allow(dead_code)]
        pub y: i32,
    }
}

impl foo::Point {
    fn x(&self) -> i32 { self.x }
}

fn main() {
    assert_eq!((foo::Point { x: 1, y: 3}).x(), 1);
}