diff options
| author | bors <bors@rust-lang.org> | 2013-08-22 17:21:29 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-08-22 17:21:29 -0700 |
| commit | 23bfa600a0f91f1ea62ea3f3783c358a7cb7da45 (patch) | |
| tree | 5cbc5e327157d1fc25e40c5445b59dbe83850636 /src/test | |
| parent | f858452391c63bfbf46678c4ea9fd584adf1c28e (diff) | |
| parent | 7b08b2c838c440d03e3e01f090e648e14ebfa083 (diff) | |
| download | rust-23bfa600a0f91f1ea62ea3f3783c358a7cb7da45.tar.gz rust-23bfa600a0f91f1ea62ea3f3783c358a7cb7da45.zip | |
auto merge of #8659 : msullivan/rust/default-methods, r=alexcrichton
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/trait-object-generics.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/test/run-pass/trait-object-generics.rs b/src/test/run-pass/trait-object-generics.rs new file mode 100644 index 00000000000..12b6af29520 --- /dev/null +++ b/src/test/run-pass/trait-object-generics.rs @@ -0,0 +1,46 @@ +// 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. + +// test for #8664 + +pub trait Trait2<A> { + fn doit(&self); +} + +pub struct Impl<A1, A2, A3> { + /* + * With A2 we get the ICE: + * task <unnamed> failed at 'index out of bounds: the len is 1 but the index is 1', /home/tortue/rust_compiler_newest/src/librustc/middle/subst.rs:58 + */ + t: ~Trait2<A2> +} + +impl<A1, A2, A3> Impl<A1, A2, A3> { + pub fn step(&self) { + self.t.doit() + } +} + +// test for #8601 + +enum Type<T> { Constant } + +trait Trait<K,V> { + fn method(&self,Type<(K,V)>) -> int; +} + +impl<V> Trait<u8,V> for () { + fn method(&self, _x: Type<(u8,V)>) -> int { 0 } +} + +fn main () { + let a = @() as @Trait<u8, u8>; + assert_eq!(a.method(Constant), 0); +} |
