diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-05-15 14:01:54 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-05-22 21:57:02 -0700 |
| commit | 08e561ae70bc42b755b3831b3ce880745228892c (patch) | |
| tree | 77ded3b004e4d6ec219a04d376889a6007a083de /src | |
| parent | ca9bb2d9ace2bf085dc276e241f6707e0402093f (diff) | |
| download | rust-08e561ae70bc42b755b3831b3ce880745228892c.tar.gz rust-08e561ae70bc42b755b3831b3ce880745228892c.zip | |
librustc: Disable borrow check debugging even when rustc is compiled with -O0.
This improves -O0 compile times dramatically.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/driver/session.rs | 13 | ||||
| -rw-r--r-- | src/librustc/middle/trans/write_guard.rs | 4 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index e2cc285fb7a..a340422d023 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -66,6 +66,7 @@ pub static debug_info: uint = 1 << 20; pub static extra_debug_info: uint = 1 << 21; pub static statik: uint = 1 << 22; pub static print_link_args: uint = 1 << 23; +pub static no_debug_borrows: uint = 1 << 24; pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] { ~[(~"verbose", ~"in general, enable more debug printouts", verbose), @@ -100,7 +101,10 @@ pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] { extra_debug_info), (~"debug-info", ~"Produce debug info (experimental)", debug_info), (~"static", ~"Use or produce static libraries or binaries " + - "(experimental)", statik) + "(experimental)", statik), + (~"no-debug-borrows", + ~"do not show where borrow checks fail", + no_debug_borrows), ] } @@ -141,7 +145,7 @@ pub struct options { parse_only: bool, no_trans: bool, debugging_opts: uint, - android_cross_path: Option<~str> + android_cross_path: Option<~str>, } pub struct crate_metadata { @@ -271,6 +275,9 @@ pub impl Session_ { fn no_monomorphic_collapse(@self) -> bool { self.debugging_opt(no_monomorphic_collapse) } + fn debug_borrows(@self) -> bool { + self.opts.optimize == No && !self.debugging_opt(no_debug_borrows) + } fn str_of(@self, id: ast::ident) -> @~str { self.parse_sess.interner.get(id) @@ -308,7 +315,7 @@ pub fn basic_options() -> @options { parse_only: false, no_trans: false, debugging_opts: 0u, - android_cross_path: None + android_cross_path: None, } } diff --git a/src/librustc/middle/trans/write_guard.rs b/src/librustc/middle/trans/write_guard.rs index 9fd62043112..0d13d27b653 100644 --- a/src/librustc/middle/trans/write_guard.rs +++ b/src/librustc/middle/trans/write_guard.rs @@ -74,7 +74,7 @@ pub fn return_to_mut(mut bcx: block, let bits_val = Load(bcx, bits_val_ref); - if bcx.tcx().sess.opts.optimize == session::No { + if bcx.tcx().sess.debug_borrows() { bcx = callee::trans_lang_call( bcx, bcx.tcx().lang_items.unrecord_borrow_fn(), @@ -160,7 +160,7 @@ fn root(datum: &Datum, ], expr::SaveIn(scratch_bits.val)); - if bcx.tcx().sess.opts.optimize == session::No { + if bcx.tcx().sess.debug_borrows() { bcx = callee::trans_lang_call( bcx, bcx.tcx().lang_items.record_borrow_fn(), |
