Skip to content

Commit

Permalink
remove static bounds on transmute
Browse files Browse the repository at this point in the history
  • Loading branch information
Creative0708 committed Feb 20, 2024
1 parent efc68c2 commit f67deb2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/transmute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/// Then, we overwrite the dummy variable with a `DummyEnum::A(Some(<...>))` with the object we want to transmute.
/// Finally, we take the `Box<A>`, interpreted as a `Box<B>`, out of the dangling reference and we've transmuted our data!
///
pub fn transmute<A: 'static, B: 'static>(obj: A) -> B {
pub fn transmute<A, B>(obj: A) -> B {
use std::hint::black_box;

// The layout of `DummyEnum` is approximately
Expand All @@ -36,7 +36,7 @@ pub fn transmute<A: 'static, B: 'static>(obj: A) -> B {
}

#[inline(never)]
fn transmute_inner<A: 'static, B: 'static>(dummy: &mut DummyEnum<A, B>, obj: A) -> B {
fn transmute_inner<A, B>(dummy: &mut DummyEnum<A, B>, obj: A) -> B {
let DummyEnum::B(ref_to_b) = dummy else {
unreachable!()
};
Expand Down

0 comments on commit f67deb2

Please sign in to comment.