about summary refs log tree commit diff
path: root/src/librustdoc/test.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-04-28 20:36:08 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-05-07 23:43:39 -0700
commitab92ea526d455b402efbccc7160c8aec0237c88f (patch)
tree92e748f3e3496a48ac68dd290a0a08aa342740a1 /src/librustdoc/test.rs
parentef6daf9935da103f1b915a5c9904794da79b0b60 (diff)
downloadrust-ab92ea526d455b402efbccc7160c8aec0237c88f.tar.gz
rust-ab92ea526d455b402efbccc7160c8aec0237c88f.zip
std: Modernize the local_data api
This commit brings the local_data api up to modern rust standards with a few key
improvements:

* The `pop` and `set` methods have been combined into one method, `replace`

* The `get_mut` method has been removed. All interior mutability should be done
  through `RefCell`.

* All functionality is now exposed as a method on the keys themselves. Instead
  of importing std::local_data, you now use "key.replace()" and "key.get()".

* All closures have been removed in favor of RAII functionality. This means that
  get() and get_mut() no long require closures, but rather return
  Option<SmartPointer> where the smart pointer takes care of relinquishing the
  borrow and also implements the necessary Deref traits

* The modify() function was removed to cut the local_data interface down to its
  bare essentials (similarly to how RefCell removed set/get).

[breaking-change]
Diffstat (limited to 'src/librustdoc/test.rs')
-rw-r--r--src/librustdoc/test.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index 0b8434d7d17..898f5856694 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -12,7 +12,6 @@ use std::cell::RefCell;
 use std::char;
 use std::io;
 use std::io::{Process, TempDir};
-use std::local_data;
 use std::os;
 use std::str;
 use std::strbuf::StrBuf;
@@ -75,7 +74,7 @@ pub fn run(input: &str,
         maybe_typed: core::NotTyped(sess),
         src: input_path,
     };
-    local_data::set(super::ctxtkey, ctx);
+    super::ctxtkey.replace(Some(ctx));
 
     let mut v = RustdocVisitor::new(ctx, None);
     v.visit(&ctx.krate);