Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upUpgrade hoedown to 3.0.4 #27945
Conversation
rust-highfive
assigned
brson
Aug 22, 2015
This comment has been minimized.
This comment has been minimized.
|
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
tamird
reviewed
Aug 22, 2015
| @@ -68,49 +67,60 @@ const HOEDOWN_EXTENSIONS: libc::c_uint = | |||
| type hoedown_document = libc::c_void; // this is opaque to us | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
daboross
Aug 24, 2015
Contributor
Isn't c_void basically an empty enum? I mean I guess it's represented in hardware by a u8, but what does the difference make?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
alexcrichton
Aug 24, 2015
Member
The actual representation or whether this can be constructed isn't so much the problem here, but rather *mut hoedown_document and *mut c_void are the same types. In Rust it's more idiomatic to have those be separate types (to get at least some level of type safety). Creating an empty enum (enum hoedown_document {}) should serve this purpose
tamird
reviewed
Aug 22, 2015
|
|
||
| #[repr(C)] | ||
| struct hoedown_renderer_data { | ||
| opaque: *mut libc::c_void, |
This comment has been minimized.
This comment has been minimized.
tamird
Aug 22, 2015
Contributor
opaque should probably also be an empty enum, but that might be more work
This comment has been minimized.
This comment has been minimized.
rkruppe
Aug 23, 2015
Member
It's a void * in the C code as well, so I think this is fine (or even more appropriate, since pointers to empty enums aren't represented as *i8 in LLVM, while *mut c_void is).
tamird
reviewed
Aug 22, 2015
| #[repr(C)] | ||
| struct hoedown_renderer_data { | ||
| opaque: *mut libc::c_void, | ||
| } | ||
|
|
||
| #[repr(C)] | ||
| struct hoedown_renderer { | ||
| opaque: *mut libc::c_void, |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Changed Adding any kind of type safety to the other void pointers is non-trivial because they point to different types in different passes. A lot of this module is very unsafe/hacky but hopefully we can replace it all with a pure rust Markdown parser at some point anyway! |
Eljay commentedAug 22, 2015
Some hoedown FFI changes:
HOEDOWN_EXT_NO_INTRA_EMPHASISconstant changed.hoedown_renderer_data).This also fixes #27862.