Skip to content

Commit 6a14792

Browse files
Sander MaijersSander Maijers
Sander Maijers
authored and
Sander Maijers
committed
---
yaml --- r: 277225 b: refs/heads/try c: 2ef88c9 h: refs/heads/master i: 277223: dd61a6a
1 parent eded576 commit 6a14792

File tree

158 files changed

+714
-3089
lines changed

Some content is hidden

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

158 files changed

+714
-3089
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: d3d9bd0e47c8fde0133e0403d584153b4c031043
4+
refs/heads/try: 2ef88c982a307a56dcb01f02697f40ad55f8f916
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ are:
307307
[gsearchdocs]: https://www.google.com/search?q=site:doc.rust-lang.org+your+query+here
308308
[rif]: http://internals.rust-lang.org
309309
[rr]: https://doc.rust-lang.org/book/README.html
310-
[tlgba]: http://tomlee.co/2014/04/a-more-detailed-tour-of-the-rust-compiler/
310+
[tlgba]: http://tomlee.co/2014/04/03/a-more-detailed-tour-of-the-rust-compiler/
311311
[ro]: http://www.rustaceans.org/
312312
[rctd]: ./COMPILER_TESTS.md
313313
[cheatsheet]: http://buildbot.rust-lang.org/homu/

branches/try/RELEASES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ Cargo
140140
Performance
141141
-----------
142142

143-
* [During type unification, the complexity of comparing variables for
144-
equivalance was reduced from `O(n!)` to `O(n)`][1.9tu]. This leads
145-
to major compile-time improvements in some scenarios.
143+
* [The complexity of comparing variables for equivalence during type
144+
unification is reduced from O(n!) to O(n)[1.9tu]. This leads
145+
to major compilation time improvement in some scenarios.
146146
* [`ToString` is specialized for `str`, giving it the same performance
147147
as `to_owned`][1.9ts].
148148
* [Spawning processes with `Command::output` no longer creates extra

branches/try/src/bootstrap/bootstrap.py

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import argparse
1212
import contextlib
13-
import hashlib
1413
import os
1514
import shutil
1615
import subprocess
@@ -19,29 +18,13 @@
1918

2019
def get(url, path, verbose=False):
2120
print("downloading " + url)
22-
sha_url = url + ".sha256"
23-
sha_path = path + ".sha256"
24-
for _url, _path in ((url, path), (sha_url, sha_path)):
25-
# see http://serverfault.com/questions/301128/how-to-download
26-
if sys.platform == 'win32':
27-
run(["PowerShell.exe", "/nologo", "-Command",
28-
"(New-Object System.Net.WebClient)"
29-
".DownloadFile('{}', '{}')".format(_url, _path)],
30-
verbose=verbose)
31-
else:
32-
run(["curl", "-o", _path, _url], verbose=verbose)
33-
print("verifying " + path)
34-
with open(path, "rb") as f:
35-
found = hashlib.sha256(f.read()).hexdigest()
36-
with open(sha_path, "r") as f:
37-
expected, _ = f.readline().split()
38-
if found != expected:
39-
err = ("invalid checksum:\n"
40-
" found: {}\n"
41-
" expected: {}".format(found, expected))
42-
if verbose:
43-
raise RuntimeError(err)
44-
sys.exit(err)
21+
# see http://serverfault.com/questions/301128/how-to-download
22+
if sys.platform == 'win32':
23+
run(["PowerShell.exe", "/nologo", "-Command",
24+
"(New-Object System.Net.WebClient).DownloadFile('" + url +
25+
"', '" + path + "')"], verbose=verbose)
26+
else:
27+
run(["curl", "-o", path, url], verbose=verbose)
4528

4629
def unpack(tarball, dst, verbose=False, match=None):
4730
print("extracting " + tarball)
@@ -74,10 +57,9 @@ def run(args, verbose=False):
7457
ret = subprocess.Popen(args)
7558
code = ret.wait()
7659
if code != 0:
77-
err = "failed to run: " + ' '.join(args)
78-
if verbose:
79-
raise RuntimeError(err)
80-
sys.exit(err)
60+
if not verbose:
61+
print("failed to run: " + ' '.join(args))
62+
raise RuntimeError("failed to run command")
8163

8264
class RustBuild:
8365
def download_rust_nightly(self):
@@ -228,10 +210,7 @@ def build_triple(self):
228210
if sys.platform == 'win32':
229211
return 'x86_64-pc-windows-msvc'
230212
else:
231-
err = "uname not found"
232-
if self.verbose:
233-
raise Exception(err)
234-
sys.exit(err)
213+
raise
235214

236215
# Darwin's `uname -s` lies and always returns i386. We have to use
237216
# sysctl instead.
@@ -274,10 +253,7 @@ def build_triple(self):
274253
cputype = 'x86_64'
275254
ostype = 'pc-windows-gnu'
276255
else:
277-
err = "unknown OS type: " + ostype
278-
if self.verbose:
279-
raise ValueError(err)
280-
sys.exit(err)
256+
raise ValueError("unknown OS type: " + ostype)
281257

282258
if cputype in {'i386', 'i486', 'i686', 'i786', 'x86'}:
283259
cputype = 'i686'
@@ -293,10 +269,7 @@ def build_triple(self):
293269
elif cputype in {'amd64', 'x86_64', 'x86-64', 'x64'}:
294270
cputype = 'x86_64'
295271
else:
296-
err = "unknown cpu type: " + cputype
297-
if self.verbose:
298-
raise ValueError(err)
299-
sys.exit(err)
272+
raise ValueError("unknown cpu type: " + cputype)
300273

301274
return cputype + '-' + ostype
302275

branches/try/src/compiletest/runtest.rs

Lines changed: 17 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,6 @@ fn run_rustdoc_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
19111911
}
19121912

19131913
fn run_codegen_units_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
1914-
19151914
assert!(props.revisions.is_empty(), "revisions not relevant here");
19161915

19171916
let proc_res = compile_test(config, props, testpaths);
@@ -1922,148 +1921,36 @@ fn run_codegen_units_test(config: &Config, props: &TestProps, testpaths: &TestPa
19221921

19231922
check_no_compiler_crash(None, &proc_res);
19241923

1925-
const PREFIX: &'static str = "TRANS_ITEM ";
1926-
const CGU_MARKER: &'static str = "@@";
1924+
let prefix = "TRANS_ITEM ";
19271925

1928-
let actual: Vec<TransItem> = proc_res
1926+
let actual: HashSet<String> = proc_res
19291927
.stdout
19301928
.lines()
1931-
.filter(|line| line.starts_with(PREFIX))
1932-
.map(str_to_trans_item)
1929+
.filter(|line| line.starts_with(prefix))
1930+
.map(|s| (&s[prefix.len()..]).to_string())
19331931
.collect();
19341932

1935-
let expected: Vec<TransItem> = errors::load_errors(&testpaths.file, None)
1933+
let expected: HashSet<String> = errors::load_errors(&testpaths.file, None)
19361934
.iter()
1937-
.map(|e| str_to_trans_item(&e.msg[..]))
1935+
.map(|e| e.msg.trim().to_string())
19381936
.collect();
19391937

1940-
let mut missing = Vec::new();
1941-
let mut wrong_cgus = Vec::new();
1942-
1943-
for expected_item in &expected {
1944-
let actual_item_with_same_name = actual.iter()
1945-
.find(|ti| ti.name == expected_item.name);
1946-
1947-
if let Some(actual_item) = actual_item_with_same_name {
1948-
if !expected_item.codegen_units.is_empty() {
1949-
// Also check for codegen units
1950-
if expected_item.codegen_units != actual_item.codegen_units {
1951-
wrong_cgus.push((expected_item.clone(), actual_item.clone()));
1952-
}
1953-
}
1954-
} else {
1955-
missing.push(expected_item.string.clone());
1956-
}
1957-
}
1958-
1959-
let unexpected: Vec<_> =
1960-
actual.iter()
1961-
.filter(|acgu| !expected.iter().any(|ecgu| acgu.name == ecgu.name))
1962-
.map(|acgu| acgu.string.clone())
1963-
.collect();
1964-
1965-
if !missing.is_empty() {
1938+
if actual != expected {
1939+
let mut missing: Vec<_> = expected.difference(&actual).collect();
19661940
missing.sort();
19671941

1968-
println!("\nThese items should have been contained but were not:\n");
1969-
1970-
for item in &missing {
1971-
println!("{}", item);
1972-
}
1942+
let mut too_much: Vec<_> = actual.difference(&expected).collect();
1943+
too_much.sort();
19731944

1974-
println!("\n");
1975-
}
1976-
1977-
if !unexpected.is_empty() {
1978-
let sorted = {
1979-
let mut sorted = unexpected.clone();
1980-
sorted.sort();
1981-
sorted
1982-
};
1983-
1984-
println!("\nThese items were contained but should not have been:\n");
1985-
1986-
for item in sorted {
1987-
println!("{}", item);
1988-
}
1989-
1990-
println!("\n");
1991-
}
1992-
1993-
if !wrong_cgus.is_empty() {
1994-
wrong_cgus.sort_by_key(|pair| pair.0.name.clone());
1995-
println!("\nThe following items were assigned to wrong codegen units:\n");
1996-
1997-
for &(ref expected_item, ref actual_item) in &wrong_cgus {
1998-
println!("{}", expected_item.name);
1999-
println!(" expected: {}", codegen_units_to_str(&expected_item.codegen_units));
2000-
println!(" actual: {}", codegen_units_to_str(&actual_item.codegen_units));
2001-
println!("");
2002-
}
2003-
}
2004-
2005-
if !(missing.is_empty() && unexpected.is_empty() && wrong_cgus.is_empty())
2006-
{
1945+
println!("Expected and actual sets of codegen-items differ.\n\
1946+
These items should have been contained but were not:\n\n\
1947+
{}\n\n\
1948+
These items were contained but should not have been:\n\n\
1949+
{}\n\n",
1950+
missing.iter().fold("".to_string(), |s1, s2| s1 + "\n" + s2),
1951+
too_much.iter().fold("".to_string(), |s1, s2| s1 + "\n" + s2));
20071952
panic!();
20081953
}
2009-
2010-
#[derive(Clone, Eq, PartialEq)]
2011-
struct TransItem {
2012-
name: String,
2013-
codegen_units: HashSet<String>,
2014-
string: String,
2015-
}
2016-
2017-
// [TRANS_ITEM] name [@@ (cgu)+]
2018-
fn str_to_trans_item(s: &str) -> TransItem {
2019-
let s = if s.starts_with(PREFIX) {
2020-
(&s[PREFIX.len()..]).trim()
2021-
} else {
2022-
s.trim()
2023-
};
2024-
2025-
let full_string = format!("{}{}", PREFIX, s.trim().to_owned());
2026-
2027-
let parts: Vec<&str> = s.split(CGU_MARKER)
2028-
.map(str::trim)
2029-
.filter(|s| !s.is_empty())
2030-
.collect();
2031-
2032-
let name = parts[0].trim();
2033-
2034-
let cgus = if parts.len() > 1 {
2035-
let cgus_str = parts[1];
2036-
2037-
cgus_str.split(" ")
2038-
.map(str::trim)
2039-
.filter(|s| !s.is_empty())
2040-
.map(str::to_owned)
2041-
.collect()
2042-
}
2043-
else {
2044-
HashSet::new()
2045-
};
2046-
2047-
TransItem {
2048-
name: name.to_owned(),
2049-
codegen_units: cgus,
2050-
string: full_string,
2051-
}
2052-
}
2053-
2054-
fn codegen_units_to_str(cgus: &HashSet<String>) -> String
2055-
{
2056-
let mut cgus: Vec<_> = cgus.iter().collect();
2057-
cgus.sort();
2058-
2059-
let mut string = String::new();
2060-
for cgu in cgus {
2061-
string.push_str(&cgu[..]);
2062-
string.push_str(" ");
2063-
}
2064-
2065-
string
2066-
}
20671954
}
20681955

20691956
fn run_incremental_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {

branches/try/src/doc/book/casting-between-types.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,10 @@ Rust lets us:
165165
```rust
166166
use std::mem;
167167

168-
fn main() {
169-
unsafe {
170-
let a = [0u8, 1u8, 0u8, 0u8];
171-
let b = mem::transmute::<[u8; 4], u32>(a);
172-
println!("{}", b); // 256
173-
// or, more concisely:
174-
let c: u32 = mem::transmute(a);
175-
println!("{}", c); // 256
176-
}
168+
unsafe {
169+
let a = [0u8, 0u8, 0u8, 0u8];
170+
171+
let b = mem::transmute::<[u8; 4], u32>(a);
177172
}
178173
```
179174

branches/try/src/doc/book/closures.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,12 @@ fn factory() -> Box<Fn(i32) -> i32> {
492492

493493
Box::new(move |x| x + num)
494494
}
495-
fn main() {
495+
# fn main() {
496496
let f = factory();
497497

498498
let answer = f(1);
499499
assert_eq!(6, answer);
500-
}
500+
# }
501501
```
502502

503503
By making the inner closure a `move Fn`, we create a new stack frame for our

branches/try/src/doc/book/getting-started.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,12 +575,8 @@ look something like this:
575575
name = "hello_world"
576576
version = "0.1.0"
577577
authors = ["Your Name <you@example.com>"]
578-
579-
[dependencies]
580578
```
581579

582-
Do not worry about the `[dependencies]` line, we will come back to it later.
583-
584580
Cargo has populated *Cargo.toml* with reasonable defaults based on the arguments
585581
you gave it and your `git` global configuration. You may notice that Cargo has
586582
also initialized the `hello_world` directory as a `git` repository.

branches/try/src/doc/book/mutability.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,18 @@ changed from one `i32` to another.
2424

2525
[vb]: variable-bindings.html
2626

27-
You can also create a [reference][ref] to it, using `&x`, but if you want to use the reference to change it, you will need a mutable reference:
27+
If you want to change what the binding points to, you’ll need a [mutable reference][mr]:
2828

2929
```rust
3030
let mut x = 5;
3131
let y = &mut x;
3232
```
3333

34-
[ref]: references-and-borrowing.html
34+
[mr]: references-and-borrowing.html
3535

36-
`y` is an immutable binding to a mutable reference, which means that you can’t bind 'y' to something else (`y = &mut z`), but `y` can be used to bind `x` to something else (`*y = 5`). A subtle distinction.
36+
`y` is an immutable binding to a mutable reference, which means that you can’t
37+
bind `y` to something else (`y = &mut z`), but you can mutate the thing that’s
38+
bound to `y` (`*y = 5`). A subtle distinction.
3739

3840
Of course, if you need both:
3941

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@ and `i64` is a signed, 64-bit integer.
9797

9898
## Variable-size types
9999

100-
Rust also provides types whose particular size depends on the underlying machine
101-
architecture. Their range is sufficient to express the size of any collection, so
102-
these types have ‘size’ as the category. They come in signed and unsigned varieties
103-
which account for two types: `isize` and `usize`.
100+
Rust also provides types whose size depends on the size of a pointer of the
101+
underlying machine. These types have ‘size’ as the category, and come in signed
102+
and unsigned varieties. This makes for two types: `isize` and `usize`.
104103

105104
## Floating-point types
106105

branches/try/src/liballoc_system/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,8 @@ mod imp {
9696
libc::realloc(ptr as *mut libc::c_void, size as libc::size_t) as *mut u8
9797
} else {
9898
let new_ptr = allocate(size, align);
99-
if !new_ptr.is_null() {
100-
ptr::copy(ptr, new_ptr, cmp::min(size, old_size));
101-
deallocate(ptr, old_size, align);
102-
}
99+
ptr::copy(ptr, new_ptr, cmp::min(size, old_size));
100+
deallocate(ptr, old_size, align);
103101
new_ptr
104102
}
105103
}

0 commit comments

Comments
 (0)