2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(unused_variables)]
|
2015-03-22 20:13:15 +00:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2014-10-21 01:40:10 +00:00
|
|
|
use std::default::Default;
|
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
struct X { pub x: usize }
|
2014-10-21 01:40:10 +00:00
|
|
|
impl Default for X {
|
|
|
|
fn default() -> X {
|
2015-03-03 08:42:26 +00:00
|
|
|
X { x: 42 }
|
2014-10-21 01:40:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Y<T> { pub y: T }
|
|
|
|
impl<T: Default> Default for Y<T> {
|
|
|
|
fn default() -> Y<T> {
|
|
|
|
Y { y: Default::default() }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let X { x: _ } = Default::default();
|
|
|
|
let Y { y: X { x } } = Default::default();
|
|
|
|
}
|