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

Make the Metadata struct Clone #29021

Merged
merged 1 commit into from
Oct 15, 2015
Merged
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
1 change: 1 addition & 0 deletions src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub struct File {
/// represents known metadata about a file such as its permissions, size,
/// modification times, etc.
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Clone)]
pub struct Metadata(fs_imp::FileAttr);

/// Iterator over the entries in a directory.
Expand Down
2 changes: 2 additions & 0 deletions src/libstd/os/android/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ mod arch {
pub type time_t = i32;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down Expand Up @@ -108,6 +109,7 @@ mod arch {
pub type time_t = i64;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down
1 change: 1 addition & 0 deletions src/libstd/os/bitrig/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use os::unix::raw::{uid_t, gid_t};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down
1 change: 1 addition & 0 deletions src/libstd/os/dragonfly/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use os::unix::raw::{uid_t, gid_t};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down
2 changes: 2 additions & 0 deletions src/libstd/os/freebsd/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ mod arch {
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i32;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down Expand Up @@ -91,6 +92,7 @@ mod arch {
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down
1 change: 1 addition & 0 deletions src/libstd/os/ios/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use os::unix::raw::{uid_t, gid_t};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = c_long;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down
4 changes: 4 additions & 0 deletions src/libstd/os/linux/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ mod arch {
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i32;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down Expand Up @@ -95,6 +96,7 @@ mod arch {
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i32;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down Expand Up @@ -154,6 +156,7 @@ mod arch {
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down Expand Up @@ -211,6 +214,7 @@ mod arch {
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down
1 change: 1 addition & 0 deletions src/libstd/os/macos/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use os::unix::raw::{uid_t, gid_t};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = c_long;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down
4 changes: 4 additions & 0 deletions src/libstd/os/nacl/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ mod arch {
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i32;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down Expand Up @@ -94,6 +95,7 @@ mod arch {
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i32;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down Expand Up @@ -153,6 +155,7 @@ mod arch {
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down Expand Up @@ -210,6 +213,7 @@ mod arch {
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down
1 change: 1 addition & 0 deletions src/libstd/os/netbsd/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use os::unix::raw::{uid_t, gid_t};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down
1 change: 1 addition & 0 deletions src/libstd/os/openbsd/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use os::unix::raw::{uid_t, gid_t};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
Expand Down
1 change: 1 addition & 0 deletions src/libstd/sys/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use vec::Vec;

pub struct File(FileDesc);

#[derive(Clone)]
pub struct FileAttr {
stat: raw::stat,
}
Expand Down
1 change: 1 addition & 0 deletions src/libstd/sys/windows/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ pub struct CONSOLE_SCREEN_BUFFER_INFO {
pub type PCONSOLE_SCREEN_BUFFER_INFO = *mut CONSOLE_SCREEN_BUFFER_INFO;

#[repr(C)]
#[derive(Clone)]
pub struct WIN32_FILE_ATTRIBUTE_DATA {
pub dwFileAttributes: libc::DWORD,
pub ftCreationTime: libc::FILETIME,
Expand Down
1 change: 1 addition & 0 deletions src/libstd/sys/windows/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use vec::Vec;

pub struct File { handle: Handle }

#[derive(Clone)]
pub struct FileAttr {
data: c::WIN32_FILE_ATTRIBUTE_DATA,
reparse_tag: libc::DWORD,
Expand Down