Skip to content

Added docs for From<c_int> for ExitStatus #74291

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jul 16, 2020
Merged

Conversation

regexident
Copy link
Contributor

Partially addresses #51430

@rust-highfive
Copy link
Contributor

r? @LukasKalbertodt

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 13, 2020
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

To be honest, I don't think this particular documentation adds any valuable information. It would be better if you would mention the cost of the conversion (basically free as far as I can see), so that the doc comment has at least more information than the impl header already contains.

@regexident
Copy link
Contributor Author

Thanks a fair point, @LukasKalbertodt!

I'd argue though that it does add something by hinting at it being a "type-safety" conversion.
Anyway, I tried improving it by adding … by wrapping it without copying.. Is that better?

(Technically it is "copying" in the Rust sense, but several other doc comments use "copying" to imply memcpy.)

@LukasKalbertodt
Copy link
Member

Yeah but this "type-safe" thing also kind of bothers me :/ And yes, "copy" is also slightly problematic. Sorry for being so picky! What do you think about this?

Converts a raw c_int into an ExitStatus. The conversion is very cheap.

@regexident
Copy link
Contributor Author

"Very cheap" is very subjective though, isn't it? Cheap relative to what exactly?
Given that ExitStatus is a newtype the overhead should essentially be zero, no?

So how about something like… ?

Converts a raw c_int into an ExitStatus, at near-zero overhead.

@LukasKalbertodt
Copy link
Member

Yeah, true, "very cheap" is not optimal. "near zero overhead" makes one think "overhead over what" though. Mh. I'm probably overthinking this, sorry :D
This should be handled by a professional :P

r? @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

For me it's good as is. 😆

Let's merge it then!

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Jul 15, 2020

📌 Commit 538f157 has been approved by GuillaumeGomez

@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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 15, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 16, 2020
…arth

Rollup of 14 pull requests

Successful merges:

 - rust-lang#72973 (RISC-V GNU/Linux as host platform)
 - rust-lang#73918 (Clean up E0715 explanation)
 - rust-lang#73959 (Clean up E0716 explanation)
 - rust-lang#74119 (Remove `Compiler::compile()`.)
 - rust-lang#74196 (Add option to collapse automatically implementors)
 - rust-lang#74218 (Add margin after doc search results)
 - rust-lang#74276 (improve DiscriminantKind handling)
 - rust-lang#74291 (Added docs for `From<c_int>` for `ExitStatus`)
 - rust-lang#74294 (Update cross-compilation README)
 - rust-lang#74337 (Handle case of incomplete local ty more gracefully)
 - rust-lang#74344 (Remove string comparison and use diagnostic item instead)
 - rust-lang#74347 (Initialize default providers only once)
 - rust-lang#74353 (Edit docs for rustc_middle::dep_graph::dep_node)
 - rust-lang#74374 (Add a 1.45 release note on lto vs. embed-bitcode)

Failed merges:

 - rust-lang#74251 (Teach bootstrap about target files vs target triples)

r? @ghost
@bors bors merged commit b7cf2cb into rust-lang:master Jul 16, 2020
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants