Skip to content

Commit 8c162a2

Browse files
committed
---
yaml --- r: 273453 b: refs/heads/beta c: 1605ab3 h: refs/heads/master i: 273451: 17fe1dd
1 parent f06045f commit 8c162a2

File tree

85 files changed

+651
-3349
lines changed

Some content is hidden

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

85 files changed

+651
-3349
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: d6af19b89c477708ed0f5341ab7a26f1764f1ffa
26+
refs/heads/beta: 1605ab377bc2c9be97df2cfbab00e011d526e316
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/mk/crates.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ DEPS_rustc := syntax fmt_macros flate arena serialize getopts rbml rustc_front\
9797
log graphviz rustc_llvm rustc_back rustc_data_structures\
9898
rustc_const_eval
9999
DEPS_rustc_back := std syntax rustc_llvm rustc_front flate log libc
100-
DEPS_rustc_borrowck := rustc rustc_front rustc_mir log graphviz syntax
100+
DEPS_rustc_borrowck := rustc rustc_front log graphviz syntax
101101
DEPS_rustc_data_structures := std log serialize
102102
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
103103
rustc_typeck rustc_mir rustc_resolve log syntax serialize rustc_llvm \

branches/beta/src/bootstrap/build/check.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,3 @@ pub fn linkcheck(build: &Build, stage: u32, host: &str) {
1616
build.run(build.tool_cmd(&compiler, "linkchecker")
1717
.arg(build.out.join(host).join("doc")));
1818
}
19-
20-
pub fn cargotest(build: &Build, stage: u32, host: &str) {
21-
let ref compiler = Compiler::new(stage, host);
22-
build.run(build.tool_cmd(compiler, "cargotest")
23-
.env("RUSTC", build.compiler_path(compiler))
24-
.env("RUSTDOC", build.rustdoc(compiler))
25-
.arg(&build.cargo));
26-
}

branches/beta/src/bootstrap/build/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,6 @@ impl Build {
183183
compile::tool(self, stage, target.target,
184184
"error_index_generator");
185185
}
186-
ToolCargoTest { stage } => {
187-
compile::tool(self, stage, target.target, "cargotest");
188-
}
189186
DocBook { stage } => {
190187
doc::rustbook(self, stage, target.target, "book", &doc_out);
191188
}
@@ -213,9 +210,6 @@ impl Build {
213210
CheckLinkcheck { stage } => {
214211
check::linkcheck(self, stage, target.target);
215212
}
216-
CheckCargoTest { stage } => {
217-
check::cargotest(self, stage, target.target);
218-
}
219213

220214
DistDocs { stage } => dist::docs(self, stage, target.target),
221215
DistMingw { _dummy } => dist::mingw(self, target.target),

branches/beta/src/bootstrap/build/step.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ macro_rules! targets {
4747
(tool_linkchecker, ToolLinkchecker { stage: u32 }),
4848
(tool_rustbook, ToolRustbook { stage: u32 }),
4949
(tool_error_index, ToolErrorIndex { stage: u32 }),
50-
(tool_cargotest, ToolCargoTest { stage: u32 }),
5150

5251
// Steps for long-running native builds. Ideally these wouldn't
5352
// actually exist and would be part of build scripts, but for now
@@ -74,7 +73,6 @@ macro_rules! targets {
7473
// target to depend on a bunch of others.
7574
(check, Check { stage: u32, compiler: Compiler<'a> }),
7675
(check_linkcheck, CheckLinkcheck { stage: u32 }),
77-
(check_cargotest, CheckCargoTest { stage: u32 }),
7876

7977
// Distribution targets, creating tarballs
8078
(dist, Dist { stage: u32 }),
@@ -294,9 +292,6 @@ impl<'a> Step<'a> {
294292
Source::CheckLinkcheck { stage } => {
295293
vec![self.tool_linkchecker(stage), self.doc(stage)]
296294
}
297-
Source::CheckCargoTest { stage } => {
298-
vec![self.tool_cargotest(stage)]
299-
}
300295

301296
Source::ToolLinkchecker { stage } => {
302297
vec![self.libstd(self.compiler(stage))]
@@ -305,9 +300,6 @@ impl<'a> Step<'a> {
305300
Source::ToolRustbook { stage } => {
306301
vec![self.librustc(self.compiler(stage))]
307302
}
308-
Source::ToolCargoTest { stage } => {
309-
vec![self.libstd(self.compiler(stage))]
310-
}
311303

312304
Source::DistDocs { stage } => vec![self.doc(stage)],
313305
Source::DistMingw { _dummy: _ } => Vec::new(),

branches/beta/src/bootstrap/mk/Makefile.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ standalone-docs:
3838
$(Q)$(BOOTSTRAP) --step doc-standalone
3939
check:
4040
$(Q)$(BOOTSTRAP) --step check
41-
cargotest:
42-
$(Q)$(BOOTSTRAP) --step cargotest
4341
dist:
4442
$(Q)$(BOOTSTRAP) --step dist
4543

branches/beta/src/compiletest/errors.rs

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,54 +9,14 @@
99
// except according to those terms.
1010
use self::WhichLine::*;
1111

12-
use std::fmt;
1312
use std::fs::File;
1413
use std::io::BufReader;
1514
use std::io::prelude::*;
1615
use std::path::Path;
17-
use std::str::FromStr;
18-
19-
#[derive(Clone, Debug, PartialEq)]
20-
pub enum ErrorKind {
21-
Help,
22-
Error,
23-
Note,
24-
Suggestion,
25-
Warning,
26-
}
27-
28-
impl FromStr for ErrorKind {
29-
type Err = ();
30-
fn from_str(s: &str) -> Result<Self, Self::Err> {
31-
match &s.trim_right_matches(':') as &str {
32-
"HELP" => Ok(ErrorKind::Help),
33-
"ERROR" => Ok(ErrorKind::Error),
34-
"NOTE" => Ok(ErrorKind::Note),
35-
"SUGGESTION" => Ok(ErrorKind::Suggestion),
36-
"WARN" => Ok(ErrorKind::Warning),
37-
"WARNING" => Ok(ErrorKind::Warning),
38-
_ => Err(()),
39-
}
40-
}
41-
}
42-
43-
impl fmt::Display for ErrorKind {
44-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
45-
match *self {
46-
ErrorKind::Help => write!(f, "help"),
47-
ErrorKind::Error => write!(f, "error"),
48-
ErrorKind::Note => write!(f, "note"),
49-
ErrorKind::Suggestion => write!(f, "suggestion"),
50-
ErrorKind::Warning => write!(f, "warning"),
51-
}
52-
}
53-
}
5416

5517
pub struct ExpectedError {
5618
pub line_num: usize,
57-
/// What kind of message we expect (e.g. warning, error, suggestion).
58-
/// `None` if not specified or unknown message kind.
59-
pub kind: Option<ErrorKind>,
19+
pub kind: String,
6020
pub msg: String,
6121
}
6222

@@ -121,11 +81,11 @@ fn parse_expected(last_nonfollow_error: Option<usize>,
12181
(false, line[start + tag.len()..].chars().take_while(|c| *c == '^').count())
12282
};
12383
let kind_start = start + tag.len() + adjusts + (follow as usize);
124-
let kind = line[kind_start..].split_whitespace()
125-
.next()
126-
.expect("Encountered unexpected empty comment")
127-
.parse::<ErrorKind>()
128-
.ok();
84+
let letters = line[kind_start..].chars();
85+
let kind = letters.skip_while(|c| c.is_whitespace())
86+
.take_while(|c| !c.is_whitespace())
87+
.flat_map(|c| c.to_lowercase())
88+
.collect::<String>();
12989
let letters = line[kind_start..].chars();
13090
let msg = letters.skip_while(|c| c.is_whitespace())
13191
.skip_while(|c| !c.is_whitespace())

branches/beta/src/compiletest/runtest.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use common::Config;
1212
use common::{CompileFail, ParseFail, Pretty, RunFail, RunPass, RunPassValgrind};
1313
use common::{Codegen, DebugInfoLldb, DebugInfoGdb, Rustdoc, CodegenUnits};
14-
use errors::{self, ErrorKind};
14+
use errors;
1515
use header::TestProps;
1616
use header;
1717
use procsrv;
@@ -1033,8 +1033,8 @@ fn check_expected_errors(revision: Option<&str>,
10331033
expected_errors.iter()
10341034
.fold((false, false),
10351035
|(acc_help, acc_note), ee|
1036-
(acc_help || ee.kind == Some(ErrorKind::Help),
1037-
acc_note || ee.kind == Some(ErrorKind::Note)));
1036+
(acc_help || ee.kind == "help:" || ee.kind == "help",
1037+
acc_note || ee.kind == "note:" || ee.kind == "note"));
10381038

10391039
// Scan and extract our error/warning messages,
10401040
// which look like:
@@ -1052,15 +1052,15 @@ fn check_expected_errors(revision: Option<&str>,
10521052
let mut prev = 0;
10531053
for (i, ee) in expected_errors.iter().enumerate() {
10541054
if !found_flags[i] {
1055-
debug!("prefix={} ee.kind={:?} ee.msg={} line={}",
1055+
debug!("prefix={} ee.kind={} ee.msg={} line={}",
10561056
prefixes[i],
10571057
ee.kind,
10581058
ee.msg,
10591059
line);
10601060
// Suggestions have no line number in their output, so take on the line number of
10611061
// the previous expected error
1062-
if ee.kind == Some(ErrorKind::Suggestion) {
1063-
assert!(expected_errors[prev].kind == Some(ErrorKind::Help),
1062+
if ee.kind == "suggestion" {
1063+
assert!(expected_errors[prev].kind == "help",
10641064
"SUGGESTIONs must be preceded by a HELP");
10651065
if line.contains(&ee.msg) {
10661066
found_flags[i] = true;
@@ -1070,7 +1070,7 @@ fn check_expected_errors(revision: Option<&str>,
10701070
}
10711071
if
10721072
(prefix_matches(line, &prefixes[i]) || continuation(line)) &&
1073-
(ee.kind.is_none() || line.contains(&ee.kind.as_ref().unwrap().to_string())) &&
1073+
line.contains(&ee.kind) &&
10741074
line.contains(&ee.msg)
10751075
{
10761076
found_flags[i] = true;
@@ -1096,10 +1096,7 @@ fn check_expected_errors(revision: Option<&str>,
10961096
if !flag {
10971097
let ee = &expected_errors[i];
10981098
error(revision, &format!("expected {} on line {} not found: {}",
1099-
ee.kind.as_ref()
1100-
.map_or("message".into(),
1101-
|k| k.to_string()),
1102-
ee.line_num, ee.msg));
1099+
ee.kind, ee.line_num, ee.msg));
11031100
not_found += 1;
11041101
}
11051102
}

branches/beta/src/doc/book/error-handling.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,16 +2019,6 @@ impl Error for CliError {
20192019
CliError::NotFound => "not found",
20202020
}
20212021
}
2022-
2023-
fn cause(&self) -> Option<&error::Error> {
2024-
match *self {
2025-
CliError::Io(ref err) => Some(err),
2026-
CliError::Parse(ref err) => Some(err),
2027-
// Our custom error doesn't have an underlying cause, but we could
2028-
// modify it so that it does.
2029-
CliError::NotFound() => None,
2030-
}
2031-
}
20322022
}
20332023
```
20342024

branches/beta/src/doc/book/match.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ give us an error:
3636
error: non-exhaustive patterns: `_` not covered
3737
```
3838

39-
Rust is telling us that we forgot some value. The compiler infers from `x` that it
40-
can have any 32bit integer value; for example -2,147,483,648 to 2,147,483,647. The `_` acts
39+
Rust is telling us that we forgot a value. The compiler infers from `x` that it
40+
can have any positive 32bit value; for example 1 to 2,147,483,647. The `_` acts
4141
as a 'catch-all', and will catch all possible values that *aren't* specified in
42-
an arm of `match`. As you can see in the previous example, we provide `match`
42+
an arm of `match`. As you can see with the previous example, we provide `match`
4343
arms for integers 1-5, if `x` is 6 or any other value, then it is caught by `_`.
4444

4545
`match` is also an expression, which means we can use it on the right-hand

branches/beta/src/doc/book/primitive-types.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ of these ones, as well, but these are the most primitive.
77

88
# Booleans
99

10-
Rust has a built-in boolean type, named `bool`. It has two values, `true` and `false`:
10+
Rust has a built in boolean type, named `bool`. It has two values, `true` and `false`:
1111

1212
```rust
1313
let x = true;
@@ -89,13 +89,13 @@ Unsigned types use a `u` for their category, and signed types use `i`. The `i`
8989
is for ‘integer’. So `u8` is an eight-bit unsigned number, and `i8` is an
9090
eight-bit signed number.
9191

92-
## Fixed-size types
92+
## Fixed size types
9393

94-
Fixed-size types have a specific number of bits in their representation. Valid
94+
Fixed size types have a specific number of bits in their representation. Valid
9595
bit sizes are `8`, `16`, `32`, and `64`. So, `u32` is an unsigned, 32-bit integer,
9696
and `i64` is a signed, 64-bit integer.
9797

98-
## Variable-size types
98+
## Variable sized types
9999

100100
Rust also provides types whose size depends on the size of a pointer of the
101101
underlying machine. These types have ‘size’ as the category, and come in signed

branches/beta/src/doc/book/references-and-borrowing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ fn main() {
212212

213213
In other words, the mutable borrow is held through the rest of our example. What
214214
we want is for the mutable borrow by `y` to end so that the resource can be
215-
returned to the owner, `x`. `x` can then provide a immutable borrow to `println!`.
215+
returned to the owner, `x`. `x` can then provide a mutable borrow to `println!`.
216216
In Rust, borrowing is tied to the scope that the borrow is valid for. And our
217217
scopes look like this:
218218

branches/beta/src/doc/reference.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,6 +1905,8 @@ type int8_t = i8;
19051905
- `should_panic` - indicates that this test function should panic, inverting the success condition.
19061906
- `cold` - The function is unlikely to be executed, so optimize it (and calls
19071907
to it) differently.
1908+
- `naked` - The function utilizes a custom ABI or custom inline ASM that requires
1909+
epilogue and prologue to be skipped.
19081910

19091911
### Static-only attributes
19101912

branches/beta/src/libcollections/string.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ use core::iter::FromIterator;
6161
use core::mem;
6262
use core::ops::{self, Add, Index, IndexMut};
6363
use core::ptr;
64+
use core::slice;
6465
use core::str::pattern::Pattern;
6566
use rustc_unicode::char::{decode_utf16, REPLACEMENT_CHARACTER};
6667
use rustc_unicode::str as unicode_str;
@@ -969,7 +970,22 @@ impl String {
969970
pub fn push(&mut self, ch: char) {
970971
match ch.len_utf8() {
971972
1 => self.vec.push(ch as u8),
972-
_ => self.vec.extend_from_slice(ch.encode_utf8().as_slice()),
973+
ch_len => {
974+
let cur_len = self.len();
975+
// This may use up to 4 bytes.
976+
self.vec.reserve(ch_len);
977+
978+
unsafe {
979+
// Attempt to not use an intermediate buffer by just pushing bytes
980+
// directly onto this string.
981+
let slice = slice::from_raw_parts_mut(self.vec
982+
.as_mut_ptr()
983+
.offset(cur_len as isize),
984+
ch_len);
985+
let used = ch.encode_utf8(slice).unwrap_or(0);
986+
self.vec.set_len(cur_len + used);
987+
}
988+
}
973989
}
974990
}
975991

@@ -1120,10 +1136,9 @@ impl String {
11201136
let len = self.len();
11211137
assert!(idx <= len);
11221138
assert!(self.is_char_boundary(idx));
1123-
let bits = ch.encode_utf8();
1124-
let bits = bits.as_slice();
1125-
let amt = bits.len();
1126-
self.vec.reserve(amt);
1139+
self.vec.reserve(4);
1140+
let mut bits = [0; 4];
1141+
let amt = ch.encode_utf8(&mut bits).unwrap();
11271142

11281143
unsafe {
11291144
ptr::copy(self.vec.as_ptr().offset(idx as isize),

branches/beta/src/libcollectionstest/str.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,10 @@ fn test_rev_iterator() {
794794

795795
#[test]
796796
fn test_chars_decoding() {
797+
let mut bytes = [0; 4];
797798
for c in (0..0x110000).filter_map(::std::char::from_u32) {
798-
let bytes = c.encode_utf8();
799-
let s = ::std::str::from_utf8(bytes.as_slice()).unwrap();
799+
let len = c.encode_utf8(&mut bytes).unwrap_or(0);
800+
let s = ::std::str::from_utf8(&bytes[..len]).unwrap();
800801
if Some(c) != s.chars().next() {
801802
panic!("character {:x}={} does not decode correctly", c as u32, c);
802803
}
@@ -805,9 +806,10 @@ fn test_chars_decoding() {
805806

806807
#[test]
807808
fn test_chars_rev_decoding() {
809+
let mut bytes = [0; 4];
808810
for c in (0..0x110000).filter_map(::std::char::from_u32) {
809-
let bytes = c.encode_utf8();
810-
let s = ::std::str::from_utf8(bytes.as_slice()).unwrap();
811+
let len = c.encode_utf8(&mut bytes).unwrap_or(0);
812+
let s = ::std::str::from_utf8(&bytes[..len]).unwrap();
811813
if Some(c) != s.chars().rev().next() {
812814
panic!("character {:x}={} does not decode correctly", c as u32, c);
813815
}

0 commit comments

Comments
 (0)