commit
1f734250c5
|
@ -99,7 +99,8 @@ fn foo() -> i32 {
|
||||||
fn main() {
|
fn main() {
|
||||||
let pointer = foo as *const ();
|
let pointer = foo as *const ();
|
||||||
let function = unsafe {
|
let function = unsafe {
|
||||||
std::mem::transmute::<*const (), fn() -> i32>(pointer)
|
std::mem::transmute::<*const (), fn() -> i32>(pointer)
|
||||||
|
};
|
||||||
assert_eq!(function(), 0);
|
assert_eq!(function(), 0);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -100,7 +100,8 @@ fn foo() -> i32 {
|
||||||
fn main() {
|
fn main() {
|
||||||
let pointer = foo as *const ();
|
let pointer = foo as *const ();
|
||||||
let function = unsafe {
|
let function = unsafe {
|
||||||
std::mem::transmute::<*const (), fn() -> i32>(pointer)
|
std::mem::transmute::<*const (), fn() -> i32>(pointer)
|
||||||
|
};
|
||||||
assert_eq!(function(), 0);
|
assert_eq!(function(), 0);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue