Skip to content

Commit 860cb81

Browse files
committed
auto merge of #10022 : hatahet/rust/master, r=alexcrichton
Fixes #9958
2 parents f099593 + dabf377 commit 860cb81

File tree

11 files changed

+67
-320
lines changed

11 files changed

+67
-320
lines changed

src/librustpkg/conditions.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212

1313
pub use std::path::Path;
1414
pub use package_id::PkgId;
15-
pub use std::libc;
16-
pub use std::libc::stat;
15+
pub use std::rt::io::FileStat;
1716

1817
condition! {
1918
pub bad_path: (Path, ~str) -> Path;
2019
}
2120

2221
condition! {
23-
pub bad_stat: (Path, ~str) -> stat;
22+
pub bad_stat: (Path, ~str) -> FileStat;
2423
}
2524

2625
condition! {

src/librustpkg/util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -625,7 +625,7 @@ fn debug_flags() -> ~[~str] { ~[] }
625625
/// Returns the last-modified date as an Option
626626
pub fn datestamp(p: &Path) -> Option<libc::time_t> {
627627
debug!("Scrutinizing datestamp for {} - does it exist? {:?}", p.display(), os::path_exists(p));
628-
let out = p.stat().map(|stat| stat.st_mtime);
628+
let out = p.stat().map(|stat| stat.modified);
629629
debug!("Date = {:?}", out);
630630
out.map(|t| { t as libc::time_t })
631631
}

src/librustpkg/workcache_support.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ pub fn digest_file_with_date(path: &Path) -> ~str {
1818
use conditions::bad_path::cond;
1919
use cond1 = conditions::bad_stat::cond;
2020

21-
let mut sha = ~Sha1::new();
2221
let s = io::read_whole_file_str(path);
2322
match s {
2423
Ok(s) => {
25-
(*sha).input_str(s);
24+
let mut sha = Sha1::new();
25+
sha.input_str(s);
2626
let st = match path.stat() {
2727
Some(st) => st,
2828
None => cond1.raise((path.clone(), format!("Couldn't get file access time")))
2929
};
30-
(*sha).input_str(st.st_mtime.to_str());
31-
(*sha).result_str()
30+
sha.input_str(st.modified.to_str());
31+
sha.result_str()
3232
}
3333
Err(e) => {
3434
let path = cond.raise((path.clone(), format!("Couldn't read file: {}", e)));
@@ -43,13 +43,13 @@ pub fn digest_file_with_date(path: &Path) -> ~str {
4343
pub fn digest_only_date(path: &Path) -> ~str {
4444
use cond = conditions::bad_stat::cond;
4545

46-
let mut sha = ~Sha1::new();
46+
let mut sha = Sha1::new();
4747
let st = match path.stat() {
4848
Some(st) => st,
4949
None => cond.raise((path.clone(), format!("Couldn't get file access time")))
5050
};
51-
(*sha).input_str(st.st_mtime.to_str());
52-
(*sha).result_str()
51+
sha.input_str(st.modified.to_str());
52+
sha.result_str()
5353
}
5454

5555
/// Adds multiple discovered outputs

src/libstd/path/mod.rs

+1-223
Original file line numberDiff line numberDiff line change
@@ -688,228 +688,6 @@ fn from_utf8_with_replacement(mut v: &[u8]) -> ~str {
688688
}
689689
s
690690
}
691-
692-
// FIXME (#9537): libc::stat should derive Default
693-
#[cfg(target_os = "linux")]
694-
#[cfg(target_os = "android")]
695-
mod stat {
696-
#[allow(missing_doc)];
697-
698-
#[cfg(target_arch = "x86")]
699-
pub mod arch {
700-
use libc;
701-
702-
pub fn default_stat() -> libc::stat {
703-
libc::stat {
704-
st_dev: 0,
705-
__pad1: 0,
706-
st_ino: 0,
707-
st_mode: 0,
708-
st_nlink: 0,
709-
st_uid: 0,
710-
st_gid: 0,
711-
st_rdev: 0,
712-
__pad2: 0,
713-
st_size: 0,
714-
st_blksize: 0,
715-
st_blocks: 0,
716-
st_atime: 0,
717-
st_atime_nsec: 0,
718-
st_mtime: 0,
719-
st_mtime_nsec: 0,
720-
st_ctime: 0,
721-
st_ctime_nsec: 0,
722-
__unused4: 0,
723-
__unused5: 0,
724-
}
725-
}
726-
}
727-
728-
#[cfg(target_arch = "arm")]
729-
pub mod arch {
730-
use libc;
731-
732-
pub fn default_stat() -> libc::stat {
733-
libc::stat {
734-
st_dev: 0,
735-
__pad0: [0, ..4],
736-
__st_ino: 0,
737-
st_mode: 0,
738-
st_nlink: 0,
739-
st_uid: 0,
740-
st_gid: 0,
741-
st_rdev: 0,
742-
__pad3: [0, ..4],
743-
st_size: 0,
744-
st_blksize: 0,
745-
st_blocks: 0,
746-
st_atime: 0,
747-
st_atime_nsec: 0,
748-
st_mtime: 0,
749-
st_mtime_nsec: 0,
750-
st_ctime: 0,
751-
st_ctime_nsec: 0,
752-
st_ino: 0
753-
}
754-
}
755-
}
756-
757-
#[cfg(target_arch = "mips")]
758-
pub mod arch {
759-
use libc;
760-
761-
pub fn default_stat() -> libc::stat {
762-
libc::stat {
763-
st_dev: 0,
764-
st_pad1: [0, ..3],
765-
st_ino: 0,
766-
st_mode: 0,
767-
st_nlink: 0,
768-
st_uid: 0,
769-
st_gid: 0,
770-
st_rdev: 0,
771-
st_pad2: [0, ..2],
772-
st_size: 0,
773-
st_pad3: 0,
774-
st_atime: 0,
775-
st_atime_nsec: 0,
776-
st_mtime: 0,
777-
st_mtime_nsec: 0,
778-
st_ctime: 0,
779-
st_ctime_nsec: 0,
780-
st_blksize: 0,
781-
st_blocks: 0,
782-
st_pad5: [0, ..14],
783-
}
784-
}
785-
}
786-
787-
#[cfg(target_arch = "x86_64")]
788-
pub mod arch {
789-
use libc;
790-
791-
pub fn default_stat() -> libc::stat {
792-
libc::stat {
793-
st_dev: 0,
794-
st_ino: 0,
795-
st_nlink: 0,
796-
st_mode: 0,
797-
st_uid: 0,
798-
st_gid: 0,
799-
__pad0: 0,
800-
st_rdev: 0,
801-
st_size: 0,
802-
st_blksize: 0,
803-
st_blocks: 0,
804-
st_atime: 0,
805-
st_atime_nsec: 0,
806-
st_mtime: 0,
807-
st_mtime_nsec: 0,
808-
st_ctime: 0,
809-
st_ctime_nsec: 0,
810-
__unused: [0, 0, 0],
811-
}
812-
}
813-
}
814-
}
815-
816-
#[cfg(target_os = "freebsd")]
817-
mod stat {
818-
#[allow(missing_doc)];
819-
820-
#[cfg(target_arch = "x86_64")]
821-
pub mod arch {
822-
use libc;
823-
824-
pub fn default_stat() -> libc::stat {
825-
libc::stat {
826-
st_dev: 0,
827-
st_ino: 0,
828-
st_mode: 0,
829-
st_nlink: 0,
830-
st_uid: 0,
831-
st_gid: 0,
832-
st_rdev: 0,
833-
st_atime: 0,
834-
st_atime_nsec: 0,
835-
st_mtime: 0,
836-
st_mtime_nsec: 0,
837-
st_ctime: 0,
838-
st_ctime_nsec: 0,
839-
st_size: 0,
840-
st_blocks: 0,
841-
st_blksize: 0,
842-
st_flags: 0,
843-
st_gen: 0,
844-
st_lspare: 0,
845-
st_birthtime: 0,
846-
st_birthtime_nsec: 0,
847-
__unused: [0, 0],
848-
}
849-
}
850-
}
851-
}
852-
853-
#[cfg(target_os = "macos")]
854-
mod stat {
855-
#[allow(missing_doc)];
856-
857-
pub mod arch {
858-
use libc;
859-
860-
pub fn default_stat() -> libc::stat {
861-
libc::stat {
862-
st_dev: 0,
863-
st_mode: 0,
864-
st_nlink: 0,
865-
st_ino: 0,
866-
st_uid: 0,
867-
st_gid: 0,
868-
st_rdev: 0,
869-
st_atime: 0,
870-
st_atime_nsec: 0,
871-
st_mtime: 0,
872-
st_mtime_nsec: 0,
873-
st_ctime: 0,
874-
st_ctime_nsec: 0,
875-
st_birthtime: 0,
876-
st_birthtime_nsec: 0,
877-
st_size: 0,
878-
st_blocks: 0,
879-
st_blksize: 0,
880-
st_flags: 0,
881-
st_gen: 0,
882-
st_lspare: 0,
883-
st_qspare: [0, 0],
884-
}
885-
}
886-
}
887-
}
888-
889-
#[cfg(target_os = "win32")]
890-
mod stat {
891-
#[allow(missing_doc)];
892-
893-
pub mod arch {
894-
use libc;
895-
pub fn default_stat() -> libc::stat {
896-
libc::stat {
897-
st_dev: 0,
898-
st_ino: 0,
899-
st_mode: 0,
900-
st_nlink: 0,
901-
st_uid: 0,
902-
st_gid: 0,
903-
st_rdev: 0,
904-
st_size: 0,
905-
st_atime: 0,
906-
st_mtime: 0,
907-
st_ctime: 0,
908-
}
909-
}
910-
}
911-
}
912-
913691
#[cfg(test)]
914692
mod tests {
915693
use super::{GenericPath, PosixPath, WindowsPath};
@@ -921,7 +699,7 @@ mod tests {
921699
let path: PosixPath = PosixPath::new(input.to_c_str());
922700
assert_eq!(path.as_vec(), input.as_bytes());
923701

924-
let input = "\\foo\\bar\\baz";
702+
let input = r"\foo\bar\baz";
925703
let path: WindowsPath = WindowsPath::new(input.to_c_str());
926704
assert_eq!(path.as_str().unwrap(), input.as_slice());
927705
}

0 commit comments

Comments
 (0)