Skip to content

Commit b01df8e

Browse files
bvssvnibrendanzab
authored andcommitted
Upgrade to latest rust (DANGEROUS)
Closes #76 Notice the transmute is replaced by direct casting by pointers. I do not know how this affects the usage of the library. I left the ‘unused import’ warning on in case this can be fixed later. If this is critical, I would recommend doing an analysis and document which uses cases one should be careful. Conflicts: src/gen/main.rs
1 parent 686b995 commit b01df8e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/gen/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl<'a, W: Writer> Generator<'a, W> {
286286
self.write_line(" pub fn new(ptr: Option<extern \"system\" fn()>, failing_fn: F) -> FnPtr<F> {");
287287
self.write_line(" use std::mem::transmute;");
288288
self.write_line(" match ptr {");
289-
self.write_line(" std::option::Some(p) => FnPtr { f: unsafe { transmute(p) }, is_loaded: true },");
289+
self.write_line(" std::option::Some(p) => FnPtr { f: unsafe { std::ptr::read(&p as *_ as *F) }, is_loaded: true },");
290290
self.write_line(" None => FnPtr { f: failing_fn, is_loaded: false },");
291291
self.write_line(" }");
292292
self.write_line(" }");

0 commit comments

Comments
 (0)