Skip to content

Commit

Permalink
Correct tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tyranron committed Jul 14, 2023
1 parent 6898e00 commit 08d35f5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/compile_fail/into/tuple_no_parens.stderr
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tests/compile_fail/into/tuple_too_long.stderr
Original file line number Diff line number Diff line change
@@ -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))]
Expand Down
2 changes: 1 addition & 1 deletion tests/compile_fail/into/tuple_too_short.stderr
Original file line number Diff line number Diff line change
@@ -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,))]
Expand Down
8 changes: 5 additions & 3 deletions tests/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, To>(from: From) -> To {
use core::mem;

let to = unsafe { mem::transmute_copy(&from) };
mem::forget(from);
to
Expand Down

0 comments on commit 08d35f5

Please sign in to comment.