blob: 3f8d536888469e90de5b9c11194053e9fc5218c8 [file] [log] [blame]
Graydon Hoared1affff2012-12-11 01:32:481// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
Brian Anderson78ee8212012-11-28 20:34:3011// xfail-fast
12// aux-build:trait_inheritance_auto_xc_2_aux.rs
13
14extern mod aux(name = "trait_inheritance_auto_xc_2_aux");
15
16// aux defines impls of Foo, Bar and Baz for A
17use aux::{Foo, Bar, Baz, A};
18
19// We want to extend all Foo, Bar, Bazes to Quuxes
Patrick Walton6d4ed522013-03-05 00:11:3020pub trait Quux: Foo + Bar + Baz { }
Patrick Waltonbf2a2252013-02-21 01:07:1721impl<T:Foo + Bar + Baz> Quux for T { }
Brian Anderson78ee8212012-11-28 20:34:3022
Patrick Waltonbf2a2252013-02-21 01:07:1723fn f<T:Quux>(a: &T) {
Corey Richardsoncc57ca02013-05-19 02:02:4524 assert_eq!(a.f(), 10);
25 assert_eq!(a.g(), 20);
26 assert_eq!(a.h(), 30);
Brian Anderson78ee8212012-11-28 20:34:3027}
28
Graydon Hoare89c8ef72013-02-02 03:43:1729pub fn main() {
Brian Anderson78ee8212012-11-28 20:34:3030 let a = &A { x: 3 };
31 f(a);
32}