-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Implement Default
for raw pointers
#139535
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
Conversation
Implementation looks good to me, cc @rust-lang/libs-api for FCP consideration. @rustbot label +I-libs-api-nominated |
@rfcbot merge |
Team member @Amanieu has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
Something I only thought of now, despite commenting on the ACP: What are the trade-offs compared to using My "look it's a C struct" examples would arguably be fine defaulting it in the struct definition instead, since they know it's definitely a pointer. How often is this wanted on generics vs concrete things? Trying to find this PR again I accidentally found this from @joshtriplett:
|
Hm, even with default field values I still think it good to have sensible defaults even if you may want to override them. As for the risk, I'm not personally persuaded that this adds any atm but could be wrong. I also don't think defaulting to null is even mildly surprising. Even if you ignore all the other languages, Rust's primitive's tend to default to the zero bit pattern even if that doesn't make sense as a default. E.g. the default bool is |
☔ The latest upstream changes (presumably #137412) made this pull request unmergeable. Please resolve the merge conflicts. |
67a15fe
to
830bd8b
Compare
At least in my case, I was implementing native methods for |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
@bors r=tgross35 |
Implement `Default` for raw pointers ACP: rust-lang/libs-team#571 This is instantly stable so we will need an FCP here. Closes rust-lang/rfcs#2464
Rollup of 9 pull requests Successful merges: - rust-lang#137454 (not lint break with label and unsafe block) - rust-lang#139297 (Deduplicate & clean up Nix shell) - rust-lang#139535 (Implement `Default` for raw pointers) - rust-lang#139753 (Make `#[naked]` an unsafe attribute) - rust-lang#139922 (fix incorrect type in cstr `to_string_lossy()` docs) - rust-lang#139978 (Add citool command for generating a test dashboard) - rust-lang#140007 (Disable has_thread_local on i686-win7-windows-msvc) - rust-lang#140016 (std: Use fstatat() on illumos) - rust-lang#140025 (Re-remove `AdtFlags::IS_ANONYMOUS`) r? `@ghost` `@rustbot` modify labels: rollup
…enton Rollup of 8 pull requests Successful merges: - rust-lang#137454 (not lint break with label and unsafe block) - rust-lang#139297 (Deduplicate & clean up Nix shell) - rust-lang#139535 (Implement `Default` for raw pointers) - rust-lang#139919 (Make rustdoc JSON Span column 1-based, just like line numbers) - rust-lang#139922 (fix incorrect type in cstr `to_string_lossy()` docs) - rust-lang#140007 (Disable has_thread_local on i686-win7-windows-msvc) - rust-lang#140016 (std: Use fstatat() on illumos) - rust-lang#140025 (Re-remove `AdtFlags::IS_ANONYMOUS`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#139535 - ChrisDenton:default-ptr, r=tgross35 Implement `Default` for raw pointers ACP: rust-lang/libs-team#571 This is instantly stable so we will need an FCP here. Closes rust-lang/rfcs#2464
ACP: rust-lang/libs-team#571
This is instantly stable so we will need an FCP here.
Closes rust-lang/rfcs#2464