Skip to content
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

Cleanup c_str.rs #92724

Merged
merged 1 commit into from
Feb 7, 2022
Merged

Cleanup c_str.rs #92724

merged 1 commit into from
Feb 7, 2022

Conversation

inteon
Copy link
Contributor

@inteon inteon commented Jan 10, 2022

Some code cleanups in c_str.rs.
No functional changes.

ref: bytecodealliance/rustix#163

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 10, 2022
@rust-log-analyzer

This comment has been minimized.

@camelid camelid added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jan 10, 2022
@Mark-Simulacrum
Copy link
Member

I'm not sure this is really an improvement, it feels mostly like just shuffling some code around a little -- can you say more about the motivation or the reference to the rustix PR's relevance?

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 17, 2022
@bors
Copy link
Contributor

bors commented Jan 19, 2022

☔ The latest upstream changes (presumably #93069) made this pull request unmergeable. Please resolve the merge conflicts.

@JohnCSimon
Copy link
Member

Ping from triage:
@inteon

Mark-Simulacrum commented 26 days ago
I'm not sure this is really an improvement, it feels mostly like just shuffling some code around a little -- can you say more about the motivation or the reference to the rustix PR's relevance?

Can you address this?

@inteon
Copy link
Contributor Author

inteon commented Feb 6, 2022

@Mark-Simulacrum Indeed, this PR is just some code shuffling. I wanted to make these changes in rustix first (together with some other improvements), but it turned out that code was based on this code. So this PR tries to apply those changes here instead.

Main goal is to change the from_bytes_with_nul function to have same code layout as from_vec_with_nul since these functions are pretty similar; ! also adding the SAFETY comment.
Also the b'\0' notation shows in my opinion better that this is the NUL terminator, compared to the plain 0 notation.

I understand if this PR is too small of a change/ too opinionated; you can close the PR if it is non-valuable to the project.

@Mark-Simulacrum
Copy link
Member

Syncing those two functions seems like a good thing to me. I'd be happy to approve this with the null byte left as 0, not \0, and commits squashed.

@Mark-Simulacrum
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 6, 2022

📌 Commit afb7a50 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 6, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 6, 2022
Cleanup c_str.rs

Some code cleanups in `c_str.rs`.
No functional changes.

ref: bytecodealliance/rustix#163
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 7, 2022
Cleanup c_str.rs

Some code cleanups in `c_str.rs`.
No functional changes.

ref: bytecodealliance/rustix#163
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 7, 2022
Cleanup c_str.rs

Some code cleanups in `c_str.rs`.
No functional changes.

ref: bytecodealliance/rustix#163
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Feb 7, 2022
Cleanup c_str.rs

Some code cleanups in `c_str.rs`.
No functional changes.

ref: bytecodealliance/rustix#163
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 7, 2022
Rollup of 13 pull requests

Successful merges:

 - rust-lang#88313 (Make the pre-commit script pre-push instead)
 - rust-lang#91530 (Suggest 1-tuple parentheses on exprs without existing parens)
 - rust-lang#92724 (Cleanup c_str.rs)
 - rust-lang#93208 (Impl {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}Assign<$t> for Wrapping<$t> for rust 1.60.0)
 - rust-lang#93394 (Don't allow {} to refer to implicit captures in format_args.)
 - rust-lang#93416 (remove `allow_fail` test flag)
 - rust-lang#93487 (Fix linking stage1 toolchain in `./x.py setup`)
 - rust-lang#93673 (Linkify sidebar headings for sibling items)
 - rust-lang#93680 (Drop json::from_reader)
 - rust-lang#93682 (Update tracking issue for `const_fn_trait_bound`)
 - rust-lang#93722 (Use shallow clones for submodules managed by rustbuild, not just bootstrap.py)
 - rust-lang#93723 (Rerun bootstrap's build script when RUSTC changes)
 - rust-lang#93737 (bootstrap: prefer using '--config' over 'RUST_BOOTSTRAP_CONFIG')

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8219ad4 into rust-lang:master Feb 7, 2022
@rustbot rustbot added this to the 1.60.0 milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants