about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-02-18 17:50:21 +0000
committerbors <bors@rust-lang.org>2018-02-18 17:50:21 +0000
commit27a046e9338fb0455c33b13e8fe28da78212dedc (patch)
tree004849f31563f7dd4c1eb9f54d12ad392887c077 /src/libstd
parent1ad094d81c97b3d2dd8e980ccd1475a80647540d (diff)
parentcc20de3993bc47be613d20fdd4ec3c35cc410fcd (diff)
downloadrust-27a046e9338fb0455c33b13e8fe28da78212dedc.tar.gz
rust-27a046e9338fb0455c33b13e8fe28da78212dedc.zip
Auto merge of #48322 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 6 pull requests

- Successful merges: #48194, #48273, #48274, #48275, #48282, #48312
- Failed merges:
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/fs.rs15
-rw-r--r--src/libstd/io/buffered.rs2
-rw-r--r--src/libstd/net/tcp.rs8
-rw-r--r--src/libstd/net/udp.rs4
-rw-r--r--src/libstd/sync/rwlock.rs4
-rw-r--r--src/libstd/sys_common/backtrace.rs2
-rw-r--r--src/libstd/sys_common/poison.rs2
-rw-r--r--src/libstd/thread/mod.rs6
8 files changed, 29 insertions, 14 deletions
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs
index 5cea389531f..292a78278ab 100644
--- a/src/libstd/fs.rs
+++ b/src/libstd/fs.rs
@@ -81,9 +81,18 @@ use time::SystemTime;
 /// # }
 /// ```
 ///
+/// Note that, although read and write methods require a `&mut File`, because
+/// of the interfaces for [`Read`] and [`Write`], the holder of a `&File` can
+/// still modify the file, either through methods that take `&File` or by
+/// retrieving the underlying OS object and modifying the file that way.
+/// Additionally, many operating systems allow concurrent modification of files
+/// by different processes. Avoid assuming that holding a `&File` means that the
+/// file will not change.
+///
 /// [`Seek`]: ../io/trait.Seek.html
 /// [`String`]: ../string/struct.String.html
 /// [`Read`]: ../io/trait.Read.html
+/// [`Write`]: ../io/trait.Write.html
 /// [`BufReader<R>`]: ../io/struct.BufReader.html
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct File {
@@ -459,6 +468,9 @@ impl File {
     /// # Ok(())
     /// # }
     /// ```
+    ///
+    /// Note that this method alters the content of the underlying file, even
+    /// though it takes `&self` rather than `&mut self`.
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn set_len(&self, size: u64) -> io::Result<()> {
         self.inner.truncate(size)
@@ -557,6 +569,9 @@ impl File {
     /// # Ok(())
     /// # }
     /// ```
+    ///
+    /// Note that this method alters the permissions of the underlying file,
+    /// even though it takes `&self` rather than `&mut self`.
     #[stable(feature = "set_permissions_atomic", since = "1.16.0")]
     pub fn set_permissions(&self, perm: Permissions) -> io::Result<()> {
         self.inner.set_permissions(perm.0)
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index 4e7db5f0826..9250c1c437b 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -293,7 +293,7 @@ impl<R: Seek> Seek for BufReader<R> {
     /// where `n` minus the internal buffer length overflows an `i64`, two
     /// seeks will be performed instead of one. If the second seek returns
     /// `Err`, the underlying reader will be left at the same position it would
-    /// have if you seeked to `SeekFrom::Current(0)`.
+    /// have if you called `seek` with `SeekFrom::Current(0)`.
     ///
     /// [`seek_relative`]: #method.seek_relative
     fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> {
diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs
index 78235ea1b4b..263a2c13249 100644
--- a/src/libstd/net/tcp.rs
+++ b/src/libstd/net/tcp.rs
@@ -262,7 +262,7 @@ impl TcpStream {
     /// indefinitely. It is an error to pass the zero `Duration` to this
     /// method.
     ///
-    /// # Note
+    /// # Platform-specific behavior
     ///
     /// Platforms may return a different error code whenever a read times out as
     /// a result of setting this option. For example Unix typically returns an
@@ -293,7 +293,7 @@ impl TcpStream {
     /// indefinitely. It is an error to pass the zero [`Duration`] to this
     /// method.
     ///
-    /// # Note
+    /// # Platform-specific behavior
     ///
     /// Platforms may return a different error code whenever a write times out
     /// as a result of setting this option. For example Unix typically returns
@@ -323,7 +323,7 @@ impl TcpStream {
     ///
     /// If the timeout is [`None`], then [`read`] calls will block indefinitely.
     ///
-    /// # Note
+    /// # Platform-specific behavior
     ///
     /// Some platforms do not provide access to the current timeout.
     ///
@@ -349,7 +349,7 @@ impl TcpStream {
     ///
     /// If the timeout is [`None`], then [`write`] calls will block indefinitely.
     ///
-    /// # Note
+    /// # Platform-specific behavior
     ///
     /// Some platforms do not provide access to the current timeout.
     ///
diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs
index fc7f9205d06..5e19519b88f 100644
--- a/src/libstd/net/udp.rs
+++ b/src/libstd/net/udp.rs
@@ -231,7 +231,7 @@ impl UdpSocket {
     /// indefinitely. It is an error to pass the zero [`Duration`] to this
     /// method.
     ///
-    /// # Note
+    /// # Platform-specific behavior
     ///
     /// Platforms may return a different error code whenever a read times out as
     /// a result of setting this option. For example Unix typically returns an
@@ -262,7 +262,7 @@ impl UdpSocket {
     /// indefinitely. It is an error to pass the zero [`Duration`] to this
     /// method.
     ///
-    /// # Note
+    /// # Platform-specific behavior
     ///
     /// Platforms may return a different error code whenever a write times out
     /// as a result of setting this option. For example Unix typically returns
diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs
index 2edf02efc47..f7fdedc0d21 100644
--- a/src/libstd/sync/rwlock.rs
+++ b/src/libstd/sync/rwlock.rs
@@ -24,8 +24,8 @@ use sys_common::rwlock as sys;
 /// typically allows for read-only access (shared access).
 ///
 /// In comparison, a [`Mutex`] does not distinguish between readers or writers
-/// that aquire the lock, therefore blocking any threads waiting for the lock to
-/// become available. An `RwLock` will allow any number of readers to aquire the
+/// that acquire the lock, therefore blocking any threads waiting for the lock to
+/// become available. An `RwLock` will allow any number of readers to acquire the
 /// lock as long as a writer is not holding the lock.
 ///
 /// The priority policy of the lock is dependent on the underlying operating
diff --git a/src/libstd/sys_common/backtrace.rs b/src/libstd/sys_common/backtrace.rs
index a364a0392b3..1955f3ec9a2 100644
--- a/src/libstd/sys_common/backtrace.rs
+++ b/src/libstd/sys_common/backtrace.rs
@@ -136,7 +136,7 @@ pub fn __rust_begin_short_backtrace<F, T>(f: F) -> T
     f()
 }
 
-/// Controls how the backtrace should be formated.
+/// Controls how the backtrace should be formatted.
 #[derive(Debug, Copy, Clone, Eq, PartialEq)]
 pub enum PrintFormat {
     /// Show all the frames with absolute path for files.
diff --git a/src/libstd/sys_common/poison.rs b/src/libstd/sys_common/poison.rs
index 934ac3edbf1..e74c40ae04b 100644
--- a/src/libstd/sys_common/poison.rs
+++ b/src/libstd/sys_common/poison.rs
@@ -98,7 +98,7 @@ pub struct PoisonError<T> {
 }
 
 /// An enumeration of possible errors associated with a [`TryLockResult`] which
-/// can occur while trying to aquire a lock, from the [`try_lock`] method on a
+/// can occur while trying to acquire a lock, from the [`try_lock`] method on a
 /// [`Mutex`] or the [`try_read`] and [`try_write`] methods on an [`RwLock`].
 ///
 /// [`Mutex`]: struct.Mutex.html
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index ee49bf796b8..ff121e2d7ee 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -652,7 +652,7 @@ pub fn panicking() -> bool {
 /// The thread may sleep longer than the duration specified due to scheduling
 /// specifics or platform-dependent functionality.
 ///
-/// # Platform behavior
+/// # Platform-specific behavior
 ///
 /// On Unix platforms this function will not return early due to a
 /// signal being received or a spurious wakeup.
@@ -676,7 +676,7 @@ pub fn sleep_ms(ms: u32) {
 /// The thread may sleep longer than the duration specified due to scheduling
 /// specifics or platform-dependent functionality.
 ///
-/// # Platform behavior
+/// # Platform-specific behavior
 ///
 /// On Unix platforms this function will not return early due to a
 /// signal being received or a spurious wakeup. Platforms which do not support
@@ -837,7 +837,7 @@ pub fn park_timeout_ms(ms: u32) {
 ///
 /// See the [park documentation][park] for more details.
 ///
-/// # Platform behavior
+/// # Platform-specific behavior
 ///
 /// Platforms which do not support nanosecond precision for sleeping will have
 /// `dur` rounded up to the nearest granularity of time they can sleep for.