rust-lang / rust-clippy

A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
https://rust-lang.github.io/rust-clippy/
Other
11.35k stars 1.53k forks source link

Thoroughly investigate transmute_undefined_repr #8496

Open Manishearth opened 2 years ago

Manishearth commented 2 years ago

See discussion in https://github.com/rust-lang/rust-clippy/pull/8432

The lint is currently in the nursery and has had multiple problems in the past. We should do a deeper investigation: probably running it on a lot of crates and looking for false positives, as well as trying to structure it to be more conservative by default.

Subissues:

ghost commented 2 years ago

Ran this lint the top 1000 (more or less) crates from crates.io. Here are the warnings I found.

I'm unable to say which are false positives.

Hope this helps.

Crate Number
cgmath-0.18.0 32
criterion-0.3.5 1
iovec-0.1.4 3
nalgebra-0.30.1 2
parity-scale-codec-3.0.0 20
prettytable-rs-0.8.0 1
state-0.5.2 1
wasm-bindgen-0.2.79 40
Full warnings ``` ---> cgmath-0.18.0/src/quaternion.rs:600:18 warning: transmute into `&(S, S, S, S)` which has an undefined layout --> src/quaternion.rs:600:18 | 600 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | = note: requested on the command line with `-W clippy::transmute-undefined-repr` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> cgmath-0.18.0/src/quaternion.rs:607:18 warning: transmute into `&mut (S, S, S, S)` which has an undefined layout --> src/quaternion.rs:607:18 | 607 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> cgmath-0.18.0/src/quaternion.rs:623:18 warning: transmute from `&(S, S, S, S)` which has an undefined layout --> src/quaternion.rs:623:18 | 623 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> cgmath-0.18.0/src/quaternion.rs:630:18 warning: transmute from `&mut (S, S, S, S)` which has an undefined layout --> src/quaternion.rs:630:18 | 630 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> cgmath-0.18.0/src/macros.rs:229:26 warning: transmute into `&(S,)` which has an undefined layout --> src/macros.rs:229:26 | 229 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:384:1 | 384 | impl_tuple_conversions!(Vector1 { x }, (S,)); | ----------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:236:26 warning: transmute into `&mut (S,)` which has an undefined layout --> src/macros.rs:236:26 | 236 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:384:1 | 384 | impl_tuple_conversions!(Vector1 { x }, (S,)); | ----------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:250:26 warning: transmute from `&(S,)` which has an undefined layout --> src/macros.rs:250:26 | 250 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:384:1 | 384 | impl_tuple_conversions!(Vector1 { x }, (S,)); | ----------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:257:26 warning: transmute from `&mut (S,)` which has an undefined layout --> src/macros.rs:257:26 | 257 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:384:1 | 384 | impl_tuple_conversions!(Vector1 { x }, (S,)); | ----------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:229:26 warning: transmute into `&(S, S)` which has an undefined layout --> src/macros.rs:229:26 | 229 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:385:1 | 385 | impl_tuple_conversions!(Vector2 { x, y }, (S, S)); | ---------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:236:26 warning: transmute into `&mut (S, S)` which has an undefined layout --> src/macros.rs:236:26 | 236 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:385:1 | 385 | impl_tuple_conversions!(Vector2 { x, y }, (S, S)); | ---------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:250:26 warning: transmute from `&(S, S)` which has an undefined layout --> src/macros.rs:250:26 | 250 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:385:1 | 385 | impl_tuple_conversions!(Vector2 { x, y }, (S, S)); | ---------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:257:26 warning: transmute from `&mut (S, S)` which has an undefined layout --> src/macros.rs:257:26 | 257 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:385:1 | 385 | impl_tuple_conversions!(Vector2 { x, y }, (S, S)); | ---------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:229:26 warning: transmute into `&(S, S, S)` which has an undefined layout --> src/macros.rs:229:26 | 229 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:386:1 | 386 | impl_tuple_conversions!(Vector3 { x, y, z }, (S, S, S)); | ---------------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:236:26 warning: transmute into `&mut (S, S, S)` which has an undefined layout --> src/macros.rs:236:26 | 236 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:386:1 | 386 | impl_tuple_conversions!(Vector3 { x, y, z }, (S, S, S)); | ---------------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:250:26 warning: transmute from `&(S, S, S)` which has an undefined layout --> src/macros.rs:250:26 | 250 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:386:1 | 386 | impl_tuple_conversions!(Vector3 { x, y, z }, (S, S, S)); | ---------------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:257:26 warning: transmute from `&mut (S, S, S)` which has an undefined layout --> src/macros.rs:257:26 | 257 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:386:1 | 386 | impl_tuple_conversions!(Vector3 { x, y, z }, (S, S, S)); | ---------------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:229:26 warning: transmute into `&(S, S, S, S)` which has an undefined layout --> src/macros.rs:229:26 | 229 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:387:1 | 387 | impl_tuple_conversions!(Vector4 { x, y, z, w }, (S, S, S, S)); | ---------------------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:236:26 warning: transmute into `&mut (S, S, S, S)` which has an undefined layout --> src/macros.rs:236:26 | 236 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:387:1 | 387 | impl_tuple_conversions!(Vector4 { x, y, z, w }, (S, S, S, S)); | ---------------------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:250:26 warning: transmute from `&(S, S, S, S)` which has an undefined layout --> src/macros.rs:250:26 | 250 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:387:1 | 387 | impl_tuple_conversions!(Vector4 { x, y, z, w }, (S, S, S, S)); | ---------------------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:257:26 warning: transmute from `&mut (S, S, S, S)` which has an undefined layout --> src/macros.rs:257:26 | 257 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | ::: src/vector.rs:387:1 | 387 | impl_tuple_conversions!(Vector4 { x, y, z, w }, (S, S, S, S)); | ---------------------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:229:26 warning: transmute into `&(S,)` which has an undefined layout --> src/macros.rs:229:26 | 229 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | ::: src/point.rs:362:1 | 362 | impl_tuple_conversions!(Point1 { x }, (S,)); | ---------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:236:26 warning: transmute into `&mut (S,)` which has an undefined layout --> src/macros.rs:236:26 | 236 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | ::: src/point.rs:362:1 | 362 | impl_tuple_conversions!(Point1 { x }, (S,)); | ---------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:250:26 warning: transmute from `&(S,)` which has an undefined layout --> src/macros.rs:250:26 | 250 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | ::: src/point.rs:362:1 | 362 | impl_tuple_conversions!(Point1 { x }, (S,)); | ---------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:257:26 warning: transmute from `&mut (S,)` which has an undefined layout --> src/macros.rs:257:26 | 257 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | ::: src/point.rs:362:1 | 362 | impl_tuple_conversions!(Point1 { x }, (S,)); | ---------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:229:26 warning: transmute into `&(S, S)` which has an undefined layout --> src/macros.rs:229:26 | 229 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | ::: src/point.rs:363:1 | 363 | impl_tuple_conversions!(Point2 { x, y }, (S, S)); | --------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:236:26 warning: transmute into `&mut (S, S)` which has an undefined layout --> src/macros.rs:236:26 | 236 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | ::: src/point.rs:363:1 | 363 | impl_tuple_conversions!(Point2 { x, y }, (S, S)); | --------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:250:26 warning: transmute from `&(S, S)` which has an undefined layout --> src/macros.rs:250:26 | 250 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | ::: src/point.rs:363:1 | 363 | impl_tuple_conversions!(Point2 { x, y }, (S, S)); | --------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:257:26 warning: transmute from `&mut (S, S)` which has an undefined layout --> src/macros.rs:257:26 | 257 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | ::: src/point.rs:363:1 | 363 | impl_tuple_conversions!(Point2 { x, y }, (S, S)); | --------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:229:26 warning: transmute into `&(S, S, S)` which has an undefined layout --> src/macros.rs:229:26 | 229 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | ::: src/point.rs:364:1 | 364 | impl_tuple_conversions!(Point3 { x, y, z }, (S, S, S)); | --------------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:236:26 warning: transmute into `&mut (S, S, S)` which has an undefined layout --> src/macros.rs:236:26 | 236 | unsafe { mem::transmute(self) } | ^^^^^^^^^^^^^^^^^^^^ | ::: src/point.rs:364:1 | 364 | impl_tuple_conversions!(Point3 { x, y, z }, (S, S, S)); | --------------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:250:26 warning: transmute from `&(S, S, S)` which has an undefined layout --> src/macros.rs:250:26 | 250 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | ::: src/point.rs:364:1 | 364 | impl_tuple_conversions!(Point3 { x, y, z }, (S, S, S)); | --------------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> cgmath-0.18.0/src/macros.rs:257:26 warning: transmute from `&mut (S, S, S)` which has an undefined layout --> src/macros.rs:257:26 | 257 | unsafe { mem::transmute(v) } | ^^^^^^^^^^^^^^^^^ | ::: src/point.rs:364:1 | 364 | impl_tuple_conversions!(Point3 { x, y, z }, (S, S, S)); | --------------------------------------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `impl_tuple_conversions` (in Nightly builds, run with -Z macro-backtrace for more info) ---> criterion-0.3.5/src/stats/univariate/resamples.rs:55:22 warning: transmute from `&std::vec::Vec` which has an undefined layout --> src/stats/univariate/resamples.rs:55:22 | 55 | unsafe { mem::transmute::<&[_], _>(v) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: requested on the command line with `-W clippy::transmute-undefined-repr` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> iovec-0.1.4/src/sys/unix.rs:26:9 warning: transmute from `&[u8]` which has an undefined layout --> src/sys/unix.rs:26:9 | 26 | mem::transmute(&self.inner) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: requested on the command line with `-W clippy::transmute-undefined-repr` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> iovec-0.1.4/src/sys/unix.rs:34:13 warning: transmute to `&sys::unix::IoVec` which has an undefined layout --> src/sys/unix.rs:34:13 | 34 | / mem::transmute(libc::iovec { 35 | | iov_base: src.as_ptr() as *mut _, 36 | | iov_len: src.len(), 37 | | }) | |______________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> iovec-0.1.4/src/sys/unix.rs:46:13 warning: transmute to `&mut sys::unix::IoVec` which has an undefined layout --> src/sys/unix.rs:46:13 | 46 | / mem::transmute(libc::iovec { 47 | | iov_base: src.as_ptr() as *mut _, 48 | | iov_len: src.len(), 49 | | }) | |______________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> nalgebra-0.30.1/src/linalg/svd.rs:137:48 warning: transmute from `&linalg::svd::SVD<::RealField, base::dimension::Const<2_usize>, base::dimension::Const<2_usize>>` to `&linalg::svd::SVD`, both of which have an undefined layout --> src/linalg/svd.rs:137:48 | 137 | let typed_result: &Self = unsafe { std::mem::transmute(&result) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: requested on the command line with `-W clippy::transmute-undefined-repr` = note: two instances of the same generic type (`SVD`) may have different layouts = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> nalgebra-0.30.1/src/linalg/svd.rs:143:48 warning: transmute into `&linalg::svd::SVD` which has an undefined layout --> src/linalg/svd.rs:143:48 | 143 | let typed_result: &Self = unsafe { std::mem::transmute(&result) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> parity-scale-codec-3.0.0/src/codec.rs:774:17 warning: transmute from `std::vec::Vec` to `std::vec::Vec`, both of which have an undefined layout --> src/codec.rs:774:17 | 774 | Ok(unsafe { mem::transmute::, Vec>(vec) }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 781 | / with_type_info! { 782 | | ::TYPE_INFO, 783 | | decode(input, len), 784 | | { 785 | | decode_unoptimized(input, len) 786 | | }, 787 | | } | |_____- in this macro invocation | = note: requested on the command line with `-W clippy::transmute-undefined-repr` = note: two instances of the same generic type (`Vec`) may have different layouts = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `decode` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:774:17 warning: transmute from `std::vec::Vec` to `std::vec::Vec`, both of which have an undefined layout --> src/codec.rs:774:17 | 774 | Ok(unsafe { mem::transmute::, Vec>(vec) }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 781 | / with_type_info! { 782 | | ::TYPE_INFO, 783 | | decode(input, len), 784 | | { 785 | | decode_unoptimized(input, len) 786 | | }, 787 | | } | |_____- in this macro invocation | = note: two instances of the same generic type (`Vec`) may have different layouts = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `decode` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:774:17 warning: transmute from `std::vec::Vec` to `std::vec::Vec`, both of which have an undefined layout --> src/codec.rs:774:17 | 774 | Ok(unsafe { mem::transmute::, Vec>(vec) }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 781 | / with_type_info! { 782 | | ::TYPE_INFO, 783 | | decode(input, len), 784 | | { 785 | | decode_unoptimized(input, len) 786 | | }, 787 | | } | |_____- in this macro invocation | = note: two instances of the same generic type (`Vec`) may have different layouts = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `decode` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:774:17 warning: transmute from `std::vec::Vec` to `std::vec::Vec`, both of which have an undefined layout --> src/codec.rs:774:17 | 774 | Ok(unsafe { mem::transmute::, Vec>(vec) }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 781 | / with_type_info! { 782 | | ::TYPE_INFO, 783 | | decode(input, len), 784 | | { 785 | | decode_unoptimized(input, len) 786 | | }, 787 | | } | |_____- in this macro invocation | = note: two instances of the same generic type (`Vec`) may have different layouts = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `decode` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:774:17 warning: transmute from `std::vec::Vec` to `std::vec::Vec`, both of which have an undefined layout --> src/codec.rs:774:17 | 774 | Ok(unsafe { mem::transmute::, Vec>(vec) }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 781 | / with_type_info! { 782 | | ::TYPE_INFO, 783 | | decode(input, len), 784 | | { 785 | | decode_unoptimized(input, len) 786 | | }, 787 | | } | |_____- in this macro invocation | = note: two instances of the same generic type (`Vec`) may have different layouts = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `decode` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:774:17 warning: transmute from `std::vec::Vec` to `std::vec::Vec`, both of which have an undefined layout --> src/codec.rs:774:17 | 774 | Ok(unsafe { mem::transmute::, Vec>(vec) }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 781 | / with_type_info! { 782 | | ::TYPE_INFO, 783 | | decode(input, len), 784 | | { 785 | | decode_unoptimized(input, len) 786 | | }, 787 | | } | |_____- in this macro invocation | = note: two instances of the same generic type (`Vec`) may have different layouts = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `decode` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:774:17 warning: transmute from `std::vec::Vec` to `std::vec::Vec`, both of which have an undefined layout --> src/codec.rs:774:17 | 774 | Ok(unsafe { mem::transmute::, Vec>(vec) }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 781 | / with_type_info! { 782 | | ::TYPE_INFO, 783 | | decode(input, len), 784 | | { 785 | | decode_unoptimized(input, len) 786 | | }, 787 | | } | |_____- in this macro invocation | = note: two instances of the same generic type (`Vec`) may have different layouts = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `decode` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:774:17 warning: transmute from `std::vec::Vec` to `std::vec::Vec`, both of which have an undefined layout --> src/codec.rs:774:17 | 774 | Ok(unsafe { mem::transmute::, Vec>(vec) }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 781 | / with_type_info! { 782 | | ::TYPE_INFO, 783 | | decode(input, len), 784 | | { 785 | | decode_unoptimized(input, len) 786 | | }, 787 | | } | |_____- in this macro invocation | = note: two instances of the same generic type (`Vec`) may have different layouts = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `decode` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:774:17 warning: transmute from `std::vec::Vec` to `std::vec::Vec`, both of which have an undefined layout --> src/codec.rs:774:17 | 774 | Ok(unsafe { mem::transmute::, Vec>(vec) }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 781 | / with_type_info! { 782 | | ::TYPE_INFO, 783 | | decode(input, len), 784 | | { 785 | | decode_unoptimized(input, len) 786 | | }, 787 | | } | |_____- in this macro invocation | = note: two instances of the same generic type (`Vec`) may have different layouts = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `decode` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:774:17 warning: transmute from `std::vec::Vec` to `std::vec::Vec`, both of which have an undefined layout --> src/codec.rs:774:17 | 774 | Ok(unsafe { mem::transmute::, Vec>(vec) }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 781 | / with_type_info! { 782 | | ::TYPE_INFO, 783 | | decode(input, len), 784 | | { 785 | | decode_unoptimized(input, len) 786 | | }, 787 | | } | |_____- in this macro invocation | = note: two instances of the same generic type (`Vec`) may have different layouts = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `decode` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:1041:7 warning: transmute from `(&[T], &[T])` to `(&[u8], &[u8])`, both of which have an undefined layout --> src/codec.rs:1041:7 | 1041 | core::mem::transmute::<(&[T], &[T]), (&[$ty], &[$ty])>(slices) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 1054 | / with_type_info! { 1055 | | ::TYPE_INFO, 1056 | | encode_to(self, dest), 1057 | | { ... | 1061 | | }, 1062 | | } | |_________- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `encode_to` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:1041:7 warning: transmute from `(&[T], &[T])` to `(&[i8], &[i8])`, both of which have an undefined layout --> src/codec.rs:1041:7 | 1041 | core::mem::transmute::<(&[T], &[T]), (&[$ty], &[$ty])>(slices) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 1054 | / with_type_info! { 1055 | | ::TYPE_INFO, 1056 | | encode_to(self, dest), 1057 | | { ... | 1061 | | }, 1062 | | } | |_________- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `encode_to` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:1041:7 warning: transmute from `(&[T], &[T])` to `(&[u16], &[u16])`, both of which have an undefined layout --> src/codec.rs:1041:7 | 1041 | core::mem::transmute::<(&[T], &[T]), (&[$ty], &[$ty])>(slices) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 1054 | / with_type_info! { 1055 | | ::TYPE_INFO, 1056 | | encode_to(self, dest), 1057 | | { ... | 1061 | | }, 1062 | | } | |_________- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `encode_to` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:1041:7 warning: transmute from `(&[T], &[T])` to `(&[i16], &[i16])`, both of which have an undefined layout --> src/codec.rs:1041:7 | 1041 | core::mem::transmute::<(&[T], &[T]), (&[$ty], &[$ty])>(slices) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 1054 | / with_type_info! { 1055 | | ::TYPE_INFO, 1056 | | encode_to(self, dest), 1057 | | { ... | 1061 | | }, 1062 | | } | |_________- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `encode_to` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:1041:7 warning: transmute from `(&[T], &[T])` to `(&[u32], &[u32])`, both of which have an undefined layout --> src/codec.rs:1041:7 | 1041 | core::mem::transmute::<(&[T], &[T]), (&[$ty], &[$ty])>(slices) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 1054 | / with_type_info! { 1055 | | ::TYPE_INFO, 1056 | | encode_to(self, dest), 1057 | | { ... | 1061 | | }, 1062 | | } | |_________- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `encode_to` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:1041:7 warning: transmute from `(&[T], &[T])` to `(&[i32], &[i32])`, both of which have an undefined layout --> src/codec.rs:1041:7 | 1041 | core::mem::transmute::<(&[T], &[T]), (&[$ty], &[$ty])>(slices) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 1054 | / with_type_info! { 1055 | | ::TYPE_INFO, 1056 | | encode_to(self, dest), 1057 | | { ... | 1061 | | }, 1062 | | } | |_________- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `encode_to` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:1041:7 warning: transmute from `(&[T], &[T])` to `(&[u64], &[u64])`, both of which have an undefined layout --> src/codec.rs:1041:7 | 1041 | core::mem::transmute::<(&[T], &[T]), (&[$ty], &[$ty])>(slices) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 1054 | / with_type_info! { 1055 | | ::TYPE_INFO, 1056 | | encode_to(self, dest), 1057 | | { ... | 1061 | | }, 1062 | | } | |_________- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `encode_to` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:1041:7 warning: transmute from `(&[T], &[T])` to `(&[i64], &[i64])`, both of which have an undefined layout --> src/codec.rs:1041:7 | 1041 | core::mem::transmute::<(&[T], &[T]), (&[$ty], &[$ty])>(slices) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 1054 | / with_type_info! { 1055 | | ::TYPE_INFO, 1056 | | encode_to(self, dest), 1057 | | { ... | 1061 | | }, 1062 | | } | |_________- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `encode_to` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:1041:7 warning: transmute from `(&[T], &[T])` to `(&[u128], &[u128])`, both of which have an undefined layout --> src/codec.rs:1041:7 | 1041 | core::mem::transmute::<(&[T], &[T]), (&[$ty], &[$ty])>(slices) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 1054 | / with_type_info! { 1055 | | ::TYPE_INFO, 1056 | | encode_to(self, dest), 1057 | | { ... | 1061 | | }, 1062 | | } | |_________- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `encode_to` (in Nightly builds, run with -Z macro-backtrace for more info) ---> parity-scale-codec-3.0.0/src/codec.rs:1041:7 warning: transmute from `(&[T], &[T])` to `(&[i128], &[i128])`, both of which have an undefined layout --> src/codec.rs:1041:7 | 1041 | core::mem::transmute::<(&[T], &[T]), (&[$ty], &[$ty])>(slices) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 1054 | / with_type_info! { 1055 | | ::TYPE_INFO, 1056 | | encode_to(self, dest), 1057 | | { ... | 1061 | | }, 1062 | | } | |_________- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `encode_to` (in Nightly builds, run with -Z macro-backtrace for more info) ---> prettytable-rs-0.8.0/src/lib.rs:505:13 warning: transmute from `&Table` to `&TableSlice`, both of which have an undefined layout --> src/lib.rs:505:13 | 505 | transmute(self) | ^^^^^^^^^^^^^^^ | = note: requested on the command line with `-W clippy::transmute-undefined-repr` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> state-0.5.2/src/container.rs:205:18 warning: transmute from `*mut dyn std::any::Any` which has an undefined layout --> src/container.rs:205:18 | 205 | unsafe { std::mem::transmute(any) } | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: requested on the command line with `-W clippy::transmute-undefined-repr` = note: the contained type `&dyn std::any::Any` has an undefined layout = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> wasm-bindgen-0.2.79/src/convert/closures.rs:19:50 warning: transmute from `&dyn core::ops::Fn() -> R` which has an undefined layout --> src/convert/closures.rs:19:50 | 19 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = note: requested on the command line with `-W clippy::transmute-undefined-repr` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:37:50 warning: transmute to `&dyn core::ops::Fn() -> R` which has an undefined layout --> src/convert/closures.rs:37:50 | 37 | let f: &dyn Fn($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:68:50 warning: transmute from `&mut dyn core::ops::FnMut() -> R` which has an undefined layout --> src/convert/closures.rs:68:50 | 68 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:86:57 warning: transmute to `&mut dyn core::ops::FnMut() -> R` which has an undefined layout --> src/convert/closures.rs:86:57 | 86 | let f: &mut dyn FnMut($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:19:50 warning: transmute from `&dyn core::ops::Fn(A) -> R` which has an undefined layout --> src/convert/closures.rs:19:50 | 19 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:37:50 warning: transmute to `&dyn core::ops::Fn(A) -> R` which has an undefined layout --> src/convert/closures.rs:37:50 | 37 | let f: &dyn Fn($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:68:50 warning: transmute from `&mut dyn core::ops::FnMut(A) -> R` which has an undefined layout --> src/convert/closures.rs:68:50 | 68 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:86:57 warning: transmute to `&mut dyn core::ops::FnMut(A) -> R` which has an undefined layout --> src/convert/closures.rs:86:57 | 86 | let f: &mut dyn FnMut($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:19:50 warning: transmute from `&dyn core::ops::Fn(A, B) -> R` which has an undefined layout --> src/convert/closures.rs:19:50 | 19 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:37:50 warning: transmute to `&dyn core::ops::Fn(A, B) -> R` which has an undefined layout --> src/convert/closures.rs:37:50 | 37 | let f: &dyn Fn($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:68:50 warning: transmute from `&mut dyn core::ops::FnMut(A, B) -> R` which has an undefined layout --> src/convert/closures.rs:68:50 | 68 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:86:57 warning: transmute to `&mut dyn core::ops::FnMut(A, B) -> R` which has an undefined layout --> src/convert/closures.rs:86:57 | 86 | let f: &mut dyn FnMut($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:19:50 warning: transmute from `&dyn core::ops::Fn(A, B, C) -> R` which has an undefined layout --> src/convert/closures.rs:19:50 | 19 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:37:50 warning: transmute to `&dyn core::ops::Fn(A, B, C) -> R` which has an undefined layout --> src/convert/closures.rs:37:50 | 37 | let f: &dyn Fn($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:68:50 warning: transmute from `&mut dyn core::ops::FnMut(A, B, C) -> R` which has an undefined layout --> src/convert/closures.rs:68:50 | 68 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:86:57 warning: transmute to `&mut dyn core::ops::FnMut(A, B, C) -> R` which has an undefined layout --> src/convert/closures.rs:86:57 | 86 | let f: &mut dyn FnMut($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:19:50 warning: transmute from `&dyn core::ops::Fn(A, B, C, D) -> R` which has an undefined layout --> src/convert/closures.rs:19:50 | 19 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:37:50 warning: transmute to `&dyn core::ops::Fn(A, B, C, D) -> R` which has an undefined layout --> src/convert/closures.rs:37:50 | 37 | let f: &dyn Fn($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:68:50 warning: transmute from `&mut dyn core::ops::FnMut(A, B, C, D) -> R` which has an undefined layout --> src/convert/closures.rs:68:50 | 68 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:86:57 warning: transmute to `&mut dyn core::ops::FnMut(A, B, C, D) -> R` which has an undefined layout --> src/convert/closures.rs:86:57 | 86 | let f: &mut dyn FnMut($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:19:50 warning: transmute from `&dyn core::ops::Fn(A, B, C, D, E) -> R` which has an undefined layout --> src/convert/closures.rs:19:50 | 19 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:37:50 warning: transmute to `&dyn core::ops::Fn(A, B, C, D, E) -> R` which has an undefined layout --> src/convert/closures.rs:37:50 | 37 | let f: &dyn Fn($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:68:50 warning: transmute from `&mut dyn core::ops::FnMut(A, B, C, D, E) -> R` which has an undefined layout --> src/convert/closures.rs:68:50 | 68 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:86:57 warning: transmute to `&mut dyn core::ops::FnMut(A, B, C, D, E) -> R` which has an undefined layout --> src/convert/closures.rs:86:57 | 86 | let f: &mut dyn FnMut($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:19:50 warning: transmute from `&dyn core::ops::Fn(A, B, C, D, E, F) -> R` which has an undefined layout --> src/convert/closures.rs:19:50 | 19 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:37:50 warning: transmute to `&dyn core::ops::Fn(A, B, C, D, E, F) -> R` which has an undefined layout --> src/convert/closures.rs:37:50 | 37 | let f: &dyn Fn($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:68:50 warning: transmute from `&mut dyn core::ops::FnMut(A, B, C, D, E, F) -> R` which has an undefined layout --> src/convert/closures.rs:68:50 | 68 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:86:57 warning: transmute to `&mut dyn core::ops::FnMut(A, B, C, D, E, F) -> R` which has an undefined layout --> src/convert/closures.rs:86:57 | 86 | let f: &mut dyn FnMut($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:19:50 warning: transmute from `&dyn core::ops::Fn(A, B, C, D, E, F, G) -> R` which has an undefined layout --> src/convert/closures.rs:19:50 | 19 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:37:50 warning: transmute to `&dyn core::ops::Fn(A, B, C, D, E, F, G) -> R` which has an undefined layout --> src/convert/closures.rs:37:50 | 37 | let f: &dyn Fn($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:68:50 warning: transmute from `&mut dyn core::ops::FnMut(A, B, C, D, E, F, G) -> R` which has an undefined layout --> src/convert/closures.rs:68:50 | 68 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:86:57 warning: transmute to `&mut dyn core::ops::FnMut(A, B, C, D, E, F, G) -> R` which has an undefined layout --> src/convert/closures.rs:86:57 | 86 | let f: &mut dyn FnMut($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:19:50 warning: transmute from `&dyn core::ops::Fn(A, B, C, D, E, F, G, H) -> R` which has an undefined layout --> src/convert/closures.rs:19:50 | 19 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:37:50 warning: transmute to `&dyn core::ops::Fn(A, B, C, D, E, F, G, H) -> R` which has an undefined layout --> src/convert/closures.rs:37:50 | 37 | let f: &dyn Fn($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:68:50 warning: transmute from `&mut dyn core::ops::FnMut(A, B, C, D, E, F, G, H) -> R` which has an undefined layout --> src/convert/closures.rs:68:50 | 68 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:86:57 warning: transmute to `&mut dyn core::ops::FnMut(A, B, C, D, E, F, G, H) -> R` which has an undefined layout --> src/convert/closures.rs:86:57 | 86 | let f: &mut dyn FnMut($($var),*) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ ... 111 | / stack_closures! { 112 | | (0 invoke0 invoke0_mut) 113 | | (1 invoke1 invoke1_mut A) 114 | | (2 invoke2 invoke2_mut A B) ... | 120 | | (8 invoke8 invoke8_mut A B C D E F G H) 121 | | } | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr = note: this warning originates in the macro `stack_closures` (in Nightly builds, run with -Z macro-backtrace for more info) ---> wasm-bindgen-0.2.79/src/convert/closures.rs:132:42 warning: transmute from `&dyn for<'r> core::ops::Fn(&'r A) -> R` which has an undefined layout --> src/convert/closures.rs:132:42 | 132 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> wasm-bindgen-0.2.79/src/convert/closures.rs:153:35 warning: transmute to `&dyn for<'r> core::ops::Fn(&'r A) -> R` which has an undefined layout --> src/convert/closures.rs:153:35 | 153 | let f: &dyn Fn(&A) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> wasm-bindgen-0.2.79/src/convert/closures.rs:184:42 warning: transmute from `&mut dyn for<'r> core::ops::FnMut(&'r A) -> R` which has an undefined layout --> src/convert/closures.rs:184:42 | 184 | let (a, b): (usize, usize) = mem::transmute(self); | ^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ---> wasm-bindgen-0.2.79/src/convert/closures.rs:205:42 warning: transmute to `&mut dyn for<'r> core::ops::FnMut(&'r A) -> R` which has an undefined layout --> src/convert/closures.rs:205:42 | 205 | let f: &mut dyn FnMut(&A) -> R = mem::transmute((a, b)); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_undefined_repr ```
llogiq commented 2 years ago

The criterion error seems to indicate that the lint fails to apply type adjustments – in this case from &Vec<T> to &[T] as indicated by the first generic argument of the transmute call. If I replace v (which is of type &Vec<_> by &v[..], the lint no longer fires.

Manishearth commented 2 years ago

sounds like we should at the very least be using the inferred or provided generic arguments of transmute instead of reading the expression types

llogiq commented 2 years ago

I opened #8501 to track this.

Jarcho commented 2 years ago

Just went through all them.

  • cgmath is relying on the order of tuple fields.
  • criterion is a bug. Probably used expr_ty instead of expr_ty_adjusted.
  • iovec is relying on the order of slice pointers.
  • nalgebra is fine, it's checking the TypeId of the generic types first.
  • parity-scale-codec is the same as nalgebra.
  • prettytable is between two non-repr(C) types.
  • state is fine. It doesn't read either of the fields, but the names for the fields are useless.
  • wasm-bindgen looks to be the same as state, but using tuples instead of a struct.

For both wasm-bindgen and state would not have triggered if they used [usize; 2]. (usize, usize) could be allowed here as well. state uses a struct so there's nothing to really do there.

parity-scale-codec really should be using a trait instead of transmuting. nalgebra could probably do that, but would be more complicated. (this would need specialization to work, so not practical)

Jarcho commented 2 years ago

With the recent changes both nalgebra and state are still false positives.

  • nalgebra still needs to be fixed not to lint.
  • state I don't think should be fixed given that the fields are named. Were the struct to be declared as #[repr(C)] struct AnyObject([usize;2]) then it would not lint.
Jarcho commented 2 years ago

Results on running on more crates https://gist.github.com/Jarcho/6890efe9c9f051aef943f1dedbbbb02d

True positives

vsdb-0.45.2: Transmute between different Vec instances sxd-document-0.3.2: Relies on the order of &str utf8-cstr-0.1.6: Relies on the order of &str hyper-old-types-0.11.0: Relies on the order of &dyn Trait serde_v8-0.56.0: Relies on the order of non-repr(C) structs query_interface-0.3.5: Relies on the order of &dyn Trait solana_rbpf-0.2.31: Relies on the order of &dyn Trait and the vtable layout fontdue-0.7.2: Relies on the layout of tuples (f32, f32, f32, f32) str-buf-3.0.1: Relies on the &[u8], but it at least has a test for it. Not guarenteed on the target platform, but better than nothing rusty_v8-0.32.1: Relies on the layout of &dyn Trait. Has a runtime assert checking the layout. iovec-0.1.4: Relies on the layout of &[u8] libpulse-binding-2.26.0: Relies on the layout of a non-repr(C) struct. adapton-0.3.31: Relies on the layout of &dyn Trait. It also manages to leak memory by transmuting Box<&dyn Trait> into &Box<U>, with no way to deallocate the original box. v8-0.48.0: same as rusty_v8

False positives

parity-scale-codec-3.1.5: Type parameter -> concrete type lodepng-3.7.0: Horrible &mut *mut u8 -> &mut &mut Vec which is un-erasing the type. (Won't lint with #9287) skia-safe: Transmutes between &dyn Trait and a struct, but doesn't read the fields. state-0.5.3: Same as skia-safe. Uses a custom struct but doesn't read the fields. *fluent-bundle-0.15.2: Cast NonNull<u8> from alloc to `NonNull. (Fixed with #9287)


Most of those are related to fat pointer layouts, which as far as I know are still formally undefined. The Unsafe Code Guidelines Working Group has them defined well enough for most of these transmutes, but should that be considered enough to ignore these cases?