Skip to content

Commit da33060

Browse files
committed
---
yaml --- r: 194952 b: refs/heads/auto c: bf9c27d h: refs/heads/master v: v3
1 parent 3faab72 commit da33060

File tree

29 files changed

+87
-107
lines changed

29 files changed

+87
-107
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: f55d03c8d8f5cf76628da771c1f5c4b9a9589c00
13+
refs/heads/auto: bf9c27d8857fc532b56fb211ec1df629f8dc68dd
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ case $CFG_OSTYPE in
404404
CFG_OSTYPE=pc-windows-gnu
405405
;;
406406

407-
# Thad's Cygwin identifiers below
407+
# Thad's Cygwin identifers below
408408

409409
# Vista 32 bit
410410
CYGWIN_NT-6.0)

branches/auto/mk/platform.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ define CFG_MAKE_TOOLCHAIN
179179

180180
ifeq ($$(findstring $(HOST_$(1)),arm aarch64 mips mipsel powerpc),)
181181

182-
# On Bitrig, we need the relocation model to be PIC for everything
182+
# On Bitrig, we need the relocation model to be PIC for everthing
183183
ifeq (,$(filter $(OSTYPE_$(1)),bitrig))
184184
LLVM_MC_RELOCATION_MODEL="pic"
185185
else

branches/auto/mk/target.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ endef
132132
# on $$(TSREQ$(1)_T_$(2)_H_$(3)), to ensure that no products will be
133133
# put into the target area until after the get-snapshot.py script has
134134
# had its chance to clean it out; otherwise the other products will be
135-
# inadvertently included in the clean out.
135+
# inadvertantly included in the clean out.
136136
SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD))
137137

138138
define TARGET_HOST_RULES

branches/auto/src/doc/trpl/arrays-vectors-and-slices.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,5 @@ You can also take a slice of a vector, `String`, or `&str`, because they are
9999
backed by arrays. Slices have type `&[T]`, which we'll talk about when we cover
100100
generics.
101101

102-
We have now learned all of the most basic Rust concepts.
102+
We have now learned all of the most basic Rust concepts. Next, we learn how to
103+
get input from the keyboard.

branches/auto/src/doc/trpl/associated-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ let obj = Box::new(graph) as Box<Graph>;
170170
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
171171
```
172172

173-
We can’t create a trait object like this, because we don’t know the associated
173+
We can’t create a trait object like this, becuase we don’t know the associated
174174
types. Instead, we can write this:
175175

176176
```rust

branches/auto/src/doc/trpl/documentation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ This will create documentation for bar both inside the documentation for the
529529
crate `foo`, as well as the documentation for your crate. It will use the same
530530
documentation in both places.
531531

532-
This behavior can be suppressed with `no_inline`:
532+
This behavior can be supressed with `no_inline`:
533533

534534
```ignore
535535
extern crate foo;

branches/auto/src/etc/rustup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ case $CFG_OSTYPE in
335335
MINGW32*)
336336
CFG_OSTYPE=pc-mingw32
337337
;;
338-
# Thad's Cygwin identifiers below
338+
# Thad's Cygwin identifers below
339339

340340
# Vista 32 bit
341341
CYGWIN_NT-6.0)
@@ -437,7 +437,7 @@ CFG_TMP_DIR=$(mktemp -d 2>/dev/null \
437437
|| create_tmp_dir)
438438

439439
# If we're saving nightlies and we didn't specify which one, grab the latest
440-
# version from the perspective of the server. Buildbot has typically finished
440+
# verison from the perspective of the server. Buildbot has typically finished
441441
# building and uploading by ~8UTC, but we want to include a little buffer.
442442
#
443443
# FIXME It would be better to use the known most recent nightly that has been

branches/auto/src/libcore/marker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ pub struct InvariantType<T>;
476476
/// particular, thanks to the `Reflect` bound, callers know that a
477477
/// function declared like `fn bar<T>(...)` will always act in
478478
/// precisely the same way no matter what type `T` is supplied,
479-
/// because there are no bounds declared on `T`. (The ability for a
479+
/// beacuse there are no bounds declared on `T`. (The ability for a
480480
/// caller to reason about what a function may do based solely on what
481481
/// generic bounds are declared is often called the ["parametricity
482482
/// property"][1].)

branches/auto/src/librbml/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
//! - `Sub32` (`0d`): 4-byte unsigned integer for supplementary information.
8484
//! Those two tags normally occur as the first subdocument of certain tags,
8585
//! namely `Enum`, `Vec` and `Map`, to provide a variant or size information.
86-
//! They can be used interchangeably.
86+
//! They can be used interchangably.
8787
//!
8888
//! Predefined tags with an explicit length:
8989
//!

branches/auto/src/librustc_back/target/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ pub struct TargetOptions {
157157
/// particular running dsymutil and some other stuff like `-dead_strip`. Defaults to false.
158158
pub is_like_osx: bool,
159159
/// Whether the target toolchain is like Windows'. Only useful for compiling against Windows,
160-
/// only really used for figuring out how to find libraries, since Windows uses its own
160+
/// only realy used for figuring out how to find libraries, since Windows uses its own
161161
/// library naming convention. Defaults to false.
162162
pub is_like_windows: bool,
163163
/// Whether the target toolchain is like Android's. Only useful for compiling against Android.

branches/auto/src/librustdoc/html/static/main.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,6 @@ h1 .stability {
493493
.stability.Locked { border-color: #0084B6; color: #00668c; }
494494
.stability.Unmarked { border-color: #BBBBBB; }
495495

496-
td.summary-column {
497-
width: 100%;
498-
}
499-
500496
.summary {
501497
padding-right: 0px;
502498
}

branches/auto/src/librustdoc/stability_summary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl Ord for ModuleSummary {
8686
}
8787
}
8888

89-
// is the item considered publicly visible?
89+
// is the item considered publically visible?
9090
fn visible(item: &Item) -> bool {
9191
match item.inner {
9292
ImplItem(_) => true,

branches/auto/src/libstd/fs/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ mod tests {
15111511
assert_eq!(v, b"foobar\0\0\0\0".to_vec());
15121512

15131513
// Truncate to a smaller length, don't seek, and then write something.
1514-
// Ensure that the intermediate zeroes are all filled in (we have `seek`ed
1514+
// Ensure that the intermediate zeroes are all filled in (we're seeked
15151515
// past the end of the file).
15161516
check!(file.set_len(2));
15171517
assert_eq!(check!(file.metadata()).len(), 2);

branches/auto/src/libstd/io/buffered.rs

Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ use io::prelude::*;
1818
use cmp;
1919
use error::{self, FromError};
2020
use fmt;
21-
use io::{self, DEFAULT_BUF_SIZE, Error, ErrorKind};
21+
use io::{self, Cursor, DEFAULT_BUF_SIZE, Error, ErrorKind};
2222
use ptr;
23-
use iter;
2423

2524
/// Wraps a `Read` and buffers input from it
2625
///
@@ -31,9 +30,7 @@ use iter;
3130
#[stable(feature = "rust1", since = "1.0.0")]
3231
pub struct BufReader<R> {
3332
inner: R,
34-
buf: Vec<u8>,
35-
pos: usize,
36-
cap: usize,
33+
buf: Cursor<Vec<u8>>,
3734
}
3835

3936
impl<R: Read> BufReader<R> {
@@ -46,13 +43,9 @@ impl<R: Read> BufReader<R> {
4643
/// Creates a new `BufReader` with the specified buffer capacity
4744
#[stable(feature = "rust1", since = "1.0.0")]
4845
pub fn with_capacity(cap: usize, inner: R) -> BufReader<R> {
49-
let mut buf = Vec::with_capacity(cap);
50-
buf.extend(iter::repeat(0).take(cap));
5146
BufReader {
5247
inner: inner,
53-
buf: buf,
54-
pos: 0,
55-
cap: 0,
48+
buf: Cursor::new(Vec::with_capacity(cap)),
5649
}
5750
}
5851

@@ -81,15 +74,12 @@ impl<R: Read> Read for BufReader<R> {
8174
// If we don't have any buffered data and we're doing a massive read
8275
// (larger than our internal buffer), bypass our internal buffer
8376
// entirely.
84-
if self.pos == self.cap && buf.len() >= self.buf.len() {
77+
if self.buf.get_ref().len() == self.buf.position() as usize &&
78+
buf.len() >= self.buf.get_ref().capacity() {
8579
return self.inner.read(buf);
8680
}
87-
let nread = {
88-
let mut rem = try!(self.fill_buf());
89-
try!(rem.read(buf))
90-
};
91-
self.consume(nread);
92-
Ok(nread)
81+
try!(self.fill_buf());
82+
self.buf.read(buf)
9383
}
9484
}
9585

@@ -98,25 +88,26 @@ impl<R: Read> BufRead for BufReader<R> {
9888
fn fill_buf(&mut self) -> io::Result<&[u8]> {
9989
// If we've reached the end of our internal buffer then we need to fetch
10090
// some more data from the underlying reader.
101-
if self.pos == self.cap {
102-
self.cap = try!(self.inner.read(&mut self.buf));
103-
self.pos = 0;
91+
if self.buf.position() as usize == self.buf.get_ref().len() {
92+
self.buf.set_position(0);
93+
let v = self.buf.get_mut();
94+
v.truncate(0);
95+
let inner = &mut self.inner;
96+
try!(super::with_end_to_cap(v, |b| inner.read(b)));
10497
}
105-
Ok(&self.buf[self.pos..self.cap])
98+
self.buf.fill_buf()
10699
}
107100

108101
fn consume(&mut self, amt: usize) {
109-
self.pos = cmp::min(self.pos + amt, self.cap);
102+
self.buf.consume(amt)
110103
}
111104
}
112105

113106
#[stable(feature = "rust1", since = "1.0.0")]
114107
impl<R> fmt::Debug for BufReader<R> where R: fmt::Debug {
115108
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
116-
fmt.debug_struct("BufReader")
117-
.field("reader", &self.inner)
118-
.field("buffer", &format_args!("{}/{}", self.cap - self.pos, self.buf.len()))
119-
.finish()
109+
write!(fmt, "BufReader {{ reader: {:?}, buffer: {}/{} }}",
110+
self.inner, self.buf.position(), self.buf.get_ref().len())
120111
}
121112
}
122113

@@ -231,10 +222,8 @@ impl<W: Write> Write for BufWriter<W> {
231222
#[stable(feature = "rust1", since = "1.0.0")]
232223
impl<W: Write> fmt::Debug for BufWriter<W> where W: fmt::Debug {
233224
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
234-
fmt.debug_struct("BufWriter")
235-
.field("writer", &self.inner.as_ref().unwrap())
236-
.field("buffer", &format_args!("{}/{}", self.buf.len(), self.buf.capacity()))
237-
.finish()
225+
write!(fmt, "BufWriter {{ writer: {:?}, buffer: {}/{} }}",
226+
self.inner.as_ref().unwrap(), self.buf.len(), self.buf.capacity())
238227
}
239228
}
240229

@@ -348,11 +337,9 @@ impl<W: Write> Write for LineWriter<W> {
348337
#[stable(feature = "rust1", since = "1.0.0")]
349338
impl<W: Write> fmt::Debug for LineWriter<W> where W: fmt::Debug {
350339
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
351-
fmt.debug_struct("LineWriter")
352-
.field("writer", &self.inner.inner)
353-
.field("buffer",
354-
&format_args!("{}/{}", self.inner.buf.len(), self.inner.buf.capacity()))
355-
.finish()
340+
write!(fmt, "LineWriter {{ writer: {:?}, buffer: {}/{} }}",
341+
self.inner.inner, self.inner.buf.len(),
342+
self.inner.buf.capacity())
356343
}
357344
}
358345

@@ -428,10 +415,10 @@ impl<S: Read + Write> BufStream<S> {
428415
/// Any leftover data in the read buffer is lost.
429416
#[stable(feature = "rust1", since = "1.0.0")]
430417
pub fn into_inner(self) -> Result<S, IntoInnerError<BufStream<S>>> {
431-
let BufReader { inner: InternalBufWriter(w), buf, pos, cap } = self.inner;
418+
let BufReader { inner: InternalBufWriter(w), buf } = self.inner;
432419
w.into_inner().map_err(|IntoInnerError(w, e)| {
433420
IntoInnerError(BufStream {
434-
inner: BufReader { inner: InternalBufWriter(w), buf: buf, pos: pos, cap: cap },
421+
inner: BufReader { inner: InternalBufWriter(w), buf: buf },
435422
}, e)
436423
})
437424
}
@@ -465,12 +452,10 @@ impl<S: Write> fmt::Debug for BufStream<S> where S: fmt::Debug {
465452
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
466453
let reader = &self.inner;
467454
let writer = &self.inner.inner.0;
468-
fmt.debug_struct("BufStream")
469-
.field("stream", &writer.inner)
470-
.field("write_buffer", &format_args!("{}/{}", writer.buf.len(), writer.buf.capacity()))
471-
.field("read_buffer",
472-
&format_args!("{}/{}", reader.cap - reader.pos, reader.buf.len()))
473-
.finish()
455+
write!(fmt, "BufStream {{ stream: {:?}, write_buffer: {}/{}, read_buffer: {}/{} }}",
456+
writer.inner,
457+
writer.buf.len(), writer.buf.capacity(),
458+
reader.buf.position(), reader.buf.get_ref().len())
474459
}
475460
}
476461

branches/auto/src/libstd/io/mod.rs

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,30 @@ mod stdio;
4848

4949
const DEFAULT_BUF_SIZE: usize = 64 * 1024;
5050

51+
// Acquires a slice of the vector `v` from its length to its capacity
52+
// (after initializing the data), reads into it, and then updates the length.
53+
//
54+
// This function is leveraged to efficiently read some bytes into a destination
55+
// vector without extra copying and taking advantage of the space that's already
56+
// in `v`.
57+
fn with_end_to_cap<F>(v: &mut Vec<u8>, f: F) -> Result<usize>
58+
where F: FnOnce(&mut [u8]) -> Result<usize>
59+
{
60+
let len = v.len();
61+
let new_area = v.capacity() - len;
62+
v.extend(iter::repeat(0).take(new_area));
63+
match f(&mut v[len..]) {
64+
Ok(n) => {
65+
v.truncate(len + n);
66+
Ok(n)
67+
}
68+
Err(e) => {
69+
v.truncate(len);
70+
Err(e)
71+
}
72+
}
73+
}
74+
5175
// A few methods below (read_to_string, read_line) will append data into a
5276
// `String` buffer, but we need to be pretty careful when doing this. The
5377
// implementation will just call `.as_mut_vec()` and then delegate to a
@@ -92,45 +116,19 @@ fn append_to_string<F>(buf: &mut String, f: F) -> Result<usize>
92116
}
93117
}
94118

95-
// This uses an adaptive system to extend the vector when it fills. We want to
96-
// avoid paying to allocate and zero a huge chunk of memory if the reader only
97-
// has 4 bytes while still making large reads if the reader does have a ton
98-
// of data to return. Simply tacking on an extra DEFAULT_BUF_SIZE space every
99-
// time is 4,500 times (!) slower than this if the reader has a very small
100-
// amount of data to return.
101119
fn read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> Result<usize> {
102-
let start_len = buf.len();
103-
let mut len = start_len;
104-
let mut cap_bump = 16;
105-
let ret;
120+
let mut read = 0;
106121
loop {
107-
if len == buf.len() {
108-
if buf.capacity() == buf.len() {
109-
if cap_bump < DEFAULT_BUF_SIZE {
110-
cap_bump *= 2;
111-
}
112-
buf.reserve(cap_bump);
113-
}
114-
let new_area = buf.capacity() - buf.len();
115-
buf.extend(iter::repeat(0).take(new_area));
122+
if buf.capacity() == buf.len() {
123+
buf.reserve(DEFAULT_BUF_SIZE);
116124
}
117-
118-
match r.read(&mut buf[len..]) {
119-
Ok(0) => {
120-
ret = Ok(len - start_len);
121-
break;
122-
}
123-
Ok(n) => len += n,
125+
match with_end_to_cap(buf, |b| r.read(b)) {
126+
Ok(0) => return Ok(read),
127+
Ok(n) => read += n,
124128
Err(ref e) if e.kind() == ErrorKind::Interrupted => {}
125-
Err(e) => {
126-
ret = Err(e);
127-
break;
128-
}
129+
Err(e) => return Err(e),
129130
}
130131
}
131-
132-
buf.truncate(len);
133-
ret
134132
}
135133

136134
/// A trait for objects which are byte-oriented sources.

branches/auto/src/libstd/old_io/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ mod test {
15321532
b"foobar\0\0\0\0".to_vec());
15331533

15341534
// Truncate to a smaller length, don't seek, and then write something.
1535-
// Ensure that the intermediate zeroes are all filled in (we have `seek`ed
1535+
// Ensure that the intermediate zeroes are all filled in (we're seeked
15361536
// past the end of the file).
15371537
check!(file.truncate(2));
15381538
assert_eq!(check!(file.stat()).size, 2);

branches/auto/src/libtest/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ The FILTER regex is tested against the name of all tests to run, and
340340
only those tests that match are run.
341341
342342
By default, all tests are run in parallel. This can be altered with the
343-
RUST_TEST_THRADS environment variable when running tests (set it to 1).
343+
RUST_TEST_THREADS environment variable when running tests (set it to 1).
344344
345345
All tests have their standard output and standard error captured by default.
346346
This can be overridden with the --nocapture flag or the RUST_TEST_NOCAPTURE=1

branches/auto/src/test/compile-fail/issue-9814.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// Verify that single-variant enums can't be de-referenced
11+
// Verify that single-variant enums cant be de-referenced
1212
// Regression test for issue #9814
1313

1414
enum Foo { Bar(isize) }

0 commit comments

Comments
 (0)