about summary refs log tree commit diff
path: root/tests/ui/modules/impl-cross-module.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/modules/impl-cross-module.rs')
-rw-r--r--tests/ui/modules/impl-cross-module.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/modules/impl-cross-module.rs b/tests/ui/modules/impl-cross-module.rs
new file mode 100644
index 00000000000..3ed8c18ff3c
--- /dev/null
+++ b/tests/ui/modules/impl-cross-module.rs
@@ -0,0 +1,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);
+}