diff options
| author | bors <bors@rust-lang.org> | 2016-09-23 17:00:28 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-23 17:00:28 -0700 |
| commit | 5a71fb35fd0b45f6352a7355a699fe22c4e14634 (patch) | |
| tree | 1b83f4c699285fd3f06f81e0e54eaf99c21fe478 /src/libstd | |
| parent | ee959a8cbe8d2931546248ac61f278e38ae8bc68 (diff) | |
| parent | f342ece6d47d4fad07d3306ce0210a9927cb9b86 (diff) | |
| download | rust-5a71fb35fd0b45f6352a7355a699fe22c4e14634.tar.gz rust-5a71fb35fd0b45f6352a7355a699fe22c4e14634.zip | |
Auto merge of #36684 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 7 pull requests - Successful merges: #36018, #36498, #36500, #36559, #36566, #36578, #36664 - Failed merges:
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/ffi/c_str.rs | 9 | ||||
| -rw-r--r-- | src/libstd/time/duration.rs | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 28081367ced..d6a5efbd279 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -228,9 +228,14 @@ impl CString { /// Retakes ownership of a `CString` that was transferred to C. /// + /// Additionally, the length of the string will be recalculated from the pointer. + /// + /// # Safety + /// /// This should only ever be called with a pointer that was earlier - /// obtained by calling `into_raw` on a `CString`. Additionally, the length - /// of the string will be recalculated from the pointer. + /// obtained by calling `into_raw` on a `CString`. Other usage (e.g. trying to take + /// ownership of a string that was allocated by foreign code) is likely to lead + /// to undefined behavior or allocator corruption. #[stable(feature = "cstr_memory", since = "1.4.0")] pub unsafe fn from_raw(ptr: *mut c_char) -> CString { let len = libc::strlen(ptr) + 1; // Including the NUL byte diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index 246c57ab238..10a0c567e14 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -83,7 +83,7 @@ impl Duration { /// Returns the number of whole seconds represented by this duration. /// - /// The extra precision represented by this duration is ignored (e.g. extra + /// The extra precision represented by this duration is ignored (i.e. extra /// nanoseconds are not represented in the returned value). #[stable(feature = "duration", since = "1.3.0")] #[inline] @@ -93,7 +93,7 @@ impl Duration { /// /// This method does **not** return the length of the duration when /// represented by nanoseconds. The returned number always represents a - /// fractional portion of a second (e.g. it is less than one billion). + /// fractional portion of a second (i.e. it is less than one billion). #[stable(feature = "duration", since = "1.3.0")] #[inline] pub fn subsec_nanos(&self) -> u32 { self.nanos } |
