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