diff options
Diffstat (limited to 'tests/ui/nonscalar-cast.fixed')
-rw-r--r-- | tests/ui/nonscalar-cast.fixed | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/nonscalar-cast.fixed b/tests/ui/nonscalar-cast.fixed new file mode 100644 index 000000000..0a4b98469 --- /dev/null +++ b/tests/ui/nonscalar-cast.fixed @@ -0,0 +1,16 @@ +// 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] +} |