Conversation
|
I think this is a nice improvement, maybe we can also change the docs to take It might also make sense to change the E.g. something like impl PyMethodDef {
fn set_name(&mut self, name: &str) -> Result<()> {
let name = CString::new(name)?;
self.name = name;
Ok(())
}
} |
It must be static and we cannot do so. |
455687e to
9e969c4
Compare
|
We can allocate a |
|
Probably we can, but it would require lots of refactoring. |
|
Now I want to investigate some other solutions. E.g., pub struct PyMethodDef {
pub ml_name: CString,
}So I leave this PR unmerged for two or three days (it looks that I did too much OSS work this week and I have to do some research works as a student...) |
|
UPDATED |
|
@davidhewitt |
|
And I'm sorry that this PR contains many changes to make fields of |
davidhewitt
left a comment
There was a problem hiding this comment.
LGTM; I think Vec is fine here. Maybe slightly less optimal but it's one-time-setup anyway and the safety is a huge plus. Maybe one day it'll be possible to do this with const fn 🤷
I guess with the removal of public fields this is technically a breaking change, so maybe let's merge this and abandon the idea of making a 0.12.2 patch release? We can proceed with iterating on improvements for 0.13.
|
(Also this could probably benefit from a CHANGELOG entry static that it fixes #1211 ) |
Hmm... I'm not sure we should treat this as public API 🤔 |
| )); | ||
| } | ||
| let transparent = attrs.iter().any(ContainerAttribute::transparent); | ||
| let transparent = attrs |
There was a problem hiding this comment.
Changes here are unrelated?
There was a problem hiding this comment.
I did for address clippy warnings.
There was a problem hiding this comment.
Although clippy only asked to replace the implementation with matches!(), no?
There was a problem hiding this comment.
Yeah, but since we support MSRV(1.39), we cannot use macthes.
|
@sebpuetz |
Should we maybe be marking |
|
I made them |
|
👍 anything else you want to change in this PR before it merges? I will release |
|
No, I think it's ready |

We have a feature that extracts Python's doc string from doc comments in proc-macro code.
In the related parts, I found all of the code assumes that the corresponding document is null-terminated and does not check that.
This can make it difficult to debug our proc-macro code when it produces not null-terminated doc by accident, so I added a check using
CStr.