Skip to content

Commit 961e716

Browse files
committed
---
yaml --- r: 277183 b: refs/heads/try c: f207ddb h: refs/heads/master i: 277181: 9629f33 277179: 89aa932 277175: f2c49a5 277167: 7eab26a 277151: 59ad179 277119: 7eaf35e
1 parent 0d6271d commit 961e716

File tree

142 files changed

+2552
-558
lines changed

Some content is hidden

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

142 files changed

+2552
-558
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: 9da67dae52e18a078d071acbcad592a5f02a8392
4+
refs/heads/try: f207ddb9bf22b5832e660183aee74c6356edee1c
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/bootstrap/bootstrap.py

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

1111
import argparse
1212
import contextlib
13+
import hashlib
1314
import os
1415
import shutil
1516
import subprocess
@@ -18,13 +19,29 @@
1819

1920
def get(url, path, verbose=False):
2021
print("downloading " + url)
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)
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)
2845

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

6482
class RustBuild:
6583
def download_rust_nightly(self):
@@ -210,7 +228,10 @@ def build_triple(self):
210228
if sys.platform == 'win32':
211229
return 'x86_64-pc-windows-msvc'
212230
else:
213-
raise
231+
err = "uname not found"
232+
if self.verbose:
233+
raise Exception(err)
234+
sys.exit(err)
214235

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

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

274301
return cputype + '-' + ostype
275302

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use std::fs;
12+
1113
use build::{Build, Compiler};
1214

1315
pub fn linkcheck(build: &Build, stage: u32, host: &str) {
@@ -29,9 +31,16 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) {
2931
let sep = if cfg!(windows) { ";" } else {":" };
3032
let ref newpath = format!("{}{}{}", path.display(), sep, old_path);
3133

34+
// Note that this is a short, cryptic, and not scoped directory name. This
35+
// is currently to minimize the length of path on Windows where we otherwise
36+
// quickly run into path name limit constraints.
37+
let out_dir = build.out.join("ct");
38+
t!(fs::create_dir_all(&out_dir));
39+
3240
build.run(build.tool_cmd(compiler, "cargotest")
33-
.env("PATH", newpath)
34-
.arg(&build.cargo));
41+
.env("PATH", newpath)
42+
.arg(&build.cargo)
43+
.arg(&out_dir));
3544
}
3645

3746
pub fn tidy(build: &Build, stage: u32, host: &str) {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ impl<'a> Step<'a> {
318318
vec![self.tool_linkchecker(stage), self.doc(stage)]
319319
}
320320
Source::CheckCargoTest { stage } => {
321-
vec![self.tool_cargotest(stage)]
321+
vec![self.tool_cargotest(stage),
322+
self.librustc(self.compiler(stage))]
322323
}
323324
Source::CheckTidy { stage } => {
324325
vec![self.tool_tidy(stage)]
@@ -333,7 +334,7 @@ impl<'a> Step<'a> {
333334
vec![self.librustc(self.compiler(stage))]
334335
}
335336
Source::ToolCargoTest { stage } => {
336-
vec![self.librustc(self.compiler(stage))]
337+
vec![self.libstd(self.compiler(stage))]
337338
}
338339

339340
Source::DistDocs { stage } => vec![self.doc(stage)],

branches/try/src/compiletest/runtest.rs

Lines changed: 130 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,6 +1911,7 @@ 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+
19141915
assert!(props.revisions.is_empty(), "revisions not relevant here");
19151916

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

19221923
check_no_compiler_crash(None, &proc_res);
19231924

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

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

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

1938-
if actual != expected {
1939-
let mut missing: Vec<_> = expected.difference(&actual).collect();
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() {
19401966
missing.sort();
19411967

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

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));
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+
{
19522007
panic!();
19532008
}
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+
}
19542067
}
19552068

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

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

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

branches/try/src/liballoc_system/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ 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-
ptr::copy(ptr, new_ptr, cmp::min(size, old_size));
100-
deallocate(ptr, old_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+
}
101103
new_ptr
102104
}
103105
}

0 commit comments

Comments
 (0)