2019-07-26 16:54:25 -05:00
|
|
|
// run-pass
|
2015-03-22 15:13:15 -05:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2015-04-18 00:12:20 -05:00
|
|
|
trait Serializer {
|
2012-09-10 14:25:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
trait Serializable {
|
2013-03-12 21:32:14 -05:00
|
|
|
fn serialize<S:Serializer>(&self, s: S);
|
2012-09-10 14:25:45 -05:00
|
|
|
}
|
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
impl Serializable for isize {
|
2013-03-12 21:32:14 -05:00
|
|
|
fn serialize<S:Serializer>(&self, _s: S) { }
|
2012-09-10 14:25:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
struct F<A> { a: A }
|
|
|
|
|
2013-07-10 16:43:25 -05:00
|
|
|
impl<A:Serializable> Serializable for F<A> {
|
2013-03-12 21:32:14 -05:00
|
|
|
fn serialize<S:Serializer>(&self, s: S) {
|
2013-02-15 04:44:18 -06:00
|
|
|
self.a.serialize(s);
|
2012-09-10 14:25:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
impl Serializer for isize {
|
2012-09-10 14:25:45 -05:00
|
|
|
}
|
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2015-01-25 15:05:03 -06:00
|
|
|
let foo = F { a: 1 };
|
|
|
|
foo.serialize(1);
|
2012-09-10 14:25:45 -05:00
|
|
|
|
2015-01-25 15:05:03 -06:00
|
|
|
let bar = F { a: F {a: 1 } };
|
|
|
|
bar.serialize(2);
|
2012-09-10 14:25:45 -05:00
|
|
|
}
|