Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seal MetadataExt on all platforms #118916

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions library/std/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ pub struct File {
#[derive(Clone)]
pub struct Metadata(fs_imp::FileAttr);

/// Allows extension traits within `std`.
#[unstable(feature = "sealed", issue = "none")]
impl crate::sealed::Sealed for Metadata {}

/// Iterator over the entries in a directory.
///
/// This iterator is returned from the [`read_dir`] function of this module and
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/aix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Returns the device ID on which this file resides.
///
/// # Examples
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/android/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

#[allow(deprecated)]
Expand All @@ -10,7 +11,7 @@ use crate::os::android::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/dragonfly/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

#[allow(deprecated)]
Expand All @@ -10,7 +11,7 @@ use crate::os::dragonfly::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/emscripten/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

#[allow(deprecated)]
Expand All @@ -10,7 +11,7 @@ use crate::os::emscripten::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/espidf/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

#[allow(deprecated)]
Expand All @@ -10,7 +11,7 @@ use crate::os::espidf::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
#[stable(feature = "metadata_ext", since = "1.1.0")]
#[deprecated(
since = "1.8.0",
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/freebsd/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

#[allow(deprecated)]
Expand All @@ -10,7 +11,7 @@ use crate::os::freebsd::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/fuchsia/fs.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_dev(&self) -> u64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/haiku/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

#[allow(deprecated)]
Expand All @@ -10,7 +11,7 @@ use crate::os::haiku::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/horizon/fs.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_dev(&self) -> u64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/hurd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Returns the device ID on which this file resides.
///
/// # Examples
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/illumos/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

#[allow(deprecated)]
Expand All @@ -10,7 +11,7 @@ use crate::os::illumos::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/os/ios/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use super::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/l4re/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

#[allow(deprecated)]
Expand All @@ -14,7 +15,7 @@ use crate::os::l4re::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/linux/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

#[allow(deprecated)]
Expand All @@ -14,7 +15,7 @@ use crate::os::linux::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/os/macos/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::os::macos::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/netbsd/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

#[allow(deprecated)]
Expand All @@ -10,7 +11,7 @@ use crate::os::netbsd::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/nto/fs.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_dev(&self) -> u64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/openbsd/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

#[allow(deprecated)]
Expand All @@ -10,7 +11,7 @@ use crate::os::openbsd::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/redox/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

#[allow(deprecated)]
Expand All @@ -10,7 +11,7 @@ use crate::os::redox::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/solaris/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

#[allow(deprecated)]
Expand All @@ -10,7 +11,7 @@ use crate::os::solaris::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/os/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ impl OpenOptionsExt for OpenOptions {

/// Unix-specific extensions to [`fs::Metadata`].
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Returns the ID of the device containing the file.
///
/// # Examples
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/vita/fs.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_dev(&self) -> u64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/os/vxworks/fs.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]

use crate::fs::Metadata;
use crate::sealed::Sealed;
use crate::sys_common::AsInner;

///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_dev(&self) -> u64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/os/wasi/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::ffi::OsStr;
use crate::fs::{self, File, Metadata, OpenOptions};
use crate::io::{self, IoSlice, IoSliceMut};
use crate::path::{Path, PathBuf};
use crate::sealed::Sealed;
use crate::sys_common::{AsInner, AsInnerMut, FromInner};
// Used for `File::read` on intra-doc links
#[allow(unused_imports)]
Expand Down Expand Up @@ -410,7 +411,7 @@ impl OpenOptionsExt for OpenOptions {
}

/// WASI-specific extensions to [`fs::Metadata`].
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Returns the `st_dev` field of the internal `filestat_t`
fn dev(&self) -> u64;
/// Returns the `st_ino` field of the internal `filestat_t`
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/os/watchos/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::os::watchos::raw;
///
/// [`fs::Metadata`]: crate::fs::Metadata
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
pub trait MetadataExt: Sealed {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
Expand Down
Loading