2020-06-14 23:36:25 -05:00
|
|
|
// run-rustfix
|
|
|
|
|
2015-01-28 07:34:18 -06:00
|
|
|
#[derive(Debug)]
|
2018-12-16 21:21:47 -06:00
|
|
|
struct Foo {
|
2015-01-08 04:54:35 -06:00
|
|
|
x: isize
|
2013-03-01 21:57:05 -06:00
|
|
|
}
|
|
|
|
|
2020-06-14 23:36:25 -05:00
|
|
|
impl From<Foo> for isize {
|
|
|
|
fn from(val: Foo) -> isize {
|
|
|
|
val.x
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 11:14:13 -05:00
|
|
|
fn main() {
|
2018-12-16 21:21:47 -06:00
|
|
|
println!("{}", Foo { x: 1 } as isize); //~ non-primitive cast: `Foo` as `isize` [E0605]
|
2011-10-27 11:14:13 -05:00
|
|
|
}
|