mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
16 lines
256 B
Rust
16 lines
256 B
Rust
//@ run-rustfix
|
|
|
|
#[derive(Debug)]
|
|
struct Foo {
|
|
x: isize
|
|
}
|
|
|
|
impl From<Foo> for isize {
|
|
fn from(val: Foo) -> isize {
|
|
val.x
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
println!("{}", isize::from(Foo { x: 1 })); //~ non-primitive cast: `Foo` as `isize` [E0605]
|
|
}
|