Skip to content

Commit 6399bea

Browse files
committed
---
yaml --- r: 27843 b: refs/heads/try c: 9c6890f h: refs/heads/master i: 27841: 3a20855 27839: 96b85ee v: v3
1 parent be5db66 commit 6399bea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+416
-391
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: af4361379543ce89866d087b45ffc419855e13fd
5+
refs/heads/try: 9c6890f4884b1294dd13ad883162ab98e2dd27e5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/doc/tutorial.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2975,9 +2975,9 @@ the string in response. The child terminates when `0` is received.
29752975
Here is the function that implements the child task:
29762976

29772977
~~~~
2978-
# import comm::{port, chan};
2979-
fn stringifier(from_parent: port<uint>,
2980-
to_parent: chan<~str>) {
2978+
# import comm::{Port, port, Chan, chan};
2979+
fn stringifier(from_parent: Port<uint>,
2980+
to_parent: Chan<~str>) {
29812981
let mut value: uint;
29822982
loop {
29832983
value = from_parent.recv();
@@ -2999,9 +2999,9 @@ Here is the code for the parent task:
29992999

30003000
~~~~
30013001
# import task::{spawn_conversation};
3002-
# import comm::{chan, port};
3003-
# fn stringifier(from_parent: comm::port<uint>,
3004-
# to_parent: comm::chan<~str>) {
3002+
# import comm::{Chan, chan, Port, port};
3003+
# fn stringifier(from_parent: comm::Port<uint>,
3004+
# to_parent: comm::Chan<~str>) {
30053005
# comm::send(to_parent, ~"22");
30063006
# comm::send(to_parent, ~"23");
30073007
# comm::send(to_parent, ~"0");

branches/try/src/compiletest/procsrv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ fn run(lib_path: ~str,
6262
writeclose(pipe_in.out, input);
6363
let p = pipes::port_set();
6464
let ch = p.chan();
65-
do task::spawn_sched(task::single_threaded) {
65+
do task::spawn_sched(task::SingleThreaded) {
6666
let errput = readclose(pipe_err.in);
6767
ch.send((2, errput));
6868
}
6969
let ch = p.chan();
70-
do task::spawn_sched(task::single_threaded) {
70+
do task::spawn_sched(task::SingleThreaded) {
7171
let output = readclose(pipe_out.in);
7272
ch.send((1, output));
7373
}

branches/try/src/libcore/comm.rs

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
import either::Either;
3131
import libc::size_t;
3232

33-
export port;
34-
export chan;
33+
export Port, port;
34+
export Chan, chan;
3535
export send;
3636
export recv;
3737
export peek;
@@ -48,8 +48,8 @@ export listen;
4848
* transmitted. If a port value is copied, both copies refer to the same
4949
* port. Ports may be associated with multiple `chan`s.
5050
*/
51-
enum port<T: send> {
52-
port_t(@port_ptr<T>)
51+
enum Port<T: send> {
52+
Port_(@PortPtr<T>)
5353
}
5454

5555
// It's critical that this only have one variant, so it has a record
@@ -64,40 +64,40 @@ enum port<T: send> {
6464
* data will be silently dropped. Channels may be duplicated and
6565
* themselves transmitted over other channels.
6666
*/
67-
enum chan<T: send> {
68-
chan_t(port_id)
67+
enum Chan<T: send> {
68+
Chan_(port_id)
6969
}
7070

7171
/// Constructs a port
72-
fn port<T: send>() -> port<T> {
73-
port_t(@port_ptr(rustrt::new_port(sys::size_of::<T>() as size_t)))
72+
fn port<T: send>() -> Port<T> {
73+
Port_(@PortPtr(rustrt::new_port(sys::size_of::<T>() as size_t)))
7474
}
7575

76-
impl<T: send> port<T> {
76+
impl<T: send> Port<T> {
7777

78-
fn chan() -> chan<T> { chan(self) }
78+
fn chan() -> Chan<T> { chan(self) }
7979
fn send(+v: T) { self.chan().send(v) }
8080
fn recv() -> T { recv(self) }
8181
fn peek() -> bool { peek(self) }
8282

8383
}
8484

85-
impl<T: send> chan<T> {
85+
impl<T: send> Chan<T> {
8686

87-
fn chan() -> chan<T> { self }
87+
fn chan() -> Chan<T> { self }
8888
fn send(+v: T) { send(self, v) }
8989
fn recv() -> T { recv_chan(self) }
9090
fn peek() -> bool { peek_chan(self) }
9191

9292
}
9393

9494
/// Open a new receiving channel for the duration of a function
95-
fn listen<T: send, U>(f: fn(chan<T>) -> U) -> U {
95+
fn listen<T: send, U>(f: fn(Chan<T>) -> U) -> U {
9696
let po = port();
9797
f(po.chan())
9898
}
9999

100-
class port_ptr<T:send> {
100+
class PortPtr<T:send> {
101101
let po: *rust_port;
102102
new(po: *rust_port) { self.po = po; }
103103
drop unsafe {
@@ -130,9 +130,9 @@ class port_ptr<T:send> {
130130
* Fails if the port is detached or dead. Fails if the port
131131
* is owned by a different task.
132132
*/
133-
fn as_raw_port<T: send, U>(ch: comm::chan<T>, f: fn(*rust_port) -> U) -> U {
133+
fn as_raw_port<T: send, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U {
134134

135-
class portref {
135+
class PortRef {
136136
let p: *rust_port;
137137
new(p: *rust_port) { self.p = p; }
138138
drop {
@@ -142,7 +142,7 @@ fn as_raw_port<T: send, U>(ch: comm::chan<T>, f: fn(*rust_port) -> U) -> U {
142142
}
143143
}
144144

145-
let p = portref(rustrt::rust_port_take(*ch));
145+
let p = PortRef(rustrt::rust_port_take(*ch));
146146

147147
if ptr::is_null(p.p) {
148148
fail ~"unable to locate port for channel"
@@ -157,16 +157,16 @@ fn as_raw_port<T: send, U>(ch: comm::chan<T>, f: fn(*rust_port) -> U) -> U {
157157
* Constructs a channel. The channel is bound to the port used to
158158
* construct it.
159159
*/
160-
fn chan<T: send>(p: port<T>) -> chan<T> {
161-
chan_t(rustrt::get_port_id((**p).po))
160+
fn chan<T: send>(p: Port<T>) -> Chan<T> {
161+
Chan_(rustrt::get_port_id((**p).po))
162162
}
163163

164164
/**
165165
* Sends data over a channel. The sent data is moved into the channel,
166166
* whereupon the caller loses access to it.
167167
*/
168-
fn send<T: send>(ch: chan<T>, +data: T) {
169-
let chan_t(p) = ch;
168+
fn send<T: send>(ch: Chan<T>, +data: T) {
169+
let Chan_(p) = ch;
170170
let data_ptr = ptr::addr_of(data) as *();
171171
let res = rustrt::rust_port_id_send(p, data_ptr);
172172
if res != 0u unsafe {
@@ -180,17 +180,17 @@ fn send<T: send>(ch: chan<T>, +data: T) {
180180
* Receive from a port. If no data is available on the port then the
181181
* task will block until data becomes available.
182182
*/
183-
fn recv<T: send>(p: port<T>) -> T { recv_((**p).po) }
183+
fn recv<T: send>(p: Port<T>) -> T { recv_((**p).po) }
184184

185185
/// Returns true if there are messages available
186-
fn peek<T: send>(p: port<T>) -> bool { peek_((**p).po) }
186+
fn peek<T: send>(p: Port<T>) -> bool { peek_((**p).po) }
187187

188188
#[doc(hidden)]
189-
fn recv_chan<T: send>(ch: comm::chan<T>) -> T {
189+
fn recv_chan<T: send>(ch: comm::Chan<T>) -> T {
190190
as_raw_port(ch, |x|recv_(x))
191191
}
192192

193-
fn peek_chan<T: send>(ch: comm::chan<T>) -> bool {
193+
fn peek_chan<T: send>(ch: comm::Chan<T>) -> bool {
194194
as_raw_port(ch, |x|peek_(x))
195195
}
196196

@@ -221,7 +221,7 @@ fn peek_(p: *rust_port) -> bool {
221221
}
222222

223223
/// Receive on one of two ports
224-
fn select2<A: send, B: send>(p_a: port<A>, p_b: port<B>)
224+
fn select2<A: send, B: send>(p_a: Port<A>, p_b: Port<B>)
225225
-> Either<A, B> {
226226
let ports = ~[(**p_a).po, (**p_b).po];
227227
let yield = 0u, yieldp = ptr::addr_of(yield);
@@ -257,9 +257,10 @@ fn select2<A: send, B: send>(p_a: port<A>, p_b: port<B>)
257257

258258
/* Implementation details */
259259

260-
260+
#[allow(non_camel_case_types)] // runtime type
261261
enum rust_port {}
262262

263+
#[allow(non_camel_case_types)] // runtime type
263264
type port_id = int;
264265

265266
#[abi = "cdecl"]
@@ -329,7 +330,7 @@ fn chan_chan_infer() {
329330

330331
#[test]
331332
fn chan_chan() {
332-
let p = port::<chan<int>>(), p2 = port::<int>();
333+
let p = port::<Chan<int>>(), p2 = port::<int>();
333334
let c = chan(p);
334335
send(c, chan(p2));
335336
recv(p);

branches/try/src/libcore/core.rc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,11 @@ mod dlist_iter {
235235
mod send_map;
236236

237237
// Concurrency
238+
#[warn(non_camel_case_types)]
238239
mod comm;
240+
#[warn(non_camel_case_types)]
239241
mod task;
242+
//#[warn(non_camel_ase_types)] pipec code continues to trip this warning
240243
mod future;
241244
mod pipes;
242245

branches/try/src/libcore/future.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import either::Either;
1919
import pipes::recv;
2020

21-
export future;
21+
export Future;
2222
export extensions;
2323
export from_value;
2424
export from_port;
@@ -31,12 +31,12 @@ export spawn;
3131
export future_pipe;
3232

3333
#[doc = "The future type"]
34-
enum future<A> = {
34+
enum Future<A> = {
3535
mut v: Either<@A, fn@() -> A>
3636
};
3737

3838
/// Methods on the `future` type
39-
impl<A:copy send> future<A> {
39+
impl<A:copy send> Future<A> {
4040

4141
fn get() -> A {
4242
//! Get the value of the future
@@ -51,15 +51,15 @@ impl<A:copy send> future<A> {
5151
}
5252
}
5353

54-
fn from_value<A>(+val: A) -> future<A> {
54+
fn from_value<A>(+val: A) -> Future<A> {
5555
/*!
5656
* Create a future from a value
5757
*
5858
* The value is immediately available and calling `get` later will
5959
* not block.
6060
*/
6161

62-
future({
62+
Future({
6363
mut v: either::Left(@val)
6464
})
6565
}
@@ -68,7 +68,7 @@ macro_rules! move_it {
6868
{$x:expr} => { unsafe { let y <- *ptr::addr_of($x); y } }
6969
}
7070

71-
fn from_port<A:send>(+port: future_pipe::client::waiting<A>) -> future<A> {
71+
fn from_port<A:send>(+port: future_pipe::client::waiting<A>) -> Future<A> {
7272
#[doc = "
7373
Create a future from a port
7474
@@ -87,7 +87,7 @@ fn from_port<A:send>(+port: future_pipe::client::waiting<A>) -> future<A> {
8787
}
8888
}
8989

90-
fn from_fn<A>(f: fn@() -> A) -> future<A> {
90+
fn from_fn<A>(f: fn@() -> A) -> Future<A> {
9191
/*!
9292
* Create a future from a function.
9393
*
@@ -96,12 +96,12 @@ fn from_fn<A>(f: fn@() -> A) -> future<A> {
9696
* function. It is not spawned into another task.
9797
*/
9898

99-
future({
99+
Future({
100100
mut v: either::Right(f)
101101
})
102102
}
103103

104-
fn spawn<A:send>(+blk: fn~() -> A) -> future<A> {
104+
fn spawn<A:send>(+blk: fn~() -> A) -> Future<A> {
105105
/*!
106106
* Create a future from a unique closure.
107107
*
@@ -114,13 +114,13 @@ fn spawn<A:send>(+blk: fn~() -> A) -> future<A> {
114114
}))
115115
}
116116

117-
fn get<A:copy>(future: &future<A>) -> A {
117+
fn get<A:copy>(future: &Future<A>) -> A {
118118
//! Get the value of the future
119119
120120
do with(future) |v| { *v }
121121
}
122122

123-
fn with<A,B>(future: &future<A>, blk: fn((&A)) -> B) -> B {
123+
fn with<A,B>(future: &Future<A>, blk: fn((&A)) -> B) -> B {
124124
//! Work with the value without copying it
125125
126126
let v = match copy future.v {

branches/try/src/libcore/os.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import option::{some, none};
2424

2525
import getcwd = rustrt::rust_getcwd;
2626
import consts::*;
27-
import task::task_builder;
27+
import task::TaskBuilder;
2828

2929
export close, fclose, fsync_fd, waitpid;
3030
export env, getenv, setenv, fdopen, pipe;
@@ -135,9 +135,9 @@ mod global_env {
135135
}
136136

137137
enum Msg {
138-
MsgGetEnv(~str, comm::chan<option<~str>>),
139-
MsgSetEnv(~str, ~str, comm::chan<()>),
140-
MsgEnv(comm::chan<~[(~str,~str)]>)
138+
MsgGetEnv(~str, comm::Chan<option<~str>>),
139+
MsgSetEnv(~str, ~str, comm::Chan<()>),
140+
MsgEnv(comm::Chan<~[(~str,~str)]>)
141141
}
142142

143143
fn getenv(n: ~str) -> option<~str> {
@@ -161,18 +161,18 @@ mod global_env {
161161
comm::recv(po)
162162
}
163163

164-
fn get_global_env_chan() -> comm::chan<Msg> {
164+
fn get_global_env_chan() -> comm::Chan<Msg> {
165165
let global_ptr = rustrt::rust_global_env_chan_ptr();
166166
unsafe {
167167
priv::chan_from_global_ptr(global_ptr, || {
168168
// FIXME (#2621): This would be a good place to use a very
169169
// small foreign stack
170-
task::task().sched_mode(task::single_threaded).unlinked()
170+
task::task().sched_mode(task::SingleThreaded).unlinked()
171171
}, global_env_task)
172172
}
173173
}
174174

175-
fn global_env_task(msg_po: comm::port<Msg>) {
175+
fn global_env_task(msg_po: comm::Port<Msg>) {
176176
unsafe {
177177
do priv::weaken_task |weak_po| {
178178
loop {

0 commit comments

Comments
 (0)