From fd94bd984e6e0772f501e57f9b2f36a3ac420640 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Tue, 14 May 2013 13:02:54 -0700 Subject: [PATCH 1/2] testsuite: Add passing test for #4107 --- src/test/run-pass/issue-4107.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/test/run-pass/issue-4107.rs diff --git a/src/test/run-pass/issue-4107.rs b/src/test/run-pass/issue-4107.rs new file mode 100644 index 0000000000000..94a42db047ef6 --- /dev/null +++ b/src/test/run-pass/issue-4107.rs @@ -0,0 +1,33 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let id: &Mat2 = &Matrix::identity(); +} + +pub trait Index { } +pub trait Dimensional: Index { } + +pub struct Mat2 { x: () } +pub struct Vec2 { x: () } + +impl Dimensional> for Mat2 { } +impl Index> for Mat2 { } + +impl Dimensional for Vec2 { } +impl Index for Vec2 { } + +pub trait Matrix: Dimensional { + fn identity() -> Self; +} + +impl Matrix> for Mat2 { + fn identity() -> Mat2 { Mat2{ x: () } } +} From 1aae163d445d0074d893c4ab5c309449c1b6bd48 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Wed, 22 May 2013 14:13:04 -0700 Subject: [PATCH 2/2] testsuite: Make main fn public --- src/test/run-pass/issue-4107.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/run-pass/issue-4107.rs b/src/test/run-pass/issue-4107.rs index 94a42db047ef6..549d9cb734c00 100644 --- a/src/test/run-pass/issue-4107.rs +++ b/src/test/run-pass/issue-4107.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn main() { +pub fn main() { let id: &Mat2 = &Matrix::identity(); }