Skip to content

Add section about memory safety to ffi::CString documentation #31171

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

Merged
merged 2 commits into from
Jan 28, 2016

Conversation

dirk
Copy link
Contributor

@dirk dirk commented Jan 24, 2016

Also a minor language tweak to the documentation of the ffi::CString::from_raw function.

@rust-highfive
Copy link
Contributor

r? @brson

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

///
/// # Safety
///
/// CStrings are intended for working with traditional C-style strings
Copy link
Member

Choose a reason for hiding this comment

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

Could you put CString is graves, both here and below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@steveklabnik: Fixed in 71b526b!

Also a minor language tweak to the documentation of the
`ffi::CString::from_raw` function.
@dirk dirk force-pushed the dirk/safety-section-in-cstring-docs branch from 7fddeec to 71b526b Compare January 24, 2016 23:48
@dirk
Copy link
Contributor Author

dirk commented Jan 27, 2016

@steveklabnik: Updated docs to have CString always be in backticks. Look good to you now?

/// `into_raw`. The length of the string will be recalculated
/// using the pointer.
/// This should only ever be called with a pointer that was earlier
/// obtained by calling `into_raw` on a CString. Additionally, the length
Copy link
Member

Choose a reason for hiding this comment

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

one last CString here, then we're good to go :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh jeez, I'm hopeless. 😞

@dirk
Copy link
Contributor Author

dirk commented Jan 27, 2016

@steveklabnik: Those last two backtick formatting nits are fixed in 9cfa191.

@steveklabnik
Copy link
Member

@bors: r+ rollup

Thanks! And no, you're not: I mess these things up all the time :)

@bors
Copy link
Collaborator

bors commented Jan 27, 2016

📌 Commit 9cfa191 has been approved by steveklabnik

@bors
Copy link
Collaborator

bors commented Jan 28, 2016

⌛ Testing commit 9cfa191 with merge 11e3113...

@bors
Copy link
Collaborator

bors commented Jan 28, 2016

💔 Test failed - auto-mac-64-nopt-t

@alexcrichton
Copy link
Member

@bors: retry

On Wed, Jan 27, 2016 at 11:06 PM, bors [email protected] wrote:

[image: 💔] Test failed - auto-mac-64-nopt-t
http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/7880


Reply to this email directly or view it on GitHub
#31171 (comment).

bors added a commit that referenced this pull request Jan 28, 2016
…eveklabnik

Also a minor language tweak to the documentation of the `ffi::CString::from_raw` function.
@bors
Copy link
Collaborator

bors commented Jan 28, 2016

⌛ Testing commit 9cfa191 with merge a891c72...

@bors bors merged commit 9cfa191 into rust-lang:master Jan 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants