diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2014-10-09 17:19:50 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2014-10-09 17:19:50 -0400 |
| commit | 389ef6601d18112a7a449eac2e190e4eb061bdf8 (patch) | |
| tree | 482a90f2680c3bbe095901af03eb5ba21aca1876 /src/test/run-pass/coherence-multidispatch-tuple.rs | |
| parent | 79d056f94b75e1c9ad5d72bd8081d6aa5e323848 (diff) | |
Implement multidispatch and conditional dispatch. Because we do not
attempt to preserve crate concatenation, this is a backwards compatible change. Conflicts: src/librustc/middle/traits/select.rs
Diffstat (limited to 'src/test/run-pass/coherence-multidispatch-tuple.rs')
| -rw-r--r-- | src/test/run-pass/coherence-multidispatch-tuple.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/run-pass/coherence-multidispatch-tuple.rs b/src/test/run-pass/coherence-multidispatch-tuple.rs new file mode 100644 index 00000000000..04a69bbf3a2 --- /dev/null +++ b/src/test/run-pass/coherence-multidispatch-tuple.rs @@ -0,0 +1,30 @@ +// Copyright 2014 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. + +use std::fmt::Show; +use std::default::Default; + +// Test that an impl for homogeneous pairs does not conflict with a +// heterogeneous pair. + +trait MyTrait { + fn get(&self) -> uint; +} + +impl<T> MyTrait for (T,T) { + fn get(&self) -> uint { 0 } +} + +impl MyTrait for (uint,int) { + fn get(&self) -> uint { 0 } +} + +fn main() { +} |
