Skip to content

Add doc examples & description in std::os::unix::ffi. #39065

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 1 commit into from
Jan 17, 2017

Conversation

frewsxcv
Copy link
Member

No description provided.

@frewsxcv
Copy link
Member Author

r? @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

failures:

---- sys::imp::ext::ffi::OsStrExt::as_bytes_0 stdout ----
	error[E0432]: unresolved import `std::os::ffi::OsStrExt`
 --> <anon>:5:5
  |
5 | use std::os::ffi::OsStrExt;
  |     ^^^^^^^^^^^^^^^^^^^^^^ Could not find `ffi` in `os`

error: no method named `as_bytes` found for type `&std::ffi::OsStr` in the current scope
 --> <anon>:8:20
  |
8 | let bytes = os_str.as_bytes();
  |                    ^^^^^^^^
  |
  = help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it:
  = help: candidate #1: `use std::os::ext::ffi::OsStrExt;`

error: aborting due to previous error(s)

thread 'sys::imp::ext::ffi::OsStrExt::as_bytes_0' panicked at 'Box<Any>', /checkout/src/librustc/session/mod.rs:203
note: Run with `RUST_BACKTRACE=1` for a backtrace.

---- sys::imp::ext::ffi::OsStrExt::from_bytes_0 stdout ----
	error[E0432]: unresolved import `std::os::ffi::OsStrExt`
 --> <anon>:5:5
  |
5 | use std::os::ffi::OsStrExt;
  |     ^^^^^^^^^^^^^^^^^^^^^^ Could not find `ffi` in `os`

error: no associated item named `from_bytes` found for type `std::ffi::OsStr` in the current scope
 --> <anon>:8:14
  |
8 | let os_str = OsStr::from_bytes(bytes);
  |              ^^^^^^^^^^^^^^^^^
  |
  = help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it:
  = help: candidate #1: `use std::os::ext::ffi::OsStrExt;`

error: aborting due to previous error(s)

thread 'sys::imp::ext::ffi::OsStrExt::from_bytes_0' panicked at 'Box<Any>', /checkout/src/librustc/session/mod.rs:203

---- sys::imp::ext::ffi::OsStringExt::from_vec_0 stdout ----
	error[E0432]: unresolved import `std::os::ffi::OsStringExt`
 --> <anon>:5:5
  |
5 | use std::os::ffi::OsStringExt;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^ Could not find `ffi` in `os`

error: no associated item named `from_vec` found for type `std::ffi::OsString` in the current scope
 --> <anon>:8:17
  |
8 | let os_string = OsString::from_vec(bytes);
  |                 ^^^^^^^^^^^^^^^^^^
  |
  = help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it:
  = help: candidate #1: `use std::os::ext::ffi::OsStringExt;`

error: aborting due to previous error(s)

thread 'sys::imp::ext::ffi::OsStringExt::from_vec_0' panicked at 'Box<Any>', /checkout/src/librustc/session/mod.rs:203

---- sys::imp::ext::ffi::OsStringExt::into_vec_0 stdout ----
	error[E0432]: unresolved import `std::os::ffi::OsStringExt`
 --> <anon>:5:5
  |
5 | use std::os::ffi::OsStringExt;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^ Could not find `ffi` in `os`

error: no method named `into_vec` found for type `std::ffi::OsString` in the current scope
 --> <anon>:9:23
  |
9 | let bytes = os_string.into_vec();
  |                       ^^^^^^^^
  |
  = help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it:
  = help: candidate #1: `use std::os::ext::ffi::OsStringExt;`

error: aborting due to previous error(s)

Copy link
Member

@GuillaumeGomez GuillaumeGomez left a comment

Choose a reason for hiding this comment

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

Just a few little things missing.

@@ -43,9 +66,32 @@ impl OsStringExt for OsString {
#[stable(feature = "rust1", since = "1.0.0")]
pub trait OsStrExt {
#[stable(feature = "rust1", since = "1.0.0")]
/// Creates an `OsStr` from a byte slice.
Copy link
Member

Choose a reason for hiding this comment

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

Missing url.

/// let bytes = b"foo";
/// let os_str = OsStr::from_bytes(bytes);
/// assert_eq!(os_str.to_str(), Some("foo"));
/// ```
fn from_bytes(slice: &[u8]) -> &Self;

/// Gets the underlying byte view of the `OsStr` slice.
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 add the missing url here as well please?

/// let bytes = b"foo".to_vec();
/// let os_string = OsString::from_vec(bytes);
/// assert_eq!(os_string.to_str(), Some("foo"));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
fn from_vec(vec: Vec<u8>) -> Self;

/// Yields the underlying byte vector of this `OsString`.
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 add the missing url here as well please?

@@ -21,10 +21,33 @@ use sys_common::{FromInner, IntoInner, AsInner};
#[stable(feature = "rust1", since = "1.0.0")]
pub trait OsStringExt {
/// Creates an `OsString` from a byte vector.
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 add the missing url here as well please?

@frewsxcv frewsxcv force-pushed the libstd-os-unix-ffi-docs branch from 35b5026 to 617e97c Compare January 15, 2017 02:34
@frewsxcv frewsxcv force-pushed the libstd-os-unix-ffi-docs branch from 617e97c to de73e52 Compare January 15, 2017 03:35
@frewsxcv
Copy link
Member Author

Comments have been addressed. Tests pass on Travis.

@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Jan 15, 2017

📌 Commit de73e52 has been approved by GuillaumeGomez

@bors
Copy link
Collaborator

bors commented Jan 16, 2017

⌛ Testing commit de73e52 with merge 1a5c87f...

@bors
Copy link
Collaborator

bors commented Jan 16, 2017

💔 Test failed - status-travis

@alexcrichton
Copy link
Member

alexcrichton commented Jan 16, 2017 via email

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jan 16, 2017
…=GuillaumeGomez

Add doc examples & description in `std::os::unix::ffi`.

None
bors added a commit that referenced this pull request Jan 16, 2017
Rollup of 6 pull requests

- Successful merges: #38247, #39028, #39065, #39084, #39105, #39106
- Failed merges:
@bors bors merged commit de73e52 into rust-lang:master Jan 17, 2017
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.

4 participants