diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-01-08 19:29:16 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-01-08 19:29:16 -0800 |
| commit | 44ab00ee37c4ffb8440ff20fd8a15cd24a6f3e46 (patch) | |
| tree | 83f3d67a9e21c6ce1b99c2ce8f6a737896c673db /src/test | |
| parent | a8d37af2473da79be704c9ce2374f278c47177b6 (diff) | |
| download | rust-44ab00ee37c4ffb8440ff20fd8a15cd24a6f3e46.tar.gz rust-44ab00ee37c4ffb8440ff20fd8a15cd24a6f3e46.zip | |
Revert "librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc"
This reverts commit a8d37af2473da79be704c9ce2374f278c47177b6.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/bench/task-perf-word-count-generic.rs | 52 | ||||
| -rw-r--r-- | src/test/compile-fail/copy-into-closure.rs | 8 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-2718-a.rs | 8 | ||||
| -rw-r--r-- | src/test/run-pass/export-non-interference2.rs | 9 | ||||
| -rw-r--r-- | src/test/run-pass/hashmap-memory.rs | 16 | ||||
| -rw-r--r-- | src/test/run-pass/issue-2718.rs | 8 | ||||
| -rw-r--r-- | src/test/run-pass/pipe-bank-proto.rs | 16 | ||||
| -rw-r--r-- | src/test/run-pass/pipe-pingpong-bounded.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/pipe-presentation-examples.rs | 8 | ||||
| -rw-r--r-- | src/test/run-pass/reflect-visit-data.rs | 1 | ||||
| -rw-r--r-- | src/test/run-pass/static-impl.rs | 12 |
11 files changed, 65 insertions, 75 deletions
diff --git a/src/test/bench/task-perf-word-count-generic.rs b/src/test/bench/task-perf-word-count-generic.rs index b0be34508b3..e24979a4e06 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -45,9 +45,9 @@ trait word_reader { fn read_word() -> Option<~str>; } -// These used to be in task, but they disappeared. -pub type joinable_task = Port<()>; -pub fn spawn_joinable(+f: fn~()) -> joinable_task { +// These used to be in task, but they disappeard. +type joinable_task = Port<()>; +fn spawn_joinable(+f: fn~()) -> joinable_task { let p = Port(); let c = Chan(&p); do task::spawn() |move f| { @@ -57,7 +57,7 @@ pub fn spawn_joinable(+f: fn~()) -> joinable_task { p } -pub fn join(t: joinable_task) { +fn join(t: joinable_task) { t.recv() } @@ -90,11 +90,11 @@ fn reduce(word: &~str, get: map_reduce::getter<int>) { io::println(fmt!("%s\t%?", *word, count)); } -pub struct box<T> { +struct box<T> { mut contents: Option<T>, } -pub impl<T> box<T> { +impl<T> box<T> { fn swap(f: fn(+v: T) -> T) { let mut tmp = None; self.contents <-> tmp; @@ -108,16 +108,13 @@ pub impl<T> box<T> { } } -pub fn box<T>(+x: T) -> box<T> { +fn box<T>(+x: T) -> box<T> { box { contents: Some(move x) } } mod map_reduce { - use core::oldcomm::*; - - use std::map::HashMap; use std::map; pub type putter<K: Owned, V: Owned> = fn(&K, V); @@ -129,7 +126,7 @@ mod map_reduce { pub type reducer<K: Copy Owned, V: Copy Owned> = fn~(&K, getter<V>); enum ctrl_proto<K: Copy Owned, V: Copy Owned> { - find_reducer(K, Chan<Chan<::map_reduce::reduce_proto<V>>>), + find_reducer(K, Chan<Chan<reduce_proto<V>>>), mapper_done } @@ -141,32 +138,26 @@ mod map_reduce { } reducer_response: recv<K: Copy Owned, V: Copy Owned> { - reducer(::core::oldcomm::Chan<::map_reduce::reduce_proto<V>>) - -> open<K, V> + reducer(Chan<reduce_proto<V>>) -> open<K, V> } ) - pub enum reduce_proto<V: Copy Owned> { - emit_val(V), - done, - addref, - release - } + enum reduce_proto<V: Copy Owned> { emit_val(V), done, addref, release } fn start_mappers<K1: Copy Owned, K2: Hash IterBytes Eq Const Copy Owned, V: Copy Owned>( map: &mapper<K1, K2, V>, ctrls: &mut ~[ctrl_proto::server::open<K2, V>], inputs: &~[K1]) - -> ~[::joinable_task] + -> ~[joinable_task] { let mut tasks = ~[]; for inputs.each |i| { let (ctrl, ctrl_server) = ctrl_proto::init(); - let ctrl = ::box(move ctrl); + let ctrl = box(move ctrl); let i = copy *i; let m = copy *map; - tasks.push(::spawn_joinable(|move ctrl, move i| map_task(copy m, &ctrl, i))); + tasks.push(spawn_joinable(|move ctrl, move i| map_task(copy m, &ctrl, i))); ctrls.push(move ctrl_server); } move tasks @@ -174,16 +165,16 @@ mod map_reduce { fn map_task<K1: Copy Owned, K2: Hash IterBytes Eq Const Copy Owned, V: Copy Owned>( map: mapper<K1, K2, V>, - ctrl: &::box<ctrl_proto::client::open<K2, V>>, + ctrl: &box<ctrl_proto::client::open<K2, V>>, input: K1) { // log(error, "map_task " + input); - let intermediates: HashMap<K2, Chan<::map_reduce::reduce_proto<V>>> + let intermediates: HashMap<K2, Chan<reduce_proto<V>>> = map::HashMap(); do map(input) |key: &K2, val| { let mut c = None; - let found: Option<Chan<::map_reduce::reduce_proto<V>>> + let found: Option<Chan<reduce_proto<V>>> = intermediates.find(*key); match found { Some(_c) => { c = Some(_c); } @@ -204,8 +195,7 @@ mod map_reduce { send(c.get(), emit_val(val)); } - fn finish<K: Copy Owned, V: Copy Owned>( - _k: K, v: Chan<::map_reduce::reduce_proto<V>>) + fn finish<K: Copy Owned, V: Copy Owned>(_k: K, v: Chan<reduce_proto<V>>) { send(v, release); } @@ -216,7 +206,7 @@ mod map_reduce { fn reduce_task<K: Copy Owned, V: Copy Owned>( reduce: ~reducer<K, V>, key: K, - out: Chan<Chan<::map_reduce::reduce_proto<V>>>) + out: Chan<Chan<reduce_proto<V>>>) { let p = Port(); @@ -225,7 +215,7 @@ mod map_reduce { let mut ref_count = 0; let mut is_done = false; - fn get<V: Copy Owned>(p: Port<::map_reduce::reduce_proto<V>>, + fn get<V: Copy Owned>(p: Port<reduce_proto<V>>, ref_count: &mut int, is_done: &mut bool) -> Option<V> { while !*is_done || *ref_count > 0 { @@ -284,7 +274,7 @@ mod map_reduce { let p = Port(); let ch = Chan(&p); let r = copy reduce, kk = k; - tasks.push(::spawn_joinable(|move r| + tasks.push(spawn_joinable(|move r| reduce_task(~copy r, kk, ch) )); c = recv(p); @@ -300,7 +290,7 @@ mod map_reduce { for reducers.each_value |v| { send(v, done) } - for tasks.each |t| { ::join(*t); } + for tasks.each |t| { join(*t); } } } diff --git a/src/test/compile-fail/copy-into-closure.rs b/src/test/compile-fail/copy-into-closure.rs index 21d4fa8eab8..bb96db8c41c 100644 --- a/src/test/compile-fail/copy-into-closure.rs +++ b/src/test/compile-fail/copy-into-closure.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn closure2(+x: core::util::NonCopyable) - -> (core::util::NonCopyable, fn@() -> core::util::NonCopyable) { - let f = fn@(copy x) -> core::util::NonCopyable { +fn closure2(+x: util::NonCopyable) -> (util::NonCopyable, + fn@() -> util::NonCopyable) { + let f = fn@(copy x) -> util::NonCopyable { //~^ ERROR copying a noncopyable value //~^^ NOTE non-copyable value cannot be copied into a @fn closure copy x @@ -18,7 +18,7 @@ fn closure2(+x: core::util::NonCopyable) }; (move x,f) } -fn closure3(+x: core::util::NonCopyable) { +fn closure3(+x: util::NonCopyable) { do task::spawn |copy x| { //~^ ERROR copying a noncopyable value //~^^ NOTE non-copyable value cannot be copied into a ~fn closure diff --git a/src/test/compile-fail/issue-2718-a.rs b/src/test/compile-fail/issue-2718-a.rs index 2332d54037f..8acabc6bdc1 100644 --- a/src/test/compile-fail/issue-2718-a.rs +++ b/src/test/compile-fail/issue-2718-a.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub struct send_packet<T: Copy> { +struct send_packet<T: Copy> { p: T } mod pingpong { - use send_packet; - pub type ping = send_packet<pong>; - pub enum pong = send_packet<ping>; //~ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable + #[legacy_exports]; + type ping = send_packet<pong>; + enum pong = send_packet<ping>; //~ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable } fn main() {} diff --git a/src/test/run-pass/export-non-interference2.rs b/src/test/run-pass/export-non-interference2.rs index 25a4c29244c..464acfba934 100644 --- a/src/test/run-pass/export-non-interference2.rs +++ b/src/test/run-pass/export-non-interference2.rs @@ -9,11 +9,16 @@ // except according to those terms. mod foo { + #[legacy_exports]; + + export bar; + mod bar { - pub fn y() { ::foo::x(); } + #[legacy_exports]; + fn y() { x(); } } - pub fn x() { debug!("x"); } + fn x() { debug!("x"); } } fn main() { foo::bar::y(); } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 6232f0c6e06..577ac67dd6a 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -20,20 +20,16 @@ extern mod std; use std::map; use std::map::HashMap; -use core::oldcomm::Chan; -use core::oldcomm::Port; -use core::oldcomm::send; -use core::oldcomm::recv; +use oldcomm::Chan; +use oldcomm::Port; +use oldcomm::send; +use oldcomm::recv; -pub fn map(filename: ~str, emit: map_reduce::putter) { emit(filename, ~"1"); } +fn map(filename: ~str, emit: map_reduce::putter) { emit(filename, ~"1"); } mod map_reduce { use std::map; use std::map::HashMap; - use core::oldcomm::Chan; - use core::oldcomm::Port; - use core::oldcomm::send; - use core::oldcomm::recv; pub type putter = fn@(~str, ~str); @@ -68,7 +64,7 @@ mod map_reduce { } } - ::map(input, |a,b| emit(intermediates, ctrl, a, b) ); + map(input, |a,b| emit(intermediates, ctrl, a, b) ); send(ctrl, mapper_done); } diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 7c35c9e8cf1..dc7d5b99d77 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -250,7 +250,7 @@ pub mod pingpong { pub fn do_ping(-c: ping) -> pong { let (sp, rp) = ::pipes::entangle(); - ::pipes::send(move c, pingpong::ping(move sp)); + ::pipes::send(move c, ping(move sp)); move rp } @@ -259,7 +259,7 @@ pub mod pingpong { if packet.is_none() { fail ~"sender closed the connection" } - (pingpong::liberate_pong(option::unwrap(move packet)), ()) + (liberate_pong(option::unwrap(move packet)), ()) } } @@ -274,12 +274,12 @@ pub mod pingpong { if packet.is_none() { fail ~"sender closed the connection" } - (pingpong::liberate_ping(option::unwrap(move packet)), ()) + (liberate_ping(option::unwrap(move packet)), ()) } pub fn do_pong(-c: pong) -> ping { let (sp, rp) = ::pipes::entangle(); - ::pipes::send(move c, pingpong::pong(move sp)); + ::pipes::send(move c, pong(move sp)); move rp } } diff --git a/src/test/run-pass/pipe-bank-proto.rs b/src/test/run-pass/pipe-bank-proto.rs index 856057e10ae..487db85ad66 100644 --- a/src/test/run-pass/pipe-bank-proto.rs +++ b/src/test/run-pass/pipe-bank-proto.rs @@ -17,14 +17,14 @@ use pipes::try_recv; -pub type username = ~str; -pub type password = ~str; -pub type money = float; -pub type amount = float; +type username = ~str; +type password = ~str; +type money = float; +type amount = float; proto! bank ( login:send { - login(::username, ::password) -> login_response + login(username, password) -> login_response } login_response:recv { @@ -33,12 +33,12 @@ proto! bank ( } connected:send { - deposit(::money) -> connected, - withdrawal(::amount) -> withdrawal_response + deposit(money) -> connected, + withdrawal(amount) -> withdrawal_response } withdrawal_response:recv { - money(::money) -> connected, + money(money) -> connected, insufficient_funds -> connected } ) diff --git a/src/test/run-pass/pipe-pingpong-bounded.rs b/src/test/run-pass/pipe-pingpong-bounded.rs index 774e3544d89..803f7f06b51 100644 --- a/src/test/run-pass/pipe-pingpong-bounded.rs +++ b/src/test/run-pass/pipe-pingpong-bounded.rs @@ -43,7 +43,6 @@ mod pingpong { pub enum ping = server::pong; pub enum pong = client::ping; pub mod client { - use core::pipes::*; use core::ptr; pub fn ping(+pipe: ping) -> pong { @@ -62,7 +61,6 @@ mod pingpong { ::pingpong::packets>; } pub mod server { - use core::pipes::*; use core::ptr; pub type ping = pipes::RecvPacketBuffered<::pingpong::ping, diff --git a/src/test/run-pass/pipe-presentation-examples.rs b/src/test/run-pass/pipe-presentation-examples.rs index 0fe845dd1f9..173325834c0 100644 --- a/src/test/run-pass/pipe-presentation-examples.rs +++ b/src/test/run-pass/pipe-presentation-examples.rs @@ -75,12 +75,12 @@ macro_rules! select ( ) // Types and protocols -pub struct Buffer { +struct Buffer { foo: (), } -pub impl Buffer : Drop { +impl Buffer : Drop { fn finalize(&self) {} } @@ -90,11 +90,11 @@ proto! double_buffer ( } wait_buffer:recv { - give_buffer(::Buffer) -> release + give_buffer(Buffer) -> release } release:send { - release(::Buffer) -> acquire + release(Buffer) -> acquire } ) diff --git a/src/test/run-pass/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs index 3e66c18d58b..cdc23aef944 100644 --- a/src/test/run-pass/reflect-visit-data.rs +++ b/src/test/run-pass/reflect-visit-data.rs @@ -11,7 +11,6 @@ // xfail-fast #[legacy_modes]; -use core::bool; use intrinsic::{TyDesc, get_tydesc, visit_tydesc, TyVisitor}; use libc::c_void; use vec::UnboxedVecRepr; diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs index 6987dfab1b5..2003a12ea0c 100644 --- a/src/test/run-pass/static-impl.rs +++ b/src/test/run-pass/static-impl.rs @@ -11,18 +11,20 @@ // xfail-fast #[legacy_modes]; -pub trait plus { +use a::*; + +trait plus { fn plus() -> int; } mod a { - use plus; - pub impl uint: plus { fn plus() -> int { self as int + 20 } } + #[legacy_exports]; + impl uint: plus { fn plus() -> int { self as int + 20 } } } mod b { - use plus; - pub impl ~str: plus { fn plus() -> int { 200 } } + #[legacy_exports]; + impl ~str: plus { fn plus() -> int { 200 } } } trait uint_utils { |
