File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
compiler/rustc_error_codes/src/error_codes Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -62,14 +62,14 @@ This pattern should be rewritten. There are a few possible ways to do this:
6262 and do the cast in the fn body (the preferred option)
6363- cast the fn item of a fn pointer before calling transmute, as shown here:
6464
65- ```
66- # extern "C" fn foo(_: Box<i32>) {}
67- # use std::mem::transmute;
68- # unsafe {
69- let f: extern "C" fn(*mut i32) = transmute(foo as extern "C" fn(_));
70- let f: extern "C" fn(*mut i32) = transmute(foo as usize); // works too
71- # }
72- ```
65+ ```
66+ # extern "C" fn foo(_: Box<i32>) {}
67+ # use std::mem::transmute;
68+ # unsafe {
69+ let f: extern "C" fn(*mut i32) = transmute(foo as extern "C" fn(_));
70+ let f: extern "C" fn(*mut i32) = transmute(foo as usize); // works too
71+ # }
72+ ```
7373
7474The same applies to transmutes to ` *mut fn() ` , which were observed in practice.
7575Note though that use of this type is generally incorrect.
Original file line number Diff line number Diff line change @@ -56,10 +56,10 @@ This pattern should be rewritten. There are a few possible ways to do this:
5656 and do the cast in the fn body (the preferred option)
5757- cast the fn item of a fn pointer before calling transmute, as shown here:
5858
59- ```
60- let f: extern "C" fn(*mut i32) = transmute(foo as extern "C" fn(_));
61- let f: extern "C" fn(*mut i32) = transmute(foo as usize); // works too
62- ```
59+ ```
60+ let f: extern "C" fn(*mut i32) = transmute(foo as extern "C" fn(_));
61+ let f: extern "C" fn(*mut i32) = transmute(foo as usize); // works too
62+ ```
6363
6464The same applies to transmutes to `*mut fn()`, which were observed in practice.
6565Note though that use of this type is generally incorrect.
You can’t perform that action at this time.
0 commit comments