-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect const-ness on CString::new argument #18117
Comments
Because However I also felt unconfortable with My idea is naming them |
@nodokai I had already written the patch when I read your comment so I went with |
This was since resolved in #20507 |
fix: Always cache macro expansions' root node in Semantics Previously some expansions were not cached, but were cached in the expansion cache, which caused panics when later queries tried to lookup the node from the expansion cache. Fixes rust-lang#18089.
The signature of
CString::new
isCString::new(buf: *const i8, owns_buffer: bool)
. The problem with this is that if the newCString
does own the buffer it's going to free it. In which casebuf
should be a*mut i8
not a*const i8
. However makingbuf: *mut i8
doesn't account for the case where theCString
doesn't own the buffer and the buffer is immutable.To fix this
CString::new
should be split into two functions:The text was updated successfully, but these errors were encountered: