aboutsummaryrefslogtreecommitdiff
path: root/ctr-std/src/ffi
diff options
context:
space:
mode:
authorlinouxis9 <[email protected]>2018-05-07 15:31:54 +0200
committerlinouxis9 <[email protected]>2018-05-07 15:35:20 +0200
commit4901431b02227416b08e5fbc9a7ac3f5ac2f44a7 (patch)
tree7fb75cf805b8f0e9b7f169af37c9d2aa0c4aded6 /ctr-std/src/ffi
parentMerge pull request #66 from FenrirWolf/swkbd (diff)
downloadctru-rs-4901431b02227416b08e5fbc9a7ac3f5ac2f44a7.tar.xz
ctru-rs-4901431b02227416b08e5fbc9a7ac3f5ac2f44a7.zip
Update for latest nightly 2018-05-06
Diffstat (limited to 'ctr-std/src/ffi')
-rw-r--r--ctr-std/src/ffi/c_str.rs7
-rw-r--r--ctr-std/src/ffi/os_str.rs5
2 files changed, 8 insertions, 4 deletions
diff --git a/ctr-std/src/ffi/c_str.rs b/ctr-std/src/ffi/c_str.rs
index c88c2bc..7f66b76 100644
--- a/ctr-std/src/ffi/c_str.rs
+++ b/ctr-std/src/ffi/c_str.rs
@@ -406,7 +406,7 @@ impl CString {
/// ```
#[stable(feature = "cstr_memory", since = "1.4.0")]
pub unsafe fn from_raw(ptr: *mut c_char) -> CString {
- let len = sys::strlen(ptr) + 1; // Including the NUL byte
+ let len = sys::strlen(ptr as *const _) + 1; // Including the NUL byte
let slice = slice::from_raw_parts_mut(ptr, len as usize);
CString { inner: Box::from_raw(slice as *mut [c_char] as *mut [u8]) }
}
@@ -901,7 +901,7 @@ impl CStr {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn from_ptr<'a>(ptr: *const c_char) -> &'a CStr {
- let len = sys::strlen(ptr);
+ let len = sys::strlen(ptr as *const _);
let ptr = ptr as *const u8;
CStr::from_bytes_with_nul_unchecked(slice::from_raw_parts(ptr, len as usize + 1))
}
@@ -988,6 +988,7 @@ impl CStr {
/// behavior when `ptr` is used inside the `unsafe` block:
///
/// ```no_run
+ /// # #![allow(unused_must_use)]
/// use std::ffi::{CString};
///
/// let ptr = CString::new("Hello").unwrap().as_ptr();
@@ -1003,6 +1004,7 @@ impl CStr {
/// To fix the problem, bind the `CString` to a local variable:
///
/// ```no_run
+ /// # #![allow(unused_must_use)]
/// use std::ffi::{CString};
///
/// let hello = CString::new("Hello").unwrap();
@@ -1118,6 +1120,7 @@ impl CStr {
///
/// [`Cow`]: ../borrow/enum.Cow.html
/// [`Borrowed`]: ../borrow/enum.Cow.html#variant.Borrowed
+ /// [`Owned`]: ../borrow/enum.Cow.html#variant.Owned
/// [`str`]: ../primitive.str.html
/// [`String`]: ../string/struct.String.html
///
diff --git a/ctr-std/src/ffi/os_str.rs b/ctr-std/src/ffi/os_str.rs
index 7520121..4850ed0 100644
--- a/ctr-std/src/ffi/os_str.rs
+++ b/ctr-std/src/ffi/os_str.rs
@@ -61,7 +61,7 @@ use sys_common::{AsInner, IntoInner, FromInner};
/// # Conversions
///
/// See the [module's toplevel documentation about conversions][conversions] for a discussion on
-/// the traits which `OsString` implements for conversions from/to native representations.
+/// the traits which `OsString` implements for [conversions] from/to native representations.
///
/// [`OsStr`]: struct.OsStr.html
/// [`&OsStr`]: struct.OsStr.html
@@ -74,6 +74,7 @@ use sys_common::{AsInner, IntoInner, FromInner};
/// [`new`]: #method.new
/// [`push`]: #method.push
/// [`as_os_str`]: #method.as_os_str
+/// [conversions]: index.html#conversions
#[derive(Clone)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct OsString {
@@ -89,7 +90,7 @@ pub struct OsString {
/// references; the latter are owned strings.
///
/// See the [module's toplevel documentation about conversions][conversions] for a discussion on
-/// the traits which `OsStr` implements for conversions from/to native representations.
+/// the traits which `OsStr` implements for [conversions] from/to native representations.
///
/// [`OsString`]: struct.OsString.html
/// [`&str`]: ../primitive.str.html