Skip to content

Commit 6da2c98

Browse files
committed
auto merge of #6329 : sonwow/rust/issue-6306, r=ILyoan
Fix for #6306
2 parents e9d0018 + 4400bbd commit 6da2c98

File tree

16 files changed

+24
-23
lines changed

16 files changed

+24
-23
lines changed

src/libcore/condition.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
use prelude::*;
1414
use task;
15-
use task::local_data::{local_data_pop, local_data_set};
15+
use local_data::{local_data_pop, local_data_set};
1616

1717
// helper for transmutation, shown below.
1818
type RustClosure = (int, int);
@@ -24,14 +24,14 @@ pub struct Handler<T, U> {
2424

2525
pub struct Condition<'self, T, U> {
2626
name: &'static str,
27-
key: task::local_data::LocalDataKey<'self, Handler<T, U>>
27+
key: local_data::LocalDataKey<'self, Handler<T, U>>
2828
}
2929

3030
pub impl<'self, T, U> Condition<'self, T, U> {
3131
fn trap(&'self self, h: &'self fn(T) -> U) -> Trap<'self, T, U> {
3232
unsafe {
3333
let p : *RustClosure = ::cast::transmute(&h);
34-
let prev = task::local_data::local_data_get(self.key);
34+
let prev = local_data::local_data_get(self.key);
3535
let h = @Handler { handle: *p, prev: prev };
3636
Trap { cond: self, handler: h }
3737
}

src/libcore/core.rc

+1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ pub mod trie;
215215
pub mod task;
216216
pub mod comm;
217217
pub mod pipes;
218+
pub mod local_data;
218219

219220

220221
/* Runtime and platform support */
File renamed without changes.

src/libcore/os.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ fn overridden_arg_key(_v: @OverriddenArgs) {}
12081208
12091209
pub fn args() -> ~[~str] {
12101210
unsafe {
1211-
match task::local_data::local_data_get(overridden_arg_key) {
1211+
match local_data::local_data_get(overridden_arg_key) {
12121212
None => real_args(),
12131213
Some(args) => copy args.val
12141214
}
@@ -1218,7 +1218,7 @@ pub fn args() -> ~[~str] {
12181218
pub fn set_args(new_args: ~[~str]) {
12191219
unsafe {
12201220
let overridden_args = @OverriddenArgs { val: copy new_args };
1221-
task::local_data::local_data_set(overridden_arg_key, overridden_args);
1221+
local_data::local_data_set(overridden_arg_key, overridden_args);
12221222
}
12231223
}
12241224

src/libcore/prelude.rs

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ pub use io;
8181
pub use iter;
8282
pub use old_iter;
8383
pub use libc;
84+
pub use local_data;
8485
pub use num;
8586
pub use ops;
8687
pub use option;

src/libcore/rand.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -836,13 +836,13 @@ fn tls_rng_state(_v: @@mut IsaacRng) {}
836836
pub fn task_rng() -> @@mut IsaacRng {
837837
let r : Option<@@mut IsaacRng>;
838838
unsafe {
839-
r = task::local_data::local_data_get(tls_rng_state);
839+
r = local_data::local_data_get(tls_rng_state);
840840
}
841841
match r {
842842
None => {
843843
unsafe {
844844
let rng = @@mut IsaacRng::new_seeded(seed());
845-
task::local_data::local_data_set(tls_rng_state, rng);
845+
local_data::local_data_set(tls_rng_state, rng);
846846
rng
847847
}
848848
}

src/libcore/rt/local_services.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ mod test {
198198
199199
#[test]
200200
fn tls() {
201-
use task::local_data::*;
201+
use local_data::*;
202202
do run_in_newsched_task() {
203203
unsafe {
204204
fn key(_x: @~str) { }

src/libcore/task/local_data_priv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use cmp::Eq;
1515
use libc;
1616
use prelude::*;
1717
use task::rt;
18-
use task::local_data::LocalDataKey;
18+
use local_data::LocalDataKey;
1919

2020
use super::rt::rust_task;
2121
use rt::local_services::LocalStorage;

src/libcore/task/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ use unstable::finally::Finally;
4747
#[cfg(test)] use comm::SharedChan;
4848

4949
mod local_data_priv;
50-
pub mod local_data;
5150
pub mod rt;
5251
pub mod spawn;
5352

src/librustdoc/extract.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use astsrv;
1414
use doc::ItemUtils;
1515
use doc;
1616

17-
use core::task::local_data::local_data_get;
17+
use core::local_data::local_data_get;
1818
use syntax::ast;
1919
use syntax;
2020

src/libstd/rl.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ fn complete_key(_v: @CompletionCb) {}
6969

7070
/// Bind to the main completion callback
7171
pub unsafe fn complete(cb: CompletionCb) {
72-
task::local_data::local_data_set(complete_key, @(cb));
72+
local_data::local_data_set(complete_key, @(cb));
7373

7474
extern fn callback(line: *c_char, completions: *()) {
7575
unsafe {
76-
let cb = *task::local_data::local_data_get(complete_key)
76+
let cb = *local_data::local_data_get(complete_key)
7777
.get();
7878

7979
do cb(str::raw::from_c_str(line)) |suggestion| {

src/libstd/sort.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1211,11 +1211,11 @@ mod big_tests {
12111211
#[unsafe_destructor]
12121212
impl<'self> Drop for LVal<'self> {
12131213
fn finalize(&self) {
1214-
let x = unsafe { task::local_data::local_data_get(self.key) };
1214+
let x = unsafe { local_data::local_data_get(self.key) };
12151215
match x {
12161216
Some(@y) => {
12171217
unsafe {
1218-
task::local_data::local_data_set(self.key, @(y+1));
1218+
local_data::local_data_set(self.key, @(y+1));
12191219
}
12201220
}
12211221
_ => fail!(~"Expected key to work"),

src/libstd/sort_stage0.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1202,11 +1202,11 @@ mod big_tests {
12021202
#[unsafe_destructor]
12031203
impl<'self> Drop for LVal<'self> {
12041204
fn finalize(&self) {
1205-
let x = unsafe { task::local_data::local_data_get(self.key) };
1205+
let x = unsafe { local_data::local_data_get(self.key) };
12061206
match x {
12071207
Some(@y) => {
12081208
unsafe {
1209-
task::local_data::local_data_set(self.key, @(y+1));
1209+
local_data::local_data_set(self.key, @(y+1));
12101210
}
12111211
}
12121212
_ => fail!(~"Expected key to work"),

src/libsyntax/ast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl<S:Encoder> Encodable<S> for ident {
7474
fn encode(&self, s: &mut S) {
7575
unsafe {
7676
let intr =
77-
match task::local_data::local_data_get(interner_key!()) {
77+
match local_data::local_data_get(interner_key!()) {
7878
None => fail!(~"encode: TLS interner not set up"),
7979
Some(intr) => intr
8080
};
@@ -87,7 +87,7 @@ impl<S:Encoder> Encodable<S> for ident {
8787
impl<D:Decoder> Decodable<D> for ident {
8888
fn decode(d: &mut D) -> ident {
8989
let intr = match unsafe {
90-
task::local_data::local_data_get(interner_key!())
90+
local_data::local_data_get(interner_key!())
9191
} {
9292
None => fail!(~"decode: TLS interner not set up"),
9393
Some(intr) => intr

src/libsyntax/parse/token.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ pub fn mk_fresh_ident_interner() -> @ident_interner {
462462
interner: interner::StrInterner::prefill(init_vec)
463463
};
464464
unsafe {
465-
task::local_data::local_data_set(interner_key!(), @rv);
465+
local_data::local_data_set(interner_key!(), @rv);
466466
}
467467
rv
468468
}
@@ -471,7 +471,7 @@ pub fn mk_fresh_ident_interner() -> @ident_interner {
471471
// fresh one.
472472
pub fn mk_ident_interner() -> @ident_interner {
473473
unsafe {
474-
match task::local_data::local_data_get(interner_key!()) {
474+
match local_data::local_data_get(interner_key!()) {
475475
Some(interner) => *interner,
476476
None => {
477477
mk_fresh_ident_interner()

src/test/compile-fail/core-tls-store-pointer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
// Testing that we can't store a borrowed pointer it task-local storage
1212

13-
use core::task::local_data::*;
13+
use core::local_data::*;
1414

1515
fn key(_x: @&int) { }
1616

1717
fn main() {
1818
unsafe {
1919
local_data_set(key, @&0); //~ ERROR does not fulfill `'static`
2020
}
21-
}
21+
}

0 commit comments

Comments
 (0)