1 // Copyright 2013 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.
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.
11 // Test that we are able to compile calls to associated fns like
12 // `decode()` where the bound on the `Self` parameter references a
13 // lifetime parameter of the trait. This example indicates why trait
14 // lifetime parameters must be early bound in the type of the
17 // pretty-expanded FIXME #23616
26 pub trait Decoder<'v> {
27 fn read(&mut self) -> Value<'v>;
30 pub trait Decodable<'v, D: Decoder<'v>>
31 : marker::PhantomFn<(), &'v int>
33 fn decode(d: &mut D) -> Self;
36 impl<'v, D: Decoder<'v>> Decodable<'v, D> for () {
37 fn decode(d: &mut D) -> () {
40 Value::B => Decodable::decode(d),