about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/auxiliary/trait_default_method_xc_aux_2.rs17
-rw-r--r--src/test/run-pass/trait-default-method-xc-2.rs25
2 files changed, 42 insertions, 0 deletions
diff --git a/src/test/auxiliary/trait_default_method_xc_aux_2.rs b/src/test/auxiliary/trait_default_method_xc_aux_2.rs
new file mode 100644
index 00000000000..2d4f539f82b
--- /dev/null
+++ b/src/test/auxiliary/trait_default_method_xc_aux_2.rs
@@ -0,0 +1,17 @@
+// aux-build:trait_default_method_xc_aux.rs
+
+extern mod aux(name = "trait_default_method_xc_aux");
+use aux::A;
+
+pub struct a_struct { x: int }
+
+impl A for a_struct {
+    fn f(&self) -> int { 10 }
+}
+
+// This function will need to get inlined, and badness may result.
+pub fn welp<A>(x: A) -> A {
+    let a = a_struct { x: 0 };
+    a.g();
+    x
+}
diff --git a/src/test/run-pass/trait-default-method-xc-2.rs b/src/test/run-pass/trait-default-method-xc-2.rs
new file mode 100644
index 00000000000..1dad5d23b88
--- /dev/null
+++ b/src/test/run-pass/trait-default-method-xc-2.rs
@@ -0,0 +1,25 @@
+// xfail-fast
+// aux-build:trait_default_method_xc_aux.rs
+// aux-build:trait_default_method_xc_aux_2.rs
+
+
+extern mod aux(name = "trait_default_method_xc_aux");
+extern mod aux2(name = "trait_default_method_xc_aux_2");
+use aux::A;
+use aux2::{a_struct, welp};
+
+
+fn main () {
+
+    let a = a_struct { x: 0 };
+    let b = a_struct { x: 1 };
+
+    assert_eq!(0i.g(), 10);
+    assert_eq!(a.g(), 10);
+    assert_eq!(a.h(), 11);
+    assert_eq!(b.g(), 10);
+    assert_eq!(b.h(), 11);
+    assert_eq!(A::lurr(&a, &b), 21);
+
+    welp(&0);
+}