about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2013-09-16 12:02:27 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2013-09-16 12:02:27 -0700
commitedf20ccc1b28a17c5acd1442f6341eb21015a8ea (patch)
tree4a01a936c6a4a037ced34edcf91f2b3fd135921e /src
parent6bc48b63f376439801d43820f6df0990797b8787 (diff)
testsuite: Add test for #4208
Closes #4208
Diffstat (limited to 'src')
-rw-r--r--src/test/auxiliary/issue-4208-cc.rs21
-rw-r--r--src/test/run-pass/issue-4208.rs19
2 files changed, 40 insertions, 0 deletions
diff --git a/src/test/auxiliary/issue-4208-cc.rs b/src/test/auxiliary/issue-4208-cc.rs
new file mode 100644
index 00000000000..26db69fb9e1
--- /dev/null
+++ b/src/test/auxiliary/issue-4208-cc.rs
@@ -0,0 +1,21 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[link(name = "numeric",
+       vers = "0.1")];
+#[crate_type = "lib"];
+
+pub trait Trig<T> {
+    fn sin(&self) -> T;
+}
+
+pub fn sin<T:Trig<R>, R>(theta: &T) -> R { theta.sin() }
+
+pub trait Angle<T>: Trig<T> {}
diff --git a/src/test/run-pass/issue-4208.rs b/src/test/run-pass/issue-4208.rs
new file mode 100644
index 00000000000..e8b633ca251
--- /dev/null
+++ b/src/test/run-pass/issue-4208.rs
@@ -0,0 +1,19 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-4208-cc.rs
+// xfail-fast - Windows hates cross-crate tests
+
+extern mod numeric;
+use numeric::*;
+
+fn foo<T, A:Angle<T>>(theta: A) -> T { sin(&theta) }
+
+fn main() {}