1 #![allow(non_camel_case_types)]
3 use rustc_data_structures
::sync
::Lock
;
6 use std
::time
::{Duration, Instant}
;
11 pub use rustc_errors
::ErrorReported
;
13 pub fn to_readable_str(mut val
: usize) -> String
{
14 let mut groups
= vec
![];
16 let group
= val
% 1000;
21 groups
.push(group
.to_string());
24 groups
.push(format
!("{:03}", group
));
33 pub fn record_time
<T
, F
>(accu
: &Lock
<Duration
>, f
: F
) -> T
37 let start
= Instant
::now();
39 let duration
= start
.elapsed();
40 let mut accu
= accu
.lock();
41 *accu
= *accu
+ duration
;
45 pub fn indent
<R
, F
>(op
: F
) -> R
50 // Use in conjunction with the log post-processor like `src/etc/indenter`
51 // to make debug output more readable.
54 debug
!("<< (Result = {:?})", r
);
59 _cannot_construct_outside_of_this_module
: (),
62 impl Drop
for Indenter
{
68 pub fn indenter() -> Indenter
{
70 Indenter { _cannot_construct_outside_of_this_module: () }