diff --git a/tests/compile_fail/into/tuple_no_parens.stderr b/tests/compile_fail/into/tuple_no_parens.stderr index 4b079463..9be31ca3 100644 --- a/tests/compile_fail/into/tuple_no_parens.stderr +++ b/tests/compile_fail/into/tuple_no_parens.stderr @@ -1,4 +1,4 @@ -error: Expected tuple: `(i16, _)` +error: expected tuple: `(i16, _)` --> tests/compile_fail/into/tuple_no_parens.rs:2:8 | 2 | #[into(i16, i16)] diff --git a/tests/compile_fail/into/tuple_too_long.stderr b/tests/compile_fail/into/tuple_too_long.stderr index a4d72ee6..57033a5e 100644 --- a/tests/compile_fail/into/tuple_too_long.stderr +++ b/tests/compile_fail/into/tuple_too_long.stderr @@ -1,4 +1,4 @@ -error: Wrong tuple length: expected 2, found 3. Consider removing last 1 type: `(i16, i16)` +error: wrong tuple length: expected 2, found 3. Consider removing last 1 type: `(i16, i16)` --> tests/compile_fail/into/tuple_too_long.rs:2:8 | 2 | #[into((i16, i16, i16))] diff --git a/tests/compile_fail/into/tuple_too_short.stderr b/tests/compile_fail/into/tuple_too_short.stderr index a60529cc..0e685453 100644 --- a/tests/compile_fail/into/tuple_too_short.stderr +++ b/tests/compile_fail/into/tuple_too_short.stderr @@ -1,4 +1,4 @@ -error: Wrong tuple length: expected 2, found 1. Consider adding 1 more type: `(i16, _)` +error: wrong tuple length: expected 2, found 1. Consider adding 1 more type: `(i16, _)` --> tests/compile_fail/into/tuple_too_short.rs:2:8 | 2 | #[into((i16,))] diff --git a/tests/into.rs b/tests/into.rs index 063a5a6f..95799d2f 100644 --- a/tests/into.rs +++ b/tests/into.rs @@ -11,16 +11,18 @@ use alloc::{ boxed::Box, string::{String, ToString}, }; +use core::mem; #[cfg(feature = "std")] use std::borrow::Cow; use derive_more::Into; use static_assertions::assert_not_impl_any; -/// [`mem::transmute()`] that works in generic contexts. +/// Nasty [`mem::transmute()`] that works in generic contexts +/// by [`mem::forget`]ing stuff. +/// +/// It's OK for tests! unsafe fn transmute(from: From) -> To { - use core::mem; - let to = unsafe { mem::transmute_copy(&from) }; mem::forget(from); to