From fd94bd984e6e0772f501e57f9b2f36a3ac420640 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Tue, 14 May 2013 13:02:54 -0700 Subject: [PATCH] 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 00000000000..94a42db047e --- /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: () } } +}