Skip to content

Commit 317fba9

Browse files
committed
---
yaml --- r: 277029 b: refs/heads/try c: a563711 h: refs/heads/master i: 277027: 128fa9e
1 parent a5aac52 commit 317fba9

File tree

103 files changed

+1151
-1447
lines changed

Some content is hidden

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

103 files changed

+1151
-1447
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: a43eb4e774f6d51b7012bba3d25212819ab0e3dc
4+
refs/heads/try: a563711b6a13eb93ac59d4de29e079281f4866f3
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/mk/tests.mk

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,52 @@ cleantestlibs:
240240
# Tidy
241241
######################################################################
242242

243+
ifdef CFG_NOTIDY
243244
.PHONY: tidy
244-
tidy: $(HBIN0_H_$(CFG_BUILD))/tidy$(X_$(CFG_BUILD))
245-
$(TARGET_RPATH_VAR0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $< $(S)src
246-
247-
$(HBIN0_H_$(CFG_BUILD))/tidy$(X_$(CFG_BUILD)): \
248-
$(TSREQ0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
249-
$(TLIB0_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.std \
250-
$(call rwildcard,$(S)src/tools/tidy/src,*.rs)
251-
$(STAGE0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(S)src/tools/tidy/src/main.rs \
252-
--out-dir $(@D) --crate-name tidy
245+
tidy:
246+
else
247+
248+
# Run the tidy script in multiple parts to avoid huge 'echo' commands
249+
.PHONY: tidy
250+
tidy: tidy-basic tidy-binaries tidy-errors tidy-features
251+
252+
endif
253+
254+
.PHONY: tidy-basic
255+
tidy-basic:
256+
@$(call E, check: formatting)
257+
$(Q) $(CFG_PYTHON) $(S)src/etc/tidy.py $(S)src/
258+
259+
.PHONY: tidy-binaries
260+
tidy-binaries:
261+
@$(call E, check: binaries)
262+
$(Q)find $(S)src -type f \
263+
\( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
264+
-not -name '*.rs' -and -not -name '*.py' \
265+
-and -not -name '*.sh' -and -not -name '*.pp' \
266+
| grep '^$(S)src/jemalloc' -v \
267+
| grep '^$(S)src/libuv' -v \
268+
| grep '^$(S)src/llvm' -v \
269+
| grep '^$(S)src/rt/hoedown' -v \
270+
| grep '^$(S)src/gyp' -v \
271+
| grep '^$(S)src/etc' -v \
272+
| grep '^$(S)src/doc' -v \
273+
| grep '^$(S)src/compiler-rt' -v \
274+
| grep '^$(S)src/libbacktrace' -v \
275+
| grep '^$(S)src/rust-installer' -v \
276+
| grep '^$(S)src/liblibc' -v \
277+
| xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py
278+
279+
.PHONY: tidy-errors
280+
tidy-errors:
281+
@$(call E, check: extended errors)
282+
$(Q) $(CFG_PYTHON) $(S)src/etc/errorck.py $(S)src/
283+
284+
.PHONY: tidy-features
285+
tidy-features:
286+
@$(call E, check: feature sanity)
287+
$(Q) $(CFG_PYTHON) $(S)src/etc/featureck.py $(S)src/
288+
253289

254290
######################################################################
255291
# Sets of tests

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,3 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) {
3333
.env("PATH", newpath)
3434
.arg(&build.cargo));
3535
}
36-
37-
pub fn tidy(build: &Build, stage: u32, host: &str) {
38-
println!("tidy check stage{} ({})", stage, host);
39-
let compiler = Compiler::new(stage, host);
40-
build.run(build.tool_cmd(&compiler, "tidy")
41-
.arg(build.src.join("src")));
42-
}

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,6 @@ impl Build {
197197
ToolCargoTest { stage } => {
198198
compile::tool(self, stage, target.target, "cargotest");
199199
}
200-
ToolTidy { stage } => {
201-
compile::tool(self, stage, target.target, "tidy");
202-
}
203200
DocBook { stage } => {
204201
doc::rustbook(self, stage, target.target, "book", &doc_out);
205202
}
@@ -233,9 +230,6 @@ impl Build {
233230
CheckCargoTest { stage } => {
234231
check::cargotest(self, stage, target.target);
235232
}
236-
CheckTidy { stage } => {
237-
check::tidy(self, stage, target.target);
238-
}
239233

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

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ macro_rules! targets {
5151
(tool_rustbook, ToolRustbook { stage: u32 }),
5252
(tool_error_index, ToolErrorIndex { stage: u32 }),
5353
(tool_cargotest, ToolCargoTest { stage: u32 }),
54-
(tool_tidy, ToolTidy { stage: u32 }),
5554

5655
// Steps for long-running native builds. Ideally these wouldn't
5756
// actually exist and would be part of build scripts, but for now
@@ -80,7 +79,6 @@ macro_rules! targets {
8079
(check, Check { stage: u32, compiler: Compiler<'a> }),
8180
(check_linkcheck, CheckLinkcheck { stage: u32 }),
8281
(check_cargotest, CheckCargoTest { stage: u32 }),
83-
(check_tidy, CheckTidy { stage: u32 }),
8482

8583
// Distribution targets, creating tarballs
8684
(dist, Dist { stage: u32 }),
@@ -318,12 +316,8 @@ impl<'a> Step<'a> {
318316
Source::CheckCargoTest { stage } => {
319317
vec![self.tool_cargotest(stage)]
320318
}
321-
Source::CheckTidy { stage } => {
322-
vec![self.tool_tidy(stage)]
323-
}
324319

325-
Source::ToolLinkchecker { stage } |
326-
Source::ToolTidy { stage } => {
320+
Source::ToolLinkchecker { stage } => {
327321
vec![self.libstd(self.compiler(stage))]
328322
}
329323
Source::ToolErrorIndex { stage } |

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,5 @@ check-cargotest:
4242
$(Q)$(BOOTSTRAP) --step check-cargotest
4343
dist:
4444
$(Q)$(BOOTSTRAP) --step dist
45-
tidy:
46-
$(Q)$(BOOTSTRAP) --step check-tidy --stage 0
4745

4846
.PHONY: dist

branches/try/src/compiletest/compiletest.rs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#![feature(box_syntax)]
1414
#![feature(libc)]
1515
#![feature(rustc_private)]
16+
#![feature(str_char)]
1617
#![feature(test)]
1718
#![feature(question_mark)]
1819

@@ -411,26 +412,16 @@ fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
411412

412413
// used to be a regex "(^|[^0-9])([0-9]\.[0-9]+)"
413414
for (pos, c) in full_version_line.char_indices() {
414-
if !c.is_digit(10) {
415-
continue
416-
}
417-
if pos + 2 >= full_version_line.len() {
418-
continue
419-
}
420-
if full_version_line[pos + 1..].chars().next().unwrap() != '.' {
421-
continue
422-
}
423-
if !full_version_line[pos + 2..].chars().next().unwrap().is_digit(10) {
424-
continue
425-
}
426-
if pos > 0 && full_version_line[..pos].chars().next_back()
427-
.unwrap().is_digit(10) {
415+
if !c.is_digit(10) { continue }
416+
if pos + 2 >= full_version_line.len() { continue }
417+
if full_version_line.char_at(pos + 1) != '.' { continue }
418+
if !full_version_line.char_at(pos + 2).is_digit(10) { continue }
419+
if pos > 0 && full_version_line.char_at_reverse(pos).is_digit(10) {
428420
continue
429421
}
430422
let mut end = pos + 3;
431423
while end < full_version_line.len() &&
432-
full_version_line[end..].chars().next()
433-
.unwrap().is_digit(10) {
424+
full_version_line.char_at(end).is_digit(10) {
434425
end += 1;
435426
}
436427
return Some(full_version_line[pos..end].to_owned());
@@ -462,13 +453,13 @@ fn extract_lldb_version(full_version_line: Option<String>) -> Option<String> {
462453
for (pos, l) in full_version_line.char_indices() {
463454
if l != 'l' && l != 'L' { continue }
464455
if pos + 5 >= full_version_line.len() { continue }
465-
let l = full_version_line[pos + 1..].chars().next().unwrap();
456+
let l = full_version_line.char_at(pos + 1);
466457
if l != 'l' && l != 'L' { continue }
467-
let d = full_version_line[pos + 2..].chars().next().unwrap();
458+
let d = full_version_line.char_at(pos + 2);
468459
if d != 'd' && d != 'D' { continue }
469-
let b = full_version_line[pos + 3..].chars().next().unwrap();
460+
let b = full_version_line.char_at(pos + 3);
470461
if b != 'b' && b != 'B' { continue }
471-
let dash = full_version_line[pos + 4..].chars().next().unwrap();
462+
let dash = full_version_line.char_at(pos + 4);
472463
if dash != '-' { continue }
473464

474465
let vers = full_version_line[pos + 5..].chars().take_while(|c| {

branches/try/src/compiletest/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ fn parse_expected(last_nonfollow_error: Option<usize>,
115115
tag: &str)
116116
-> Option<(WhichLine, ExpectedError)> {
117117
let start = match line.find(tag) { Some(i) => i, None => return None };
118-
let (follow, adjusts) = if line[start + tag.len()..].chars().next().unwrap() == '|' {
118+
let (follow, adjusts) = if line.char_at(start + tag.len()) == '|' {
119119
(true, 0)
120120
} else {
121121
(false, line[start + tag.len()..].chars().take_while(|c| *c == '^').count())

branches/try/src/compiletest/runtest.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ fn scan_char(haystack: &str, needle: char, idx: &mut usize) -> bool {
11771177
if *idx >= haystack.len() {
11781178
return false;
11791179
}
1180-
let ch = haystack[*idx..].chars().next().unwrap();
1180+
let ch = haystack.char_at(*idx);
11811181
if ch != needle {
11821182
return false;
11831183
}
@@ -1188,7 +1188,7 @@ fn scan_char(haystack: &str, needle: char, idx: &mut usize) -> bool {
11881188
fn scan_integer(haystack: &str, idx: &mut usize) -> bool {
11891189
let mut i = *idx;
11901190
while i < haystack.len() {
1191-
let ch = haystack[i..].chars().next().unwrap();
1191+
let ch = haystack.char_at(i);
11921192
if ch < '0' || '9' < ch {
11931193
break;
11941194
}
@@ -1208,7 +1208,7 @@ fn scan_string(haystack: &str, needle: &str, idx: &mut usize) -> bool {
12081208
if haystack_i >= haystack.len() {
12091209
return false;
12101210
}
1211-
let ch = haystack[haystack_i..].chars().next().unwrap();
1211+
let ch = haystack.char_at(haystack_i);
12121212
haystack_i += ch.len_utf8();
12131213
if !scan_char(needle, ch, &mut needle_i) {
12141214
return false;

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ The same [ownership system](ownership.html) that helps prevent using pointers
162162
incorrectly also helps rule out data races, one of the worst kinds of
163163
concurrency bugs.
164164

165-
As an example, here is a Rust program that would have a data race in many
165+
As an example, here is a Rust program that could have a data race in many
166166
languages. It will not compile:
167167

168168
```ignore
@@ -174,7 +174,7 @@ fn main() {
174174
175175
for i in 0..3 {
176176
thread::spawn(move || {
177-
data[0] += i;
177+
data[i] += 1;
178178
});
179179
}
180180
@@ -186,7 +186,7 @@ This gives us an error:
186186

187187
```text
188188
8:17 error: capture of moved value: `data`
189-
data[0] += i;
189+
data[i] += 1;
190190
^~~~
191191
```
192192

@@ -195,6 +195,11 @@ thread, and the thread takes ownership of the reference, we'd have three owners!
195195
`data` gets moved out of `main` in the first call to `spawn()`, so subsequent
196196
calls in the loop cannot use this variable.
197197

198+
Note that this specific example will not cause a data race since different array
199+
indices are being accessed. But this can't be determined at compile time, and in
200+
a similar situation where `i` is a constant or is random, you would have a data
201+
race.
202+
198203
So, we need some type that lets us have more than one owning reference to a
199204
value. Usually, we'd use `Rc<T>` for this, which is a reference counted type
200205
that provides shared ownership. It has some runtime bookkeeping that keeps track
@@ -218,7 +223,7 @@ fn main() {
218223
219224
// use it in a thread
220225
thread::spawn(move || {
221-
data_ref[0] += i;
226+
data_ref[i] += 1;
222227
});
223228
}
224229
@@ -261,7 +266,7 @@ fn main() {
261266
for i in 0..3 {
262267
let data = data.clone();
263268
thread::spawn(move || {
264-
data[0] += i;
269+
data[i] += 1;
265270
});
266271
}
267272
@@ -276,7 +281,7 @@ And... still gives us an error.
276281

277282
```text
278283
<anon>:11:24 error: cannot borrow immutable borrowed content as mutable
279-
<anon>:11 data[0] += i;
284+
<anon>:11 data[i] += 1;
280285
^~~~
281286
```
282287

@@ -312,7 +317,7 @@ fn main() {
312317
let data = data.clone();
313318
thread::spawn(move || {
314319
let mut data = data.lock().unwrap();
315-
data[0] += i;
320+
data[i] += 1;
316321
});
317322
}
318323

@@ -355,7 +360,7 @@ Let's examine the body of the thread more closely:
355360
# let data = data.clone();
356361
thread::spawn(move || {
357362
let mut data = data.lock().unwrap();
358-
data[0] += i;
363+
data[i] += 1;
359364
});
360365
# }
361366
# thread::sleep(Duration::from_millis(50));
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
4+
# file at the top-level directory of this distribution and at
5+
# http://rust-lang.org/COPYRIGHT.
6+
#
7+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10+
# option. This file may not be copied, modified, or distributed
11+
# except according to those terms.
12+
13+
import sys
14+
15+
offenders = sys.argv[1:]
16+
if len(offenders) > 0:
17+
print("Binaries checked into src:")
18+
for offender in offenders:
19+
print(offender)
20+
sys.exit(1)

0 commit comments

Comments
 (0)