From 84b880d55e5b154d9649107ac583de7591a81823 Mon Sep 17 00:00:00 2001 From: Stefan Schindler Date: Thu, 15 Jun 2017 11:36:32 +0200 Subject: Add hint about the return code of panic! --- src/libstd/macros.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/libstd') diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index df3fce0da76..547e840ffb7 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -24,6 +24,8 @@ /// The multi-argument form of this macro panics with a string and has the /// `format!` syntax for building a string. /// +/// If the main thread panics it will return with code `101`. +/// /// # Examples /// /// ```should_panic -- cgit 1.4.1-3-g733a5 From d5390573ba468d4f1d06bf4f3ba6d54ec26c98c5 Mon Sep 17 00:00:00 2001 From: Stefan Schindler Date: Wed, 5 Jul 2017 21:16:58 +0200 Subject: Insert current implementation header --- src/libcore/macros.rs | 2 +- src/libstd/macros.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 537d925c8fa..ceaab185716 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -456,7 +456,7 @@ macro_rules! writeln { /// /// # Panics /// -/// This will always [panic!](macro.panic.html). +/// This will always [panic!](macro.panic.html) /// /// # Examples /// diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 547e840ffb7..fbf2ba7f9a0 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -24,6 +24,8 @@ /// The multi-argument form of this macro panics with a string and has the /// `format!` syntax for building a string. /// +/// # Current implementation +/// /// If the main thread panics it will return with code `101`. /// /// # Examples -- cgit 1.4.1-3-g733a5 From 9e001ce86522011ff716218f29dcd9dff082d20a Mon Sep 17 00:00:00 2001 From: Stefan Schindler Date: Wed, 5 Jul 2017 22:58:39 +0200 Subject: Be more specific about the implications of the panic! --- src/libstd/macros.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index fbf2ba7f9a0..a45d37b0792 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -26,7 +26,7 @@ /// /// # Current implementation /// -/// If the main thread panics it will return with code `101`. +/// If the main thread panics it will terminate all your threads and end your program with code `101`. /// /// # Examples /// -- cgit 1.4.1-3-g733a5 From 4d58b048a8b1ca9e2bd6907359ef9b4dc1f7382a Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Thu, 6 Jul 2017 16:14:00 -0700 Subject: Redox: add stat methods(); support is_symlink() --- src/libstd/sys/redox/ext/fs.rs | 15 +++++++++++++++ src/libstd/sys/redox/fs.rs | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/sys/redox/ext/fs.rs b/src/libstd/sys/redox/ext/fs.rs index 4437cf43920..9a0d1e06da3 100644 --- a/src/libstd/sys/redox/ext/fs.rs +++ b/src/libstd/sys/redox/ext/fs.rs @@ -177,6 +177,8 @@ pub trait MetadataExt { #[stable(feature = "metadata_ext", since = "1.1.0")] fn mode(&self) -> u32; #[stable(feature = "metadata_ext", since = "1.1.0")] + fn nlink(&self) -> u64; + #[stable(feature = "metadata_ext", since = "1.1.0")] fn uid(&self) -> u32; #[stable(feature = "metadata_ext", since = "1.1.0")] fn gid(&self) -> u32; @@ -194,6 +196,10 @@ pub trait MetadataExt { fn ctime(&self) -> i64; #[stable(feature = "metadata_ext", since = "1.1.0")] fn ctime_nsec(&self) -> i64; + #[stable(feature = "metadata_ext", since = "1.1.0")] + fn blksize(&self) -> u64; + #[stable(feature = "metadata_ext", since = "1.1.0")] + fn blocks(&self) -> u64; } #[stable(feature = "metadata_ext", since = "1.1.0")] @@ -207,6 +213,9 @@ impl MetadataExt for fs::Metadata { fn mode(&self) -> u32 { self.as_inner().as_inner().st_mode as u32 } + fn nlink(&self) -> u64 { + self.as_inner().as_inner().st_nlink as u64 + } fn uid(&self) -> u32 { self.as_inner().as_inner().st_uid as u32 } @@ -234,6 +243,12 @@ impl MetadataExt for fs::Metadata { fn ctime_nsec(&self) -> i64 { self.as_inner().as_inner().st_ctime_nsec as i64 } + fn blksize(&self) -> u64 { + self.as_inner().as_inner().st_blksize as u64 + } + fn blocks(&self) -> u64 { + self.as_inner().as_inner().st_blocks as u64 + } } /// Add special Redox types (block/char device, fifo and socket) diff --git a/src/libstd/sys/redox/fs.rs b/src/libstd/sys/redox/fs.rs index c5a19e8debe..386ae24d9ea 100644 --- a/src/libstd/sys/redox/fs.rs +++ b/src/libstd/sys/redox/fs.rs @@ -119,10 +119,10 @@ impl FilePermissions { impl FileType { pub fn is_dir(&self) -> bool { self.is(syscall::MODE_DIR) } pub fn is_file(&self) -> bool { self.is(syscall::MODE_FILE) } - pub fn is_symlink(&self) -> bool { false /*FIXME: Implement symlink mode*/ } + pub fn is_symlink(&self) -> bool { self.is(syscall::MODE_SYMLINK) } pub fn is(&self, mode: u16) -> bool { - self.mode & (syscall::MODE_DIR | syscall::MODE_FILE) == mode + self.mode & syscall::MODE_TYPE == mode } } -- cgit 1.4.1-3-g733a5 From c6b280e0396780179a20776b55e3fa4cf4b1a513 Mon Sep 17 00:00:00 2001 From: John Gallagher Date: Sun, 9 Jul 2017 17:52:20 -0400 Subject: Add warning to BufWriter documentation --- src/libstd/io/buffered.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 296ee78aadb..1b832453523 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -276,7 +276,10 @@ impl Seek for BufReader { /// `BufWriter` keeps an in-memory buffer of data and writes it to an underlying /// writer in large, infrequent batches. /// -/// The buffer will be written out when the writer is dropped. +/// When the `BufWriter` is dropped, the contents of its buffer will be written +/// out. However, any errors that happen in the process of flushing the buffer +/// when the writer is dropped will be ignored. Code that wishes to handle such +/// errors must manually call [`flush`] before the writer is dropped. /// /// # Examples /// @@ -316,6 +319,7 @@ impl Seek for BufReader { /// [`Write`]: ../../std/io/trait.Write.html /// [`Tcpstream::write`]: ../../std/net/struct.TcpStream.html#method.write /// [`TcpStream`]: ../../std/net/struct.TcpStream.html +/// [`flush`]: #method.flush #[stable(feature = "rust1", since = "1.0.0")] pub struct BufWriter { inner: Option, -- cgit 1.4.1-3-g733a5 From f2566bbaebc4ea56bc3717ee8c04bee7d5c0a8d3 Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Mon, 10 Jul 2017 02:07:29 +0100 Subject: Correct some stability attributes These show up in rustdoc so need to be correct. --- src/liballoc/boxed.rs | 4 ++-- src/libcore/cell.rs | 4 ++-- src/libcore/char.rs | 6 +++--- src/libstd/error.rs | 2 +- src/libstd/sync/mutex.rs | 2 +- src/libstd/sync/rwlock.rs | 4 ++-- src/libstd_unicode/char.rs | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/libstd') diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 76cf10f0d55..94f5f4042e1 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -726,14 +726,14 @@ impl Clone for Box<[T]> { } } -#[stable(feature = "rust1", since = "1.0.0")] +#[stable(feature = "box_borrow", since = "1.1.0")] impl borrow::Borrow for Box { fn borrow(&self) -> &T { &**self } } -#[stable(feature = "rust1", since = "1.0.0")] +#[stable(feature = "box_borrow", since = "1.1.0")] impl borrow::BorrowMut for Box { fn borrow_mut(&mut self) -> &mut T { &mut **self diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 1eebf67ad04..35744f3f16b 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -942,7 +942,7 @@ impl<'b, T: ?Sized> Ref<'b, T> { #[unstable(feature = "coerce_unsized", issue = "27732")] impl<'b, T: ?Sized + Unsize, U: ?Sized> CoerceUnsized> for Ref<'b, T> {} -#[stable(feature = "std_guard_impls", since = "1.20")] +#[stable(feature = "std_guard_impls", since = "1.20.0")] impl<'a, T: ?Sized + fmt::Display> fmt::Display for Ref<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.value.fmt(f) @@ -1041,7 +1041,7 @@ impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> { #[unstable(feature = "coerce_unsized", issue = "27732")] impl<'b, T: ?Sized + Unsize, U: ?Sized> CoerceUnsized> for RefMut<'b, T> {} -#[stable(feature = "std_guard_impls", since = "1.20")] +#[stable(feature = "std_guard_impls", since = "1.20.0")] impl<'a, T: ?Sized + fmt::Display> fmt::Display for RefMut<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.value.fmt(f) diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 44f5fdbf431..bb4cb0ac3b2 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -210,7 +210,7 @@ impl From for char { /// An error which can be returned when parsing a char. -#[stable(feature = "char_from_str", since = "1.19.0")] +#[stable(feature = "char_from_str", since = "1.20.0")] #[derive(Clone, Debug)] pub struct ParseCharError { kind: CharErrorKind, @@ -237,7 +237,7 @@ enum CharErrorKind { TooManyChars, } -#[stable(feature = "char_from_str", since = "1.19.0")] +#[stable(feature = "char_from_str", since = "1.20.0")] impl fmt::Display for ParseCharError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.__description().fmt(f) @@ -245,7 +245,7 @@ impl fmt::Display for ParseCharError { } -#[stable(feature = "char_from_str", since = "1.19.0")] +#[stable(feature = "char_from_str", since = "1.20.0")] impl FromStr for char { type Err = ParseCharError; diff --git a/src/libstd/error.rs b/src/libstd/error.rs index d77f817659c..d1c2bfb96b3 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -340,7 +340,7 @@ impl Error for char::CharTryFromError { } } -#[stable(feature = "char_from_str", since = "1.19.0")] +#[stable(feature = "char_from_str", since = "1.20.0")] impl Error for char::ParseCharError { fn description(&self) -> &str { self.__description() diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index fc6c7de9ef0..62d8de18f4b 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -440,7 +440,7 @@ impl<'a, T: ?Sized + fmt::Debug> fmt::Debug for MutexGuard<'a, T> { } } -#[stable(feature = "std_guard_impls", since = "1.20")] +#[stable(feature = "std_guard_impls", since = "1.20.0")] impl<'a, T: ?Sized + fmt::Display> fmt::Display for MutexGuard<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 944801e8a3b..5c5231f4e84 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -370,7 +370,7 @@ impl<'a, T: fmt::Debug> fmt::Debug for RwLockReadGuard<'a, T> { } } -#[stable(feature = "std_guard_impls", since = "1.20")] +#[stable(feature = "std_guard_impls", since = "1.20.0")] impl<'a, T: ?Sized + fmt::Display> fmt::Display for RwLockReadGuard<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) @@ -386,7 +386,7 @@ impl<'a, T: fmt::Debug> fmt::Debug for RwLockWriteGuard<'a, T> { } } -#[stable(feature = "std_guard_impls", since = "1.20")] +#[stable(feature = "std_guard_impls", since = "1.20.0")] impl<'a, T: ?Sized + fmt::Display> fmt::Display for RwLockWriteGuard<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) diff --git a/src/libstd_unicode/char.rs b/src/libstd_unicode/char.rs index d4d8993efb3..d6836418b4b 100644 --- a/src/libstd_unicode/char.rs +++ b/src/libstd_unicode/char.rs @@ -38,7 +38,7 @@ use tables::{conversions, derived_property, general_category, property}; pub use core::char::{MAX, from_digit, from_u32, from_u32_unchecked}; #[stable(feature = "rust1", since = "1.0.0")] pub use core::char::{EscapeDebug, EscapeDefault, EscapeUnicode}; -#[stable(feature = "char_from_str", since = "1.19.0")] +#[stable(feature = "char_from_str", since = "1.20.0")] pub use core::char::ParseCharError; // unstable reexports -- cgit 1.4.1-3-g733a5 From 133c1bc9ac998d22a0028d2f2e15473f0d1d08ab Mon Sep 17 00:00:00 2001 From: Stefan Schindler Date: Tue, 11 Jul 2017 16:45:39 +0200 Subject: Wrap long line --- src/libstd/macros.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index a45d37b0792..be0d1587aab 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -26,7 +26,8 @@ /// /// # Current implementation /// -/// If the main thread panics it will terminate all your threads and end your program with code `101`. +/// If the main thread panics it will terminate all your threads and end your +/// program with code `101`. /// /// # Examples /// -- cgit 1.4.1-3-g733a5