about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-01-21 10:06:18 -0800
committerbors <bors@rust-lang.org>2014-01-21 10:06:18 -0800
commit232d8e560561e07b3ba54c5d0234816e50342fb3 (patch)
tree1d831edd0cab59bd97fb8e0acbd4bc2cb9e7b07c /src
parent43cffe9d719170bd342b10d1bb81911f0e14a7c4 (diff)
parentd84c3369f732233adf0a80056d43dbc36d813aae (diff)
downloadrust-232d8e560561e07b3ba54c5d0234816e50342fb3.tar.gz
rust-232d8e560561e07b3ba54c5d0234816e50342fb3.zip
auto merge of #11665 : alexcrichton/rust/zed-cleanup, r=brson
* Stop using hardcoded numbers that have to all get updated when something changes (inevitable errors and rebase conflicts) as well as removes some unneeded -Z options (obsoleted over time).
* Remove `std::rt::borrowck`
Diffstat (limited to 'src')
-rw-r--r--src/librustc/back/link.rs5
-rw-r--r--src/librustc/driver/driver.rs16
-rw-r--r--src/librustc/driver/session.rs196
-rw-r--r--src/librustdoc/test.rs2
-rw-r--r--src/libstd/rt/borrowck.rs220
-rw-r--r--src/libstd/rt/mod.rs3
-rw-r--r--src/libstd/rt/task.rs8
-rw-r--r--src/libstd/unstable/lang.rs40
8 files changed, 105 insertions, 385 deletions
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index 101b2e36bd6..06c13c7de15 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -126,7 +126,7 @@ pub mod write {
               session::Default => lib::llvm::CodeGenLevelDefault,
               session::Aggressive => lib::llvm::CodeGenLevelAggressive,
             };
-            let use_softfp = sess.opts.debugging_opts & session::use_softfp != 0;
+            let use_softfp = sess.opts.debugging_opts & session::USE_SOFTFP != 0;
 
             let tm = sess.targ_cfg.target_strs.target_triple.with_c_str(|T| {
                 sess.opts.target_cpu.with_c_str(|CPU| {
@@ -156,7 +156,6 @@ pub mod write {
                 pass.with_c_str(|s| llvm::LLVMRustAddPass(fpm, s))
             };
             if !sess.no_verify() { assert!(addpass("verify")); }
-            if sess.lint_llvm()  { assert!(addpass("lint"));   }
 
             if !sess.no_prepopulate_passes() {
                 llvm::LLVMRustAddAnalysisPasses(tm, fpm, llmod);
@@ -988,7 +987,7 @@ fn link_natively(sess: Session, dylib: bool, obj_filename: &Path,
     let mut cc_args = sess.targ_cfg.target_strs.cc_args.clone();
     cc_args.push_all_move(link_args(sess, dylib, tmpdir.path(),
                                     obj_filename, out_filename));
-    if (sess.opts.debugging_opts & session::print_link_args) != 0 {
+    if (sess.opts.debugging_opts & session::PRINT_LINK_ARGS) != 0 {
         println!("{} link args: '{}'", cc_prog, cc_args.connect("' '"));
     }
 
diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs
index 9555a706f08..dcab4376cd1 100644
--- a/src/librustc/driver/driver.rs
+++ b/src/librustc/driver/driver.rs
@@ -759,22 +759,22 @@ pub fn build_session_options(binary: ~str,
         }
     }
 
-    let mut debugging_opts = 0u;
+    let mut debugging_opts = 0;
     let debug_flags = matches.opt_strs("Z");
     let debug_map = session::debugging_opts_map();
     for debug_flag in debug_flags.iter() {
-        let mut this_bit = 0u;
+        let mut this_bit = 0;
         for tuple in debug_map.iter() {
             let (name, bit) = match *tuple { (ref a, _, b) => (a, b) };
             if *name == *debug_flag { this_bit = bit; break; }
         }
-        if this_bit == 0u {
+        if this_bit == 0 {
             early_error(demitter, format!("unknown debug flag: {}", *debug_flag))
         }
         debugging_opts |= this_bit;
     }
 
-    if debugging_opts & session::debug_llvm != 0 {
+    if debugging_opts & session::DEBUG_LLVM != 0 {
         unsafe { llvm::LLVMSetDebug(1); }
     }
 
@@ -797,7 +797,7 @@ pub fn build_session_options(binary: ~str,
     let target_feature = matches.opt_str("target-feature").unwrap_or(~"");
     let save_temps = matches.opt_present("save-temps");
     let opt_level = {
-        if (debugging_opts & session::no_opt) != 0 {
+        if (debugging_opts & session::NO_OPT) != 0 {
             No
         } else if matches.opt_present("O") {
             if matches.opt_present("opt-level") {
@@ -816,9 +816,9 @@ pub fn build_session_options(binary: ~str,
             }
         } else { No }
     };
-    let gc = debugging_opts & session::gc != 0;
-    let extra_debuginfo = debugging_opts & session::extra_debug_info != 0;
-    let debuginfo = debugging_opts & session::debug_info != 0 ||
+    let gc = debugging_opts & session::GC != 0;
+    let extra_debuginfo = debugging_opts & session::EXTRA_DEBUG_INFO != 0;
+    let debuginfo = debugging_opts & session::DEBUG_INFO != 0 ||
         extra_debuginfo;
 
     let addl_lib_search_paths = matches.opt_strs("L").map(|s| {
diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs
index ebd6c06e243..75094bc8084 100644
--- a/src/librustc/driver/session.rs
+++ b/src/librustc/driver/session.rs
@@ -39,89 +39,91 @@ pub struct Config {
     uint_type: UintTy,
 }
 
-pub static verbose:                 uint = 1 <<  0;
-pub static time_passes:             uint = 1 <<  1;
-pub static count_llvm_insns:        uint = 1 <<  2;
-pub static time_llvm_passes:        uint = 1 <<  3;
-pub static trans_stats:             uint = 1 <<  4;
-pub static asm_comments:            uint = 1 <<  5;
-pub static no_verify:               uint = 1 <<  6;
-pub static borrowck_stats:          uint = 1 <<  7;
-pub static borrowck_note_pure:      uint = 1 <<  8;
-pub static borrowck_note_loan:      uint = 1 <<  9;
-pub static no_landing_pads:         uint = 1 << 10;
-pub static debug_llvm:              uint = 1 << 11;
-pub static count_type_sizes:        uint = 1 << 12;
-pub static meta_stats:              uint = 1 << 13;
-pub static no_opt:                  uint = 1 << 14;
-pub static gc:                      uint = 1 << 15;
-pub static debug_info:              uint = 1 << 16;
-pub static extra_debug_info:        uint = 1 << 17;
-pub static print_link_args:         uint = 1 << 18;
-pub static no_debug_borrows:        uint = 1 << 19;
-pub static lint_llvm:               uint = 1 << 20;
-pub static print_llvm_passes:       uint = 1 << 21;
-pub static no_vectorize_loops:      uint = 1 << 22;
-pub static no_vectorize_slp:        uint = 1 << 23;
-pub static no_prepopulate_passes:   uint = 1 << 24;
-pub static use_softfp:              uint = 1 << 25;
-pub static gen_crate_map:           uint = 1 << 26;
-pub static prefer_dynamic:          uint = 1 << 27;
-pub static no_integrated_as:        uint = 1 << 28;
-pub static lto:                     uint = 1 << 29;
+macro_rules! debugging_opts(
+    ([ $opt:ident ] $cnt:expr ) => (
+        pub static $opt: u64 = 1 << $cnt;
+    );
+    ([ $opt:ident, $($rest:ident),* ] $cnt:expr ) => (
+        pub static $opt: u64 = 1 << $cnt;
+        debugging_opts!([ $($rest),* ] $cnt + 1)
+    )
+)
 
-pub fn debugging_opts_map() -> ~[(&'static str, &'static str, uint)] {
-    ~[("verbose", "in general, enable more debug printouts", verbose),
-     ("time-passes", "measure time of each rustc pass", time_passes),
+debugging_opts!(
+    [
+        VERBOSE,
+        TIME_PASSES,
+        COUNT_LLVM_INSNS,
+        TIME_LLVM_PASSES,
+        TRANS_STATS,
+        ASM_COMMENTS,
+        NO_VERIFY,
+        BORROWCK_STATS,
+        NO_LANDING_PADS,
+        DEBUG_LLVM,
+        COUNT_TYPE_SIZES,
+        META_STATS,
+        NO_OPT,
+        GC,
+        DEBUG_INFO,
+        EXTRA_DEBUG_INFO,
+        PRINT_LINK_ARGS,
+        PRINT_LLVM_PASSES,
+        NO_VECTORIZE_LOOPS,
+        NO_VECTORIZE_SLP,
+        NO_PREPOPULATE_PASSES,
+        USE_SOFTFP,
+        GEN_CRATE_MAP,
+        PREFER_DYNAMIC,
+        NO_INTEGRATED_AS,
+        LTO
+    ]
+    0
+)
+
+pub fn debugging_opts_map() -> ~[(&'static str, &'static str, u64)] {
+    ~[("verbose", "in general, enable more debug printouts", VERBOSE),
+     ("time-passes", "measure time of each rustc pass", TIME_PASSES),
      ("count-llvm-insns", "count where LLVM \
-                           instrs originate", count_llvm_insns),
+                           instrs originate", COUNT_LLVM_INSNS),
      ("time-llvm-passes", "measure time of each LLVM pass",
-      time_llvm_passes),
-     ("trans-stats", "gather trans statistics", trans_stats),
-     ("asm-comments", "generate comments into the assembly (may change behavior)", asm_comments),
-     ("no-verify", "skip LLVM verification", no_verify),
-     ("borrowck-stats", "gather borrowck statistics",  borrowck_stats),
-     ("borrowck-note-pure", "note where purity is req'd",
-      borrowck_note_pure),
-     ("borrowck-note-loan", "note where loans are req'd",
-      borrowck_note_loan),
+      TIME_LLVM_PASSES),
+     ("trans-stats", "gather trans statistics", TRANS_STATS),
+     ("asm-comments", "generate comments into the assembly (may change behavior)",
+      ASM_COMMENTS),
+     ("no-verify", "skip LLVM verification", NO_VERIFY),
+     ("borrowck-stats", "gather borrowck statistics",  BORROWCK_STATS),
      ("no-landing-pads", "omit landing pads for unwinding",
-      no_landing_pads),
-     ("debug-llvm", "enable debug output from LLVM", debug_llvm),
+      NO_LANDING_PADS),
+     ("debug-llvm", "enable debug output from LLVM", DEBUG_LLVM),
      ("count-type-sizes", "count the sizes of aggregate types",
-      count_type_sizes),
-     ("meta-stats", "gather metadata statistics", meta_stats),
-     ("no-opt", "do not optimize, even if -O is passed", no_opt),
-     ("print-link-args", "Print the arguments passed to the linker", print_link_args),
-     ("gc", "Garbage collect shared data (experimental)", gc),
+      COUNT_TYPE_SIZES),
+     ("meta-stats", "gather metadata statistics", META_STATS),
+     ("no-opt", "do not optimize, even if -O is passed", NO_OPT),
+     ("print-link-args", "Print the arguments passed to the linker",
+      PRINT_LINK_ARGS),
+     ("gc", "Garbage collect shared data (experimental)", GC),
      ("extra-debug-info", "Extra debugging info (experimental)",
-      extra_debug_info),
-     ("debug-info", "Produce debug info (experimental)", debug_info),
-     ("no-debug-borrows",
-      "do not show where borrow checks fail",
-      no_debug_borrows),
-     ("lint-llvm",
-      "Run the LLVM lint pass on the pre-optimization IR",
-      lint_llvm),
+      EXTRA_DEBUG_INFO),
+     ("debug-info", "Produce debug info (experimental)", DEBUG_INFO),
      ("print-llvm-passes",
       "Prints the llvm optimization passes being run",
-      print_llvm_passes),
+      PRINT_LLVM_PASSES),
      ("no-prepopulate-passes",
       "Don't pre-populate the pass managers with a list of passes, only use \
         the passes from --passes",
-      no_prepopulate_passes),
+      NO_PREPOPULATE_PASSES),
      ("no-vectorize-loops",
       "Don't run the loop vectorization optimization passes",
-      no_vectorize_loops),
-     ("no-vectorize-slp",
-      "Don't run LLVM's SLP vectorization passes",
-      no_vectorize_slp),
-     ("soft-float", "Generate software floating point library calls", use_softfp),
-     ("gen-crate-map", "Force generation of a toplevel crate map", gen_crate_map),
-     ("prefer-dynamic", "Prefer dynamic linking to static linking", prefer_dynamic),
+      NO_VECTORIZE_LOOPS),
+     ("no-vectorize-slp", "Don't run LLVM's SLP vectorization passes",
+      NO_VECTORIZE_SLP),
+     ("soft-float", "Generate software floating point library calls", USE_SOFTFP),
+     ("gen-crate-map", "Force generation of a toplevel crate map", GEN_CRATE_MAP),
+     ("prefer-dynamic", "Prefer dynamic linking to static linking", PREFER_DYNAMIC),
      ("no-integrated-as",
-      "Use external assembler rather than LLVM's integrated one", no_integrated_as),
-     ("lto", "Perform LLVM link-time optimizations", lto),
+      "Use external assembler rather than LLVM's integrated one", NO_INTEGRATED_AS),
+     ("lto", "Perform LLVM link-time optimizations", LTO),
     ]
 }
 
@@ -168,7 +170,7 @@ pub struct Options {
     parse_only: bool,
     no_trans: bool,
     no_analysis: bool,
-    debugging_opts: uint,
+    debugging_opts: u64,
     android_cross_path: Option<~str>,
     /// Whether to write dependency files. It's (enabled, optional filename).
     write_dependency_info: (bool, Option<Path>),
@@ -291,66 +293,56 @@ impl Session_ {
     pub fn diagnostic(&self) -> @diagnostic::SpanHandler {
         self.span_diagnostic
     }
-    pub fn debugging_opt(&self, opt: uint) -> bool {
-        (self.opts.debugging_opts & opt) != 0u
+    pub fn debugging_opt(&self, opt: u64) -> bool {
+        (self.opts.debugging_opts & opt) != 0
     }
     // This exists to help with refactoring to eliminate impossible
     // cases later on
     pub fn impossible_case(&self, sp: Span, msg: &str) -> ! {
         self.span_bug(sp, format!("Impossible case reached: {}", msg));
     }
-    pub fn verbose(&self) -> bool { self.debugging_opt(verbose) }
-    pub fn time_passes(&self) -> bool { self.debugging_opt(time_passes) }
+    pub fn verbose(&self) -> bool { self.debugging_opt(VERBOSE) }
+    pub fn time_passes(&self) -> bool { self.debugging_opt(TIME_PASSES) }
     pub fn count_llvm_insns(&self) -> bool {
-        self.debugging_opt(count_llvm_insns)
+        self.debugging_opt(COUNT_LLVM_INSNS)
     }
     pub fn count_type_sizes(&self) -> bool {
-        self.debugging_opt(count_type_sizes)
+        self.debugging_opt(COUNT_TYPE_SIZES)
     }
     pub fn time_llvm_passes(&self) -> bool {
-        self.debugging_opt(time_llvm_passes)
-    }
-    pub fn trans_stats(&self) -> bool { self.debugging_opt(trans_stats) }
-    pub fn meta_stats(&self) -> bool { self.debugging_opt(meta_stats) }
-    pub fn asm_comments(&self) -> bool { self.debugging_opt(asm_comments) }
-    pub fn no_verify(&self) -> bool { self.debugging_opt(no_verify) }
-    pub fn lint_llvm(&self) -> bool { self.debugging_opt(lint_llvm) }
-    pub fn borrowck_stats(&self) -> bool { self.debugging_opt(borrowck_stats) }
-    pub fn borrowck_note_pure(&self) -> bool {
-        self.debugging_opt(borrowck_note_pure)
-    }
-    pub fn borrowck_note_loan(&self) -> bool {
-        self.debugging_opt(borrowck_note_loan)
-    }
-    pub fn debug_borrows(&self) -> bool {
-        self.opts.optimize == No && !self.debugging_opt(no_debug_borrows)
+        self.debugging_opt(TIME_LLVM_PASSES)
     }
+    pub fn trans_stats(&self) -> bool { self.debugging_opt(TRANS_STATS) }
+    pub fn meta_stats(&self) -> bool { self.debugging_opt(META_STATS) }
+    pub fn asm_comments(&self) -> bool { self.debugging_opt(ASM_COMMENTS) }
+    pub fn no_verify(&self) -> bool { self.debugging_opt(NO_VERIFY) }
+    pub fn borrowck_stats(&self) -> bool { self.debugging_opt(BORROWCK_STATS) }
     pub fn print_llvm_passes(&self) -> bool {
-        self.debugging_opt(print_llvm_passes)
+        self.debugging_opt(PRINT_LLVM_PASSES)
     }
     pub fn no_prepopulate_passes(&self) -> bool {
-        self.debugging_opt(no_prepopulate_passes)
+        self.debugging_opt(NO_PREPOPULATE_PASSES)
     }
     pub fn no_vectorize_loops(&self) -> bool {
-        self.debugging_opt(no_vectorize_loops)
+        self.debugging_opt(NO_VECTORIZE_LOOPS)
     }
     pub fn no_vectorize_slp(&self) -> bool {
-        self.debugging_opt(no_vectorize_slp)
+        self.debugging_opt(NO_VECTORIZE_SLP)
     }
     pub fn gen_crate_map(&self) -> bool {
-        self.debugging_opt(gen_crate_map)
+        self.debugging_opt(GEN_CRATE_MAP)
     }
     pub fn prefer_dynamic(&self) -> bool {
-        self.debugging_opt(prefer_dynamic)
+        self.debugging_opt(PREFER_DYNAMIC)
     }
     pub fn no_integrated_as(&self) -> bool {
-        self.debugging_opt(no_integrated_as)
+        self.debugging_opt(NO_INTEGRATED_AS)
     }
     pub fn lto(&self) -> bool {
-        self.debugging_opt(lto)
+        self.debugging_opt(LTO)
     }
     pub fn no_landing_pads(&self) -> bool {
-        self.debugging_opt(no_landing_pads)
+        self.debugging_opt(NO_LANDING_PADS)
     }
 
     // pointless function, now...
@@ -396,7 +388,7 @@ pub fn basic_options() -> @Options {
         parse_only: false,
         no_trans: false,
         no_analysis: false,
-        debugging_opts: 0u,
+        debugging_opts: 0,
         android_cross_path: None,
         write_dependency_info: (false, None),
         print_metas: (false, false, false),
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index 53a1e5697ef..4d8df829a94 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -104,7 +104,7 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>) {
         maybe_sysroot: Some(@os::self_exe_path().unwrap().dir_path()),
         addl_lib_search_paths: @RefCell::new(libs),
         outputs: ~[session::OutputExecutable],
-        debugging_opts: session::prefer_dynamic,
+        debugging_opts: session::PREFER_DYNAMIC,
         .. (*session::basic_options()).clone()
     };
 
diff --git a/src/libstd/rt/borrowck.rs b/src/libstd/rt/borrowck.rs
deleted file mode 100644
index 7dcbae995ed..00000000000
--- a/src/libstd/rt/borrowck.rs
+++ /dev/null
@@ -1,220 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use c_str::{ToCStr, CString};
-use container::Container;
-use iter::Iterator;
-use libc::{c_char, size_t};
-use option::{Option, None, Some};
-use ptr::RawPtr;
-use rt;
-use rt::local::Local;
-use rt::task::Task;
-use str::OwnedStr;
-use str;
-use uint;
-use unstable::raw;
-use vec::{ImmutableVector, OwnedVector};
-
-pub static FROZEN_BIT: uint = 1 << (uint::bits - 1);
-pub static MUT_BIT: uint = 1 << (uint::bits - 2);
-static ALL_BITS: uint = FROZEN_BIT | MUT_BIT;
-
-#[deriving(Eq)]
-pub struct BorrowRecord {
-    priv alloc: *mut raw::Box<()>,
-    file: *c_char,
-    priv line: size_t
-}
-
-fn try_take_task_borrow_list() -> Option<~[BorrowRecord]> {
-    let mut task = Local::borrow(None::<Task>);
-    task.get().borrow_list.take()
-}
-
-fn swap_task_borrow_list(f: |~[BorrowRecord]| -> ~[BorrowRecord]) {
-    let borrows = match try_take_task_borrow_list() {
-        Some(l) => l,
-        None => ~[]
-    };
-    let borrows = f(borrows);
-
-    let mut task = Local::borrow(None::<Task>);
-    task.get().borrow_list = Some(borrows)
-}
-
-pub fn clear_task_borrow_list() {
-    // pub because it is used by the box annihilator.
-    let _ = try_take_task_borrow_list();
-}
-
-#[cold]
-unsafe fn fail_borrowed(alloc: *mut raw::Box<()>, file: *c_char, line: size_t)
-                        -> ! {
-    debug_borrow("fail_borrowed: ", alloc, 0, 0, file, line);
-
-    match try_take_task_borrow_list() {
-        None => { // not recording borrows
-            let msg = "borrowed";
-            msg.with_c_str(|msg_p| rt::begin_unwind_raw(msg_p, file, line))
-        }
-        Some(borrow_list) => { // recording borrows
-            let mut msg = ~"borrowed";
-            let mut sep = " at ";
-            for entry in borrow_list.rev_iter() {
-                if entry.alloc == alloc {
-                    msg.push_str(sep);
-                    let filename = str::raw::from_c_str(entry.file);
-                    msg.push_str(filename);
-                    msg.push_str(format!(":{}", entry.line));
-                    sep = " and at ";
-                }
-            }
-            msg.with_c_str(|msg_p| rt::begin_unwind_raw(msg_p, file, line))
-        }
-    }
-}
-
-/// Because this code is so perf. sensitive, use a static constant so that
-/// debug printouts are compiled out most of the time.
-static ENABLE_DEBUG: bool = false;
-
-#[inline]
-unsafe fn debug_borrow<T,P:RawPtr<T>>(tag: &'static str,
-                                      p: P,
-                                      old_bits: uint,
-                                      new_bits: uint,
-                                      filename: *c_char,
-                                      line: size_t) {
-    //! A useful debugging function that prints a pointer + tag + newline
-    //! without allocating memory.
-
-    if ENABLE_DEBUG && rt::env::debug_borrow() {
-        debug_borrow_slow(tag, p, old_bits, new_bits, filename, line);
-    }
-
-    unsafe fn debug_borrow_slow<T,P:RawPtr<T>>(tag: &'static str,
-                                               p: P,
-                                               old_bits: uint,
-                                               new_bits: uint,
-                                               filename: *c_char,
-                                               line: size_t) {
-        let filename = CString::new(filename, false);
-        rterrln!("{}{:#x} {:x} {:x} {}:{}",
-                 tag, p.to_uint(), old_bits, new_bits,
-                 filename.as_str().unwrap(), line);
-    }
-}
-
-#[inline]
-pub unsafe fn borrow_as_imm(a: *u8, file: *c_char, line: size_t) -> uint {
-    let a = a as *mut raw::Box<()>;
-    let old_ref_count = (*a).ref_count;
-    let new_ref_count = old_ref_count | FROZEN_BIT;
-
-    debug_borrow("borrow_as_imm:", a, old_ref_count, new_ref_count, file, line);
-
-    if (old_ref_count & MUT_BIT) != 0 {
-        fail_borrowed(a, file, line);
-    }
-
-    (*a).ref_count = new_ref_count;
-
-    old_ref_count
-}
-
-#[inline]
-pub unsafe fn borrow_as_mut(a: *u8, file: *c_char, line: size_t) -> uint {
-    let a = a as *mut raw::Box<()>;
-    let old_ref_count = (*a).ref_count;
-    let new_ref_count = old_ref_count | MUT_BIT | FROZEN_BIT;
-
-    debug_borrow("borrow_as_mut:", a, old_ref_count, new_ref_count, file, line);
-
-    if (old_ref_count & (MUT_BIT|FROZEN_BIT)) != 0 {
-        fail_borrowed(a, file, line);
-    }
-
-    (*a).ref_count = new_ref_count;
-
-    old_ref_count
-}
-
-pub unsafe fn record_borrow(a: *u8, old_ref_count: uint,
-                            file: *c_char, line: size_t) {
-    if (old_ref_count & ALL_BITS) == 0 {
-        // was not borrowed before
-        let a = a as *mut raw::Box<()>;
-        debug_borrow("record_borrow:", a, old_ref_count, 0, file, line);
-        swap_task_borrow_list(|borrow_list| {
-            let mut borrow_list = borrow_list;
-            borrow_list.push(BorrowRecord {
-                alloc: a,
-                file: file,
-                line: line,
-            });
-            borrow_list
-        })
-    }
-}
-
-pub unsafe fn unrecord_borrow(a: *u8,
-                              old_ref_count: uint,
-                              file: *c_char,
-                              line: size_t) {
-    if (old_ref_count & ALL_BITS) == 0 {
-        // was not borrowed before, so we should find the record at
-        // the end of the list
-        let a = a as *mut raw::Box<()>;
-        debug_borrow("unrecord_borrow:", a, old_ref_count, 0, file, line);
-        swap_task_borrow_list(|borrow_list| {
-            let mut borrow_list = borrow_list;
-            assert!(!borrow_list.is_empty());
-            let br = borrow_list.pop();
-            if br.alloc != a || br.file != file || br.line != line {
-                let err = format!("wrong borrow found, br={:?}", br);
-                err.with_c_str(|msg_p| {
-                    rt::begin_unwind_raw(msg_p, file, line)
-                })
-            }
-            borrow_list
-        })
-    }
-}
-
-#[inline]
-pub unsafe fn return_to_mut(a: *u8, orig_ref_count: uint,
-                            file: *c_char, line: size_t) {
-    // Sometimes the box is null, if it is conditionally frozen.
-    // See e.g. #4904.
-    if !a.is_null() {
-        let a = a as *mut raw::Box<()>;
-        let old_ref_count = (*a).ref_count;
-        let new_ref_count =
-            (old_ref_count & !ALL_BITS) | (orig_ref_count & ALL_BITS);
-
-        debug_borrow("return_to_mut:",
-                     a, old_ref_count, new_ref_count, file, line);
-
-        (*a).ref_count = new_ref_count;
-    }
-}
-
-#[inline]
-pub unsafe fn check_not_borrowed(a: *u8,
-                                 file: *c_char,
-                                 line: size_t) {
-    let a = a as *mut raw::Box<()>;
-    let ref_count = (*a).ref_count;
-    debug_borrow("check_not_borrowed:", a, ref_count, 0, file, line);
-    if (ref_count & FROZEN_BIT) != 0 {
-        fail_borrowed(a, file, line);
-    }
-}
diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs
index e7adb5ad7dd..40e9a3ec5b2 100644
--- a/src/libstd/rt/mod.rs
+++ b/src/libstd/rt/mod.rs
@@ -127,9 +127,6 @@ mod util;
 // Global command line argument storage
 pub mod args;
 
-// Support for dynamic borrowck
-pub mod borrowck;
-
 /// The default error code of the rust runtime if the main task fails instead
 /// of exiting cleanly.
 pub static DEFAULT_ERROR_CODE: int = 101;
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs
index 5041c4b6165..e63208bcaec 100644
--- a/src/libstd/rt/task.rs
+++ b/src/libstd/rt/task.rs
@@ -27,8 +27,6 @@ use option::{Option, Some, None};
 use prelude::drop;
 use result::{Result, Ok, Err};
 use rt::Runtime;
-use rt::borrowck::BorrowRecord;
-use rt::borrowck;
 use rt::local::Local;
 use rt::local_heap::LocalHeap;
 use rt::rtio::LocalIo;
@@ -52,8 +50,6 @@ pub struct Task {
     death: Death,
     destroyed: bool,
     name: Option<SendStr>,
-    // Dynamic borrowck debugging info
-    borrow_list: Option<~[BorrowRecord]>,
 
     logger: Option<~Logger>,
     stdout: Option<~Writer>,
@@ -93,7 +89,6 @@ impl Task {
             death: Death::new(),
             destroyed: false,
             name: None,
-            borrow_list: None,
             logger: None,
             stdout: None,
             stderr: None,
@@ -182,9 +177,6 @@ impl Task {
 
         unsafe { (*handle).unwinder.try(try_block); }
 
-        // Cleanup the dynamic borrowck debugging info
-        borrowck::clear_task_borrow_list();
-
         // Here we must unsafely borrow the task in order to not remove it from
         // TLS. When collecting failure, we may attempt to send on a channel (or
         // just run aribitrary code), so we must be sure to still have a local
diff --git a/src/libstd/unstable/lang.rs b/src/libstd/unstable/lang.rs
index 38c713ad7b7..8460152ff7b 100644
--- a/src/libstd/unstable/lang.rs
+++ b/src/libstd/unstable/lang.rs
@@ -12,7 +12,6 @@
 
 use c_str::ToCStr;
 use libc::{c_char, size_t, uintptr_t};
-use rt::borrowck;
 
 #[cold]
 #[lang="fail_"]
@@ -42,42 +41,3 @@ pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char {
 pub unsafe fn local_free(ptr: *c_char) {
     ::rt::local_heap::local_free(ptr);
 }
-
-#[lang="borrow_as_imm"]
-#[inline]
-pub unsafe fn borrow_as_imm(a: *u8, file: *c_char, line: size_t) -> uint {
-    borrowck::borrow_as_imm(a, file, line)
-}
-
-#[lang="borrow_as_mut"]
-#[inline]
-pub unsafe fn borrow_as_mut(a: *u8, file: *c_char, line: size_t) -> uint {
-    borrowck::borrow_as_mut(a, file, line)
-}
-
-#[lang="record_borrow"]
-pub unsafe fn record_borrow(a: *u8, old_ref_count: uint,
-                            file: *c_char, line: size_t) {
-    borrowck::record_borrow(a, old_ref_count, file, line)
-}
-
-#[lang="unrecord_borrow"]
-pub unsafe fn unrecord_borrow(a: *u8, old_ref_count: uint,
-                              file: *c_char, line: size_t) {
-    borrowck::unrecord_borrow(a, old_ref_count, file, line)
-}
-
-#[lang="return_to_mut"]
-#[inline]
-pub unsafe fn return_to_mut(a: *u8, orig_ref_count: uint,
-                            file: *c_char, line: size_t) {
-    borrowck::return_to_mut(a, orig_ref_count, file, line)
-}
-
-#[lang="check_not_borrowed"]
-#[inline]
-pub unsafe fn check_not_borrowed(a: *u8,
-                                 file: *c_char,
-                                 line: size_t) {
-    borrowck::check_not_borrowed(a, file, line)
-}