10
10
11
11
#[ allow( missing_doc) ] ;
12
12
13
- use digest:: Digest ;
14
13
use json;
15
14
use json:: ToJson ;
16
- use sha1:: Sha1 ;
17
15
use serialize:: { Encoder , Encodable , Decoder , Decodable } ;
18
16
use arc:: { Arc , RWArc } ;
19
17
use treemap:: TreeMap ;
@@ -23,7 +21,6 @@ use std::{os, str, task};
23
21
use std:: rt:: io;
24
22
use std:: rt:: io:: Writer ;
25
23
use std:: rt:: io:: Decorator ;
26
- use std:: rt:: io:: extensions:: ReaderUtil ;
27
24
use std:: rt:: io:: mem:: MemWriter ;
28
25
use std:: rt:: io:: file:: FileInfo ;
29
26
@@ -276,19 +273,6 @@ fn json_decode<T:Decodable<json::Decoder>>(s: &str) -> T {
276
273
Decodable :: decode ( & mut decoder)
277
274
}
278
275
279
- fn digest < T : Encodable < json:: Encoder > > ( t : & T ) -> ~str {
280
- let mut sha = ~Sha1 :: new ( ) ;
281
- ( * sha) . input_str ( json_encode ( t) ) ;
282
- ( * sha) . result_str ( )
283
- }
284
-
285
- fn digest_file ( path : & Path ) -> ~str {
286
- let mut sha = ~Sha1 :: new ( ) ;
287
- let s = path. open_reader ( io:: Open ) . read_to_end ( ) ;
288
- ( * sha) . input ( s) ;
289
- ( * sha) . result_str ( )
290
- }
291
-
292
276
impl Context {
293
277
294
278
pub fn new ( db : RWArc < Database > ,
@@ -497,6 +481,8 @@ impl<'self, T:Send +
497
481
#[ test]
498
482
fn test ( ) {
499
483
use std:: { os, run} ;
484
+ use std:: rt:: io:: ReaderUtil ;
485
+ use std:: str:: from_utf8_owned;
500
486
501
487
// Create a path to a new file 'filename' in the directory in which
502
488
// this test is running.
@@ -524,8 +510,10 @@ fn test() {
524
510
let subcx = cx. clone( ) ;
525
511
let pth = pth. clone( ) ;
526
512
513
+ let file_content = from_utf8_owned( pth. open_reader( io:: Open ) . read_to_end( ) ) ;
514
+
527
515
// FIXME (#9639): This needs to handle non-utf8 paths
528
- prep. declare_input( "file" , pth. as_str( ) . unwrap( ) , digest_file ( & pth ) ) ;
516
+ prep. declare_input( "file" , pth. as_str( ) . unwrap( ) , file_content ) ;
529
517
do prep. exec |_exe| {
530
518
let out = make_path( ~"foo. o") ;
531
519
// FIXME (#9639): This needs to handle non-utf8 paths
0 commit comments