Skip to content

Commit 05367ea

Browse files
committed
---
yaml --- r: 10618 b: refs/heads/snap-stage3 c: 0a6943d h: refs/heads/master v: v3
1 parent 1ca49bf commit 05367ea

File tree

13 files changed

+90
-155
lines changed

13 files changed

+90
-155
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 1b642bf02f23d48c93047ae2fca9ebd7c2bdc518
4+
refs/heads/snap-stage3: 0a6943dd31e8002b2e0267b7539b55ba9da7490b
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/doc/rust.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,9 @@ h3 a:link, h3 a:visited { color: black; }
5151
.cm-s-default span.cm-bracket {color: #cc7;}
5252
.cm-s-default span.cm-tag {color: #170;}
5353
.cm-s-default span.cm-attribute {color: #00c;}
54+
55+
h1.title {
56+
background-image: url('http://www.rust-lang.org/logos/rust-logo-32x32-blk.png');
57+
background-repeat: no-repeat;
58+
background-position: right;
59+
}

branches/snap-stage3/src/libcore/comm.rs

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -94,31 +94,27 @@ fn listen<T: send, U>(f: fn(chan<T>) -> U) -> U {
9494
f(po.chan())
9595
}
9696

97-
class port_ptr<T:send> {
98-
let po: *rust_port;
99-
new(po: *rust_port) { self.po = po; }
100-
drop unsafe {
97+
resource port_ptr<T: send>(po: *rust_port) unsafe {
10198
task::unkillable {||
10299
// Once the port is detached it's guaranteed not to receive further
103100
// messages
104101
let yield = 0u;
105102
let yieldp = ptr::addr_of(yield);
106-
rustrt::rust_port_begin_detach(self.po, yieldp);
103+
rustrt::rust_port_begin_detach(po, yieldp);
107104
if yield != 0u {
108105
// Need to wait for the port to be detached
109106
// FIXME: If this fails then we're going to leave our port
110107
// in a bogus state. (Issue #1988)
111108
task::yield();
112109
}
113-
rustrt::rust_port_end_detach(self.po);
110+
rustrt::rust_port_end_detach(po);
114111

115112
// Drain the port so that all the still-enqueued items get dropped
116-
while rustrt::rust_port_size(self.po) > 0u as size_t {
117-
recv_::<T>(self.po);
113+
while rustrt::rust_port_size(po) > 0u as size_t {
114+
recv_::<T>(po);
118115
}
119-
rustrt::del_port(self.po);
116+
rustrt::del_port(po);
120117
}
121-
}
122118
}
123119

124120
#[doc = "
@@ -130,34 +126,29 @@ Fails if the port is detached or dead. Fails if the port
130126
is owned by a different task.
131127
"]
132128
fn as_raw_port<T: send, U>(ch: comm::chan<T>, f: fn(*rust_port) -> U) -> U {
133-
134-
class portref {
135-
let p: *rust_port;
136-
new(p: *rust_port) { self.p = p; }
137-
drop {
138-
if !ptr::is_null(self.p) {
139-
rustrt::rust_port_drop(self.p);
140-
}
141-
}
129+
resource portref(p: *rust_port) {
130+
if !ptr::is_null(p) {
131+
rustrt::rust_port_drop(p);
132+
}
142133
}
143134

144135
let p = portref(rustrt::rust_port_take(*ch));
145136

146-
if ptr::is_null(p.p) {
137+
if ptr::is_null(*p) {
147138
fail "unable to locate port for channel"
148-
} else if rustrt::get_task_id() != rustrt::rust_port_task(p.p) {
139+
} else if rustrt::get_task_id() != rustrt::rust_port_task(*p) {
149140
fail "unable to access unowned port"
150141
}
151142

152-
f(p.p)
143+
f(*p)
153144
}
154145

155146
#[doc = "
156147
Constructs a channel. The channel is bound to the port used to
157148
construct it.
158149
"]
159150
fn chan<T: send>(p: port<T>) -> chan<T> {
160-
chan_t(rustrt::get_port_id((**p).po))
151+
chan_t(rustrt::get_port_id(***p))
161152
}
162153

163154
#[doc = "
@@ -179,10 +170,10 @@ fn send<T: send>(ch: chan<T>, -data: T) {
179170
Receive from a port. If no data is available on the port then the
180171
task will block until data becomes available.
181172
"]
182-
fn recv<T: send>(p: port<T>) -> T { recv_((**p).po) }
173+
fn recv<T: send>(p: port<T>) -> T { recv_(***p) }
183174

184175
#[doc = "Returns true if there are messages available"]
185-
fn peek<T: send>(p: port<T>) -> bool { peek_((**p).po) }
176+
fn peek<T: send>(p: port<T>) -> bool { peek_(***p) }
186177

187178
#[doc(hidden)]
188179
fn recv_chan<T: send>(ch: comm::chan<T>) -> T {
@@ -205,7 +196,7 @@ fn recv_<T: send>(p: *rust_port) -> T {
205196
// Data isn't available yet, so res has not been initialized.
206197
task::yield();
207198
} else {
208-
// In the absence of compiler-generated preemption points
199+
// In the absense of compiler-generated preemption points
209200
// this is a good place to yield
210201
task::yield();
211202
}
@@ -219,7 +210,7 @@ fn peek_(p: *rust_port) -> bool unsafe {
219210
#[doc = "Receive on one of two ports"]
220211
fn select2<A: send, B: send>(p_a: port<A>, p_b: port<B>)
221212
-> either<A, B> unsafe {
222-
let ports = [(**p_a).po, (**p_b).po];
213+
let ports = [***p_a, ***p_b];
223214
let n_ports = 2 as libc::size_t;
224215
let yield = 0u, yieldp = ptr::addr_of(yield);
225216

@@ -242,9 +233,9 @@ fn select2<A: send, B: send>(p_a: port<A>, p_b: port<B>)
242233
// Now we know the port we're supposed to receive from
243234
assert resport != ptr::null();
244235

245-
if resport == (**p_a).po {
236+
if resport == ***p_a {
246237
either::left(recv(p_a))
247-
} else if resport == (**p_b).po {
238+
} else if resport == ***p_b {
248239
either::right(recv(p_b))
249240
} else {
250241
fail "unexpected result from rust_port_select";
@@ -491,4 +482,4 @@ fn test_port_detach_fail() {
491482
}
492483
}
493484
}
494-
}
485+
}

branches/snap-stage3/src/libcore/stackwalk.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ fn walk_stack(visit: fn(frame) -> bool) {
2323
reinterpret_cast(frame_pointer)
2424
};
2525
loop {
26-
let fr = frame(frame_address);
26+
let frame = frame(frame_address);
2727

28-
#debug("frame: %x", unsafe { reinterpret_cast(fr.fp) });
29-
visit(fr);
28+
#debug("frame: %x", unsafe { reinterpret_cast(frame.fp) });
29+
visit(frame);
3030

3131
unsafe {
3232
let next_fp: **word = reinterpret_cast(frame_address);
@@ -44,7 +44,7 @@ fn walk_stack(visit: fn(frame) -> bool) {
4444

4545
#[test]
4646
fn test_simple() {
47-
for walk_stack { |_frame|
47+
for walk_stack { |frame|
4848
}
4949
}
5050

@@ -53,7 +53,7 @@ fn test_simple_deep() {
5353
fn run(i: int) {
5454
if i == 0 { ret }
5555

56-
for walk_stack { |_frame|
56+
for walk_stack { |frame|
5757
unsafe {
5858
breakpoint();
5959
}

branches/snap-stage3/src/libcore/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ pure fn to_upper(s: str/&) -> str {
566566
}
567567

568568
#[doc = "
569-
Replace all occurrences of one string with another
569+
Replace all occurances of one string with another
570570
571571
# Arguments
572572

branches/snap-stage3/src/libstd/par.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import future::future;
77
export map, mapi, alli, any, mapi_factory;
88

99
#[doc="The maximum number of tasks this module will spawn for a single
10-
operation."]
10+
operationg."]
1111
const max_tasks : uint = 32u;
1212

1313
#[doc="The minimum number of elements each task will process."]

branches/snap-stage3/src/rustc/middle/resolve.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ fn visit_item_with_scope(e: @env, i: @ast::item,
573573
}
574574
ast::item_class(tps, ifaces, members, ctor, m_dtor, _) {
575575
v.visit_ty_params(tps, sc, v);
576+
// Can maybe skip this now that we require self on class fields
576577
let class_scope = @cons(scope_item(i), sc);
577578
/* visit the constructor... */
578579
let ctor_scope = @cons(scope_method(ctor.node.self_id, tps),
@@ -1060,7 +1061,7 @@ fn lookup_in_scope(e: env, &&sc: scopes, sp: span, name: ident, ns: namespace,
10601061
}
10611062
ast::item_class(tps, _, members, ctor, _, _) {
10621063
if ns == ns_type {
1063-
ret lookup_in_ty_params(e, name, tps);
1064+
ret lookup_in_ty_params(e, name, tps);
10641065
}
10651066
if ns == ns_val && name == it.ident {
10661067
ret some(ast::def_fn(local_def(ctor.node.id),
@@ -1316,14 +1317,13 @@ fn found_def_item(i: @ast::item, ns: namespace) -> option<def> {
13161317
alt i.node {
13171318
ast::item_const(*) {
13181319
if ns == ns_val {
1319-
ret some(ast::def_const(local_def(i.id)));
1320-
}
1320+
ret some(ast::def_const(local_def(i.id))); }
13211321
}
13221322
ast::item_fn(decl, _, _) {
1323-
if ns == ns_val {
1323+
if ns == ns_val {
13241324
ret some(ast::def_fn(local_def(i.id), decl.purity));
1325-
}
1326-
}
1325+
}
1326+
}
13271327
ast::item_mod(_) {
13281328
if ns == ns_module { ret some(ast::def_mod(local_def(i.id))); }
13291329
}
@@ -1342,16 +1342,9 @@ fn found_def_item(i: @ast::item, ns: namespace) -> option<def> {
13421342
_ { }
13431343
}
13441344
}
1345-
ast::item_class(_, _, _members, ct, _, _) {
1346-
alt ns {
1347-
ns_type {
1348-
ret some(ast::def_class(local_def(i.id)));
1349-
}
1350-
ns_val {
1351-
ret some(ast::def_fn(local_def(ct.node.id),
1352-
ast::impure_fn));
1353-
}
1354-
ns_module { }
1345+
ast::item_class(*) {
1346+
if ns == ns_type {
1347+
ret some(ast::def_class(local_def(i.id)));
13551348
}
13561349
}
13571350
ast::item_impl(*) { /* ??? */ }
@@ -1660,6 +1653,14 @@ fn index_mod(md: ast::_mod) -> mod_index {
16601653
ast::item_class(tps, _, items, ctor, _, _) {
16611654
// add the class name itself
16621655
add_to_index(index, it.ident, mie_item(it));
1656+
// add the constructor decl
1657+
add_to_index(index, it.ident,
1658+
mie_item(@{ident: it.ident, attrs: [],
1659+
id: ctor.node.id,
1660+
node:
1661+
item_fn(ctor.node.dec, tps, ctor.node.body),
1662+
vis: ast::public,
1663+
span: ctor.node.body.span}));
16631664
}
16641665
}
16651666
}

0 commit comments

Comments
 (0)