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