提交 52309797 编写于 作者: B bors

Auto merge of #50894 - teiesti:stabilize_path_ancestors, r=dtolnay

Stabilize std::path::Path::ancestors

Closes #48581

r? @BurntSushi
......@@ -1042,8 +1042,6 @@ fn cmp(&self, other: &Components<'a>) -> cmp::Ordering {
/// # Examples
///
/// ```
/// #![feature(path_ancestors)]
///
/// use std::path::Path;
///
/// let path = Path::new("/foo/bar");
......@@ -1056,12 +1054,12 @@ fn cmp(&self, other: &Components<'a>) -> cmp::Ordering {
/// [`ancestors`]: struct.Path.html#method.ancestors
/// [`Path`]: struct.Path.html
#[derive(Copy, Clone, Debug)]
#[unstable(feature = "path_ancestors", issue = "48581")]
#[stable(feature = "path_ancestors", since = "1.28.0")]
pub struct Ancestors<'a> {
next: Option<&'a Path>,
}
#[unstable(feature = "path_ancestors", issue = "48581")]
#[stable(feature = "path_ancestors", since = "1.28.0")]
impl<'a> Iterator for Ancestors<'a> {
type Item = &'a Path;
......@@ -1075,7 +1073,7 @@ fn next(&mut self) -> Option<Self::Item> {
}
}
#[unstable(feature = "path_ancestors", issue = "48581")]
#[stable(feature = "path_ancestors", since = "1.28.0")]
impl<'a> FusedIterator for Ancestors<'a> {}
////////////////////////////////////////////////////////////////////////////////
......@@ -1890,8 +1888,6 @@ pub fn parent(&self) -> Option<&Path> {
/// # Examples
///
/// ```
/// #![feature(path_ancestors)]
///
/// use std::path::Path;
///
/// let mut ancestors = Path::new("/foo/bar").ancestors();
......@@ -1903,7 +1899,7 @@ pub fn parent(&self) -> Option<&Path> {
///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`parent`]: struct.Path.html#method.parent
#[unstable(feature = "path_ancestors", issue = "48581")]
#[stable(feature = "path_ancestors", since = "1.28.0")]
pub fn ancestors(&self) -> Ancestors {
Ancestors {
next: Some(&self),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册