std: Stabilize library APIs for 1.5
This commit stabilizes and deprecates library APIs whose FCP has closed in the last cycle, specifically: Stabilized APIs: * `fs::canonicalize` * `Path::{metadata, symlink_metadata, canonicalize, read_link, read_dir, exists, is_file, is_dir}` - all moved to inherent methods from the `PathExt` trait. * `Formatter::fill` * `Formatter::width` * `Formatter::precision` * `Formatter::sign_plus` * `Formatter::sign_minus` * `Formatter::alternate` * `Formatter::sign_aware_zero_pad` * `string::ParseError` * `Utf8Error::valid_up_to` * `Iterator::{cmp, partial_cmp, eq, ne, lt, le, gt, ge}` * `<[T]>::split_{first,last}{,_mut}` * `Condvar::wait_timeout` - note that `wait_timeout_ms` is not yet deprecated but will be once 1.5 is released. * `str::{R,}MatchIndices` * `str::{r,}match_indices` * `char::from_u32_unchecked` * `VecDeque::insert` * `VecDeque::shrink_to_fit` * `VecDeque::as_slices` * `VecDeque::as_mut_slices` * `VecDeque::swap_remove_front` - (renamed from `swap_front_remove`) * `VecDeque::swap_remove_back` - (renamed from `swap_back_remove`) * `Vec::resize` * `str::slice_mut_unchecked` * `FileTypeExt` * `FileTypeExt::{is_block_device, is_char_device, is_fifo, is_socket}` * `BinaryHeap::from` - `from_vec` deprecated in favor of this * `BinaryHeap::into_vec` - plus a `Into` impl * `BinaryHeap::into_sorted_vec` Deprecated APIs * `slice::ref_slice` * `slice::mut_ref_slice` * `iter::{range_inclusive, RangeInclusive}` * `std::dynamic_lib` Closes #27706 Closes #27725 cc #27726 (align not stabilized yet) Closes #27734 Closes #27737 Closes #27742 Closes #27743 Closes #27772 Closes #27774 Closes #27777 Closes #27781 cc #27788 (a few remaining methods though) Closes #27790 Closes #27793 Closes #27796 Closes #27810 cc #28147 (not all parts stabilized)
This commit is contained in:
parent
9a855668fc
commit
ff49733274
60 changed files with 274 additions and 195 deletions
|
@ -955,8 +955,21 @@ pub fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
|||
|
||||
/// Returns the canonical form of a path with all intermediate components
|
||||
/// normalized and symbolic links resolved.
|
||||
#[unstable(feature = "fs_canonicalize", reason = "recently added API",
|
||||
issue = "27706")]
|
||||
///
|
||||
/// This function may return an error in situations like where the path does not
|
||||
/// exist, a component in the path is not a directory, or an I/O error happens.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
///
|
||||
/// # fn foo() -> std::io::Result<()> {
|
||||
/// let path = try!(fs::canonicalize("../a/../foo.txt"));
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "fs_canonicalize", since = "1.5.0")]
|
||||
pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
||||
fs_imp::canonicalize(path.as_ref())
|
||||
}
|
||||
|
@ -1158,11 +1171,12 @@ impl Iterator for WalkDir {
|
|||
}
|
||||
|
||||
/// Utility methods for paths.
|
||||
#[unstable(feature = "path_ext",
|
||||
#[unstable(feature = "path_ext_deprecated",
|
||||
reason = "The precise set of methods exposed on this trait may \
|
||||
change and some methods may be removed. For stable code, \
|
||||
see the std::fs::metadata function.",
|
||||
issue = "27725")]
|
||||
#[deprecated(since = "1.5.0", reason = "replaced with inherent methods")]
|
||||
pub trait PathExt {
|
||||
/// Gets information on the file, directory, etc at this path.
|
||||
///
|
||||
|
@ -1215,6 +1229,7 @@ pub trait PathExt {
|
|||
fn is_dir(&self) -> bool;
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
impl PathExt for Path {
|
||||
fn metadata(&self) -> io::Result<Metadata> { metadata(self) }
|
||||
fn symlink_metadata(&self) -> io::Result<Metadata> { symlink_metadata(self) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue