diff options
| author | bors <bors@rust-lang.org> | 2015-10-15 10:58:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-10-15 10:58:37 +0000 |
| commit | 1ad1b7d947b389d71b5d150d2fe92a6311c21c28 (patch) | |
| tree | b9766c17986cbca41b77bf9ae5247e0f2dbbf5bb /src/libstd/sys | |
| parent | 9c9615eb6f59acc394e338d529f22273fe3a1cd7 (diff) | |
| parent | b40163beb925b176fdb570e4f4998ab9919e77a4 (diff) | |
| download | rust-1ad1b7d947b389d71b5d150d2fe92a6311c21c28.tar.gz rust-1ad1b7d947b389d71b5d150d2fe92a6311c21c28.zip | |
Auto merge of #29021 - ogham:master, r=alexcrichton
This commit adds `#[derive(Clone)]` to `std::fs::Metadata`, making that struct cloneable. Although the exact contents of that struct differ between OSes, they all have it contain only value types, meaning that the data can be re-used without repercussions. It also adds `#[derive(Clone)]` to every type used by that struct across all OSes, including the various Unix `stat` structs and Windows's `WIN32_FILE_ATTRIBUTE_DATA`. This stems from my comment here: https://github.com/rust-lang/rfcs/issues/939#issuecomment-140524439
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/unix/fs.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sys/windows/c.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sys/windows/fs.rs | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 0eebe5af919..d0c027ddad6 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -27,6 +27,7 @@ use vec::Vec; pub struct File(FileDesc); +#[derive(Clone)] pub struct FileAttr { stat: raw::stat, } diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 30c7e5a52b7..bac5b47eb1a 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -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, diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs index 721e259823a..fb2456564eb 100644 --- a/src/libstd/sys/windows/fs.rs +++ b/src/libstd/sys/windows/fs.rs @@ -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, |
