Skip to content

Commit 517ae6b

Browse files
author
Olivier Saut
committed
---
yaml --- r: 146332 b: refs/heads/try2 c: a6cd20b h: refs/heads/master v: v3
1 parent 2cc4131 commit 517ae6b

File tree

19 files changed

+62
-73
lines changed

19 files changed

+62
-73
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: c7d5a5214470a697b1ba31d23ef02763b0e6a774
8+
refs/heads/try2: a6cd20bff93054d29bd232aebca59803ce64013b
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/install.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ install-host: LIB_DESTIN_DIR=$(PHL)
139139
install-host: $(CSREQ$(ISTAGE)_T_$(CFG_BUILD_)_H_$(CFG_BUILD_))
140140
$(Q)$(call MK_INSTALL_DIR,$(PREFIX_BIN))
141141
$(Q)$(call MK_INSTALL_DIR,$(PREFIX_LIB))
142-
$(Q)$(call MK_INSTALL_DIR,$(CFG_MANDIR/man1)
142+
$(Q)$(call MK_INSTALL_DIR,$(CFG_MANDIR)/man1)
143143
$(Q)$(call INSTALL,$(HB2),$(PHB),rustc$(X_$(CFG_BUILD)))
144144
$(Q)$(call INSTALL,$(HB2),$(PHB),rustpkg$(X_$(CFG_BUILD)))
145145
$(Q)$(call INSTALL,$(HB2),$(PHB),rustdoc$(X_$(CFG_BUILD)))
@@ -152,9 +152,9 @@ install-host: $(CSREQ$(ISTAGE)_T_$(CFG_BUILD_)_H_$(CFG_BUILD_))
152152
$(Q)$(call INSTALL_LIB,$(LIBRUSTDOC_GLOB_$(CFG_BUILD)))
153153
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUNTIME_$(CFG_BUILD)))
154154
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM_$(CFG_BUILD)))
155-
$(Q)$(call INSTALL,$(S)/man, $(CFG_MANDIR/man1,rustc.1)
156-
$(Q)$(call INSTALL,$(S)/man, $(CFG_MANDIR/man1,rustdoc.1)
157-
$(Q)$(call INSTALL,$(S)/man, $(CFG_MANDIR/man1,rustpkg.1)
155+
$(Q)$(call INSTALL,$(S)/man, $(CFG_MANDIR)/man1,rustc.1)
156+
$(Q)$(call INSTALL,$(S)/man, $(CFG_MANDIR)/man1,rustdoc.1)
157+
$(Q)$(call INSTALL,$(S)/man, $(CFG_MANDIR)/man1,rustpkg.1)
158158

159159
install-targets: $(INSTALL_TARGET_RULES)
160160

branches/try2/src/libextra/treemap.rs

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<K: TotalOrd, V> TreeMap<K, V> {
145145
pub fn iter<'a>(&'a self) -> TreeMapIterator<'a, K, V> {
146146
TreeMapIterator {
147147
stack: ~[],
148-
node: deref(&self.root),
148+
node: &self.root,
149149
remaining_min: self.length,
150150
remaining_max: self.length
151151
}
@@ -162,7 +162,7 @@ impl<K: TotalOrd, V> TreeMap<K, V> {
162162
fn iter_for_traversal<'a>(&'a self) -> TreeMapIterator<'a, K, V> {
163163
TreeMapIterator {
164164
stack: ~[],
165-
node: deref(&self.root),
165+
node: &self.root,
166166
remaining_min: 0,
167167
remaining_max: self.length
168168
}
@@ -173,8 +173,8 @@ impl<K: TotalOrd, V> TreeMap<K, V> {
173173
pub fn lower_bound_iter<'a>(&'a self, k: &K) -> TreeMapIterator<'a, K, V> {
174174
let mut iter: TreeMapIterator<'a, K, V> = self.iter_for_traversal();
175175
loop {
176-
match iter.node {
177-
Some(r) => {
176+
match *iter.node {
177+
Some(ref r) => {
178178
match k.cmp(&r.key) {
179179
Less => iter_traverse_left(&mut iter),
180180
Greater => iter_traverse_right(&mut iter),
@@ -197,8 +197,8 @@ impl<K: TotalOrd, V> TreeMap<K, V> {
197197
pub fn upper_bound_iter<'a>(&'a self, k: &K) -> TreeMapIterator<'a, K, V> {
198198
let mut iter: TreeMapIterator<'a, K, V> = self.iter_for_traversal();
199199
loop {
200-
match iter.node {
201-
Some(r) => {
200+
match *iter.node {
201+
Some(ref r) => {
202202
match k.cmp(&r.key) {
203203
Less => iter_traverse_left(&mut iter),
204204
Greater => iter_traverse_right(&mut iter),
@@ -229,34 +229,24 @@ impl<K: TotalOrd, V> TreeMap<K, V> {
229229

230230
/// Lazy forward iterator over a map
231231
pub struct TreeMapIterator<'self, K, V> {
232-
priv stack: ~[&'self TreeNode<K, V>],
233-
priv node: Option<&'self TreeNode<K, V>>,
232+
priv stack: ~[&'self ~TreeNode<K, V>],
233+
priv node: &'self Option<~TreeNode<K, V>>,
234234
priv remaining_min: uint,
235235
priv remaining_max: uint
236236
}
237237

238-
fn deref<'a, K, V>(node: &'a Option<~TreeNode<K, V>>) -> Option<&'a TreeNode<K, V>> {
239-
match *node {
240-
Some(ref n) => {
241-
let n: &TreeNode<K, V> = *n;
242-
Some(n)
243-
}
244-
None => None
245-
}
246-
}
247-
248238
impl<'self, K, V> TreeMapIterator<'self, K, V> {
249239
#[inline(always)]
250240
fn next_(&mut self, forward: bool) -> Option<(&'self K, &'self V)> {
251241
while !self.stack.is_empty() || self.node.is_some() {
252-
match self.node {
253-
Some(x) => {
242+
match *self.node {
243+
Some(ref x) => {
254244
self.stack.push(x);
255-
self.node = deref(if forward { &x.left } else { &x.right });
245+
self.node = if forward { &x.left } else { &x.right };
256246
}
257247
None => {
258248
let res = self.stack.pop();
259-
self.node = deref(if forward { &res.right } else { &res.left });
249+
self.node = if forward { &res.right } else { &res.left };
260250
self.remaining_max -= 1;
261251
if self.remaining_min > 0 {
262252
self.remaining_min -= 1;
@@ -312,14 +302,14 @@ impl<'self, K, V> Iterator<(&'self K, &'self V)> for TreeMapRevIterator<'self, K
312302
/// - complete initialization with `iter_traverse_complete`
313303
#[inline]
314304
fn iter_traverse_left<'a, K, V>(it: &mut TreeMapIterator<'a, K, V>) {
315-
let node = it.node.unwrap();
305+
let node = it.node.get_ref();
316306
it.stack.push(node);
317-
it.node = deref(&node.left);
307+
it.node = &node.left;
318308
}
319309

320310
#[inline]
321311
fn iter_traverse_right<'a, K, V>(it: &mut TreeMapIterator<'a, K, V>) {
322-
it.node = deref(&it.node.get_ref().right);
312+
it.node = &(it.node.get_ref().right);
323313
}
324314

325315
/// iter_traverse_left, iter_traverse_right and iter_traverse_complete are used to
@@ -331,10 +321,11 @@ fn iter_traverse_right<'a, K, V>(it: &mut TreeMapIterator<'a, K, V>) {
331321
/// traversed left.
332322
#[inline]
333323
fn iter_traverse_complete<'a, K, V>(it: &mut TreeMapIterator<'a, K, V>) {
334-
match it.node {
335-
Some(n) => {
324+
static none: Option<~TreeNode<K, V>> = None;
325+
match *it.node {
326+
Some(ref n) => {
336327
it.stack.push(n);
337-
it.node = None;
328+
it.node = &none;
338329
}
339330
None => ()
340331
}

branches/try2/src/librustc/middle/resolve.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3488,17 +3488,10 @@ impl Resolver {
34883488
return None;
34893489
}
34903490
ConstantItemRibKind => {
3491-
if is_ty_param {
3492-
// see #9186
3493-
self.resolve_error(span,
3494-
"cannot use an outer type \
3495-
parameter in this context");
3496-
} else {
3497-
// Still doesn't deal with upvars
3498-
self.resolve_error(span,
3499-
"attempt to use a non-constant \
3500-
value in a constant");
3501-
}
3491+
// Still doesn't deal with upvars
3492+
self.resolve_error(span,
3493+
"attempt to use a non-constant \
3494+
value in a constant");
35023495

35033496
}
35043497
}
@@ -3771,9 +3764,7 @@ impl Resolver {
37713764

37723765
fn with_constant_rib(&mut self, f: &fn(&mut Resolver)) {
37733766
self.value_ribs.push(@Rib::new(ConstantItemRibKind));
3774-
self.type_ribs.push(@Rib::new(ConstantItemRibKind));
37753767
f(self);
3776-
self.type_ribs.pop();
37773768
self.value_ribs.pop();
37783769
}
37793770

branches/try2/src/librustuv/uvio.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,6 +1653,9 @@ impl RtioFileStream for UvFileStream {
16531653
let self_ = unsafe { cast::transmute::<&UvFileStream, &mut UvFileStream>(self) };
16541654
self_.seek_common(0, SEEK_CUR)
16551655
}
1656+
fn flush(&mut self) -> Result<(), IoError> {
1657+
Ok(())
1658+
}
16561659
}
16571660

16581661
pub struct UvProcess {

branches/try2/src/libstd/rt/io/buffered.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ mod test {
418418

419419
impl rt::io::Writer for S {
420420
fn write(&mut self, _: &[u8]) {}
421+
fn flush(&mut self) {}
421422
}
422423

423424
impl rt::io::Reader for S {

branches/try2/src/libstd/rt/io/comm_adapters.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ impl<C: GenericChan<~[u8]>> ChanWriter<C> {
3232

3333
impl<C: GenericChan<~[u8]>> Writer for ChanWriter<C> {
3434
fn write(&mut self, _buf: &[u8]) { fail!() }
35+
36+
fn flush(&mut self) { fail!() }
3537
}
3638

3739
struct ReaderPort<R>;

branches/try2/src/libstd/rt/io/file.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,15 @@ impl Writer for FileStream {
383383
}
384384
}
385385
}
386+
387+
fn flush(&mut self) {
388+
match self.fd.flush() {
389+
Ok(_) => (),
390+
Err(ioerr) => {
391+
io_error::cond.raise(ioerr);
392+
}
393+
}
394+
}
386395
}
387396

388397
/// a `std::rt::io:Seek` trait impl for file I/O.

branches/try2/src/libstd/rt/io/mem.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ impl Writer for MemWriter {
6262
// Bump us forward
6363
self.pos += buf.len();
6464
}
65+
66+
fn flush(&mut self) { /* no-op */ }
6567
}
6668

6769
impl Seek for MemWriter {

branches/try2/src/libstd/rt/io/mock.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,19 @@ impl Reader for MockReader {
3232

3333
pub struct MockWriter {
3434
priv write: ~fn(buf: &[u8]),
35+
priv flush: ~fn()
3536
}
3637

3738
impl MockWriter {
3839
pub fn new() -> MockWriter {
3940
MockWriter {
4041
write: |_| (),
42+
flush: || ()
4143
}
4244
}
4345
}
4446

4547
impl Writer for MockWriter {
4648
fn write(&mut self, buf: &[u8]) { (self.write)(buf) }
49+
fn flush(&mut self) { (self.flush)() }
4750
}

branches/try2/src/libstd/rt/io/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -810,12 +810,8 @@ pub trait Writer {
810810
/// Raises the `io_error` condition on error
811811
fn write(&mut self, buf: &[u8]);
812812

813-
/// Flush this output stream, ensuring that all intermediately buffered
814-
/// contents reach their destination.
815-
///
816-
/// This is by default a no-op and implementors of the `Writer` trait should
817-
/// decide whether their stream needs to be buffered or not.
818-
fn flush(&mut self) {}
813+
/// Flush output
814+
fn flush(&mut self);
819815

820816
/// Write the result of passing n through `int::to_str_bytes`.
821817
fn write_int(&mut self, n: int) {

branches/try2/src/libstd/rt/io/native/file.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ impl Writer for FileDesc {
132132
raise_error();
133133
}
134134
}
135+
136+
fn flush(&mut self) {}
135137
}
136138

137139
impl Drop for FileDesc {

branches/try2/src/libstd/rt/io/net/tcp.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ impl Writer for TcpStream {
8484
Err(ioerr) => io_error::cond.raise(ioerr),
8585
}
8686
}
87+
88+
fn flush(&mut self) { /* no-op */ }
8789
}
8890

8991
pub struct TcpListener {

branches/try2/src/libstd/rt/io/net/udp.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ impl Writer for UdpStream {
100100
sock.sendto(buf, self.connectedTo);
101101
}
102102
}
103+
104+
fn flush(&mut self) { fail!() }
103105
}
104106

105107
#[cfg(test)]

branches/try2/src/libstd/rt/io/net/unix.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ impl Reader for UnixStream {
7878

7979
impl Writer for UnixStream {
8080
fn write(&mut self, buf: &[u8]) { self.obj.write(buf) }
81+
fn flush(&mut self) { self.obj.flush() }
8182
}
8283

8384
pub struct UnixListener {

branches/try2/src/libstd/rt/io/pipe.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,6 @@ impl Writer for PipeStream {
8686
}
8787
}
8888
}
89+
90+
fn flush(&mut self) {}
8991
}

branches/try2/src/libstd/rt/io/stdio.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ impl Writer for StdWriter {
294294
Err(e) => io_error::cond.raise(e)
295295
}
296296
}
297+
298+
fn flush(&mut self) { /* nothing to do */ }
297299
}
298300

299301
#[cfg(test)]

branches/try2/src/libstd/rt/rtio.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ pub trait RtioFileStream {
173173
fn pwrite(&mut self, buf: &[u8], offset: u64) -> Result<(), IoError>;
174174
fn seek(&mut self, pos: i64, whence: SeekStyle) -> Result<u64, IoError>;
175175
fn tell(&self) -> Result<u64, IoError>;
176+
fn flush(&mut self) -> Result<(), IoError>;
176177
}
177178

178179
pub trait RtioProcess {

branches/try2/src/test/compile-fail/inner-static-type-parameter.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)