Skip to content

Commit 63fcbcf

Browse files
committed
Merge remote-tracking branch 'rust-lang/master'
Conflicts: mk/tests.mk src/liballoc/arc.rs src/liballoc/boxed.rs src/liballoc/rc.rs src/libcollections/bit.rs src/libcollections/btree/map.rs src/libcollections/btree/set.rs src/libcollections/dlist.rs src/libcollections/ring_buf.rs src/libcollections/slice.rs src/libcollections/str.rs src/libcollections/string.rs src/libcollections/vec.rs src/libcollections/vec_map.rs src/libcore/any.rs src/libcore/array.rs src/libcore/borrow.rs src/libcore/error.rs src/libcore/fmt/mod.rs src/libcore/iter.rs src/libcore/marker.rs src/libcore/ops.rs src/libcore/result.rs src/libcore/slice.rs src/libcore/str/mod.rs src/libregex/lib.rs src/libregex/re.rs src/librustc/lint/builtin.rs src/libstd/collections/hash/map.rs src/libstd/collections/hash/set.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/mutex.rs src/libstd/sync/poison.rs src/libstd/sync/rwlock.rs src/libsyntax/feature_gate.rs src/libsyntax/test.rs
2 parents b44ee37 + 0430a43 commit 63fcbcf

File tree

433 files changed

+7352
-12015
lines changed

Some content is hidden

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

433 files changed

+7352
-12015
lines changed

configure

-1
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,6 @@ opt optimize-tests 1 "build tests with optimizations"
509509
opt libcpp 1 "build with llvm with libc++ instead of libstdc++ when using clang"
510510
opt llvm-assertions 1 "build LLVM with assertions"
511511
opt debug 1 "build with extra debug fun"
512-
opt ratchet-bench 0 "ratchet benchmarks"
513512
opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
514513
opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
515514
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"

mk/cfg/aarch64-linux-android.mk

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# aarch64-linux-android configuration
2+
# CROSS_PREFIX_aarch64-linux-android-
3+
CC_aarch64-linux-android=$(CFG_ANDROID_CROSS_PATH)/bin/aarch64-linux-android-gcc
4+
CXX_aarch64-linux-android=$(CFG_ANDROID_CROSS_PATH)/bin/aarch64-linux-android-g++
5+
CPP_aarch64-linux-android=$(CFG_ANDROID_CROSS_PATH)/bin/aarch64-linux-android-gcc -E
6+
AR_aarch64-linux-android=$(CFG_ANDROID_CROSS_PATH)/bin/aarch64-linux-android-ar
7+
CFG_LIB_NAME_aarch64-linux-android=lib$(1).so
8+
CFG_STATIC_LIB_NAME_aarch64-linux-android=lib$(1).a
9+
CFG_LIB_GLOB_aarch64-linux-android=lib$(1)-*.so
10+
CFG_LIB_DSYM_GLOB_aarch64-linux-android=lib$(1)-*.dylib.dSYM
11+
CFG_JEMALLOC_CFLAGS_aarch64-linux-android := -D__aarch64__ -DANDROID -D__ANDROID__ $(CFLAGS)
12+
CFG_GCCISH_CFLAGS_aarch64-linux-android := -Wall -g -fPIC -D__aarch64__ -DANDROID -D__ANDROID__ $(CFLAGS)
13+
CFG_GCCISH_CXXFLAGS_aarch64-linux-android := -fno-rtti $(CXXFLAGS)
14+
CFG_GCCISH_LINK_FLAGS_aarch64-linux-android := -shared -fPIC -ldl -g -lm -lsupc++
15+
CFG_GCCISH_DEF_FLAG_aarch64-linux-android := -Wl,--export-dynamic,--dynamic-list=
16+
CFG_GCCISH_PRE_LIB_FLAGS_aarch64-linux-android := -Wl,-whole-archive
17+
CFG_GCCISH_POST_LIB_FLAGS_aarch64-linux-android := -Wl,-no-whole-archive
18+
CFG_DEF_SUFFIX_aarch64-linux-android := .android.def
19+
CFG_LLC_FLAGS_aarch64-linux-android :=
20+
CFG_INSTALL_NAME_aarch64-linux-android =
21+
CFG_EXE_SUFFIX_aarch64-linux-android :=
22+
CFG_WINDOWSY_aarch64-linux-android :=
23+
CFG_UNIXY_aarch64-linux-android := 1
24+
CFG_PATH_MUNGE_aarch64-linux-android := true
25+
CFG_LDPATH_aarch64-linux-android :=
26+
CFG_RUN_aarch64-linux-android=
27+
CFG_RUN_TARG_aarch64-linux-android=
28+
RUSTC_FLAGS_aarch64-linux-android :=
29+
RUSTC_CROSS_FLAGS_aarch64-linux-android :=
30+
CFG_GNU_TRIPLE_aarch64-linux-android := aarch64-linux-android

mk/crates.mk

+5-7
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
TARGET_CRATES := libc std flate arena term \
5353
serialize getopts collections test rand \
54-
log regex graphviz core rbml alloc \
54+
log graphviz core rbml alloc \
5555
unicode rustc_bitflags
5656
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \
5757
rustc_trans rustc_back rustc_llvm rustc_privacy
@@ -95,16 +95,15 @@ DEPS_term := std log
9595
DEPS_getopts := std
9696
DEPS_collections := core alloc unicode
9797
DEPS_num := std
98-
DEPS_test := std getopts serialize rbml term regex native:rust_test_helpers
98+
DEPS_test := std getopts serialize rbml term native:rust_test_helpers
9999
DEPS_rand := core
100-
DEPS_log := std regex
101-
DEPS_regex := std
100+
DEPS_log := std
102101
DEPS_fmt_macros = std
103102

104103
TOOL_DEPS_compiletest := test getopts
105104
TOOL_DEPS_rustdoc := rustdoc
106105
TOOL_DEPS_rustc := rustc_driver
107-
TOOL_DEPS_rustbook := std regex rustdoc
106+
TOOL_DEPS_rustbook := std rustdoc
108107
TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs
109108
TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs
110109
TOOL_SOURCE_rustc := $(S)src/driver/driver.rs
@@ -130,9 +129,8 @@ DOC_CRATES := $(filter-out rustc, \
130129
$(filter-out rustc_driver, \
131130
$(filter-out rustc_privacy, \
132131
$(filter-out log, \
133-
$(filter-out regex, \
134132
$(filter-out getopts, \
135-
$(filter-out syntax, $(CRATES))))))))))))
133+
$(filter-out syntax, $(CRATES)))))))))))
136134
COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_resolve \
137135
rustc_typeck rustc_driver syntax rustc_privacy
138136

mk/rt.mk

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ else ifeq ($(OSTYPE_$(1)), apple-ios)
141141
JEMALLOC_ARGS_$(1) := --disable-tls
142142
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
143143
JEMALLOC_ARGS_$(1) := --disable-tls
144+
else ifeq ($(OSTYPE_$(1)), linux-android)
145+
JEMALLOC_ARGS_$(1) := --disable-tls
144146
endif
145147

146148
################################################################################

mk/tests.mk

+2-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ tidy:
300300
| grep '^$(S)src/libbacktrace' -v \
301301
| grep '^$(S)src/rust-installer' -v \
302302
| xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py
303-
$(Q)$(CFG_PYTHON) $(S)src/etc/featureck.py $(S)src/
303+
$(Q) $(CFG_PYTHON) $(S)src/etc/errorck.py $(S)src/
304+
$(Q) $(CFG_PYTHON) $(S)src/etc/featureck.py $(S)src/
304305

305306

306307
endif

src/compiletest/common.rs

+4-28
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ pub use self::Mode::*;
1111

1212
use std::fmt;
1313
use std::str::FromStr;
14-
use regex::Regex;
1514

16-
#[derive(Clone, PartialEq)]
15+
#[derive(Clone, PartialEq, Debug)]
1716
pub enum Mode {
1817
CompileFail,
1918
RunFail,
@@ -43,9 +42,9 @@ impl FromStr for Mode {
4342
}
4443
}
4544

46-
impl fmt::String for Mode {
45+
impl fmt::Display for Mode {
4746
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
48-
fmt::String::fmt(match *self {
47+
fmt::Display::fmt(match *self {
4948
CompileFail => "compile-fail",
5049
RunFail => "run-fail",
5150
RunPass => "run-pass",
@@ -58,12 +57,6 @@ impl fmt::String for Mode {
5857
}
5958
}
6059

61-
impl fmt::Show for Mode {
62-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
63-
fmt::String::fmt(self, f)
64-
}
65-
}
66-
6760
#[derive(Clone)]
6861
pub struct Config {
6962
// The library paths required for running the compiler
@@ -107,28 +100,11 @@ pub struct Config {
107100
pub run_ignored: bool,
108101

109102
// Only run tests that match this filter
110-
pub filter: Option<Regex>,
111-
112-
// Precompiled regex for finding expected errors in cfail
113-
pub cfail_regex: Regex,
103+
pub filter: Option<String>,
114104

115105
// Write out a parseable log of tests that were run
116106
pub logfile: Option<Path>,
117107

118-
// Write out a json file containing any metrics of the run
119-
pub save_metrics: Option<Path>,
120-
121-
// Write and ratchet a metrics file
122-
pub ratchet_metrics: Option<Path>,
123-
124-
// Percent change in metrics to consider noise
125-
pub ratchet_noise_percent: Option<f64>,
126-
127-
// "Shard" of the testsuite to pub run: this has the form of
128-
// two numbers (a,b), and causes only those tests with
129-
// positional order equal to a mod b to run.
130-
pub test_shard: Option<(uint,uint)>,
131-
132108
// A command line to prefix program execution with,
133109
// for running under valgrind
134110
pub runtool: Option<String>,

src/compiletest/compiletest.rs

+47-54
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313
#![feature(slicing_syntax, unboxed_closures)]
1414
#![feature(box_syntax)]
1515
#![feature(int_uint)]
16+
#![feature(test)]
17+
#![feature(rustc_private)]
18+
#![feature(std_misc)]
19+
#![feature(path)]
20+
#![feature(io)]
21+
#![feature(core)]
22+
#![feature(collections)]
23+
#![feature(os)]
24+
#![feature(unicode)]
1625

1726
#![deny(warnings)]
1827

@@ -21,7 +30,6 @@ extern crate getopts;
2130

2231
#[macro_use]
2332
extern crate log;
24-
extern crate regex;
2533

2634
use std::os;
2735
use std::io;
@@ -32,7 +40,6 @@ use getopts::{optopt, optflag, reqopt};
3240
use common::Config;
3341
use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Codegen};
3442
use util::logv;
35-
use regex::Regex;
3643

3744
pub mod procsrv;
3845
pub mod util;
@@ -76,10 +83,6 @@ pub fn parse_config(args: Vec<String> ) -> Config {
7683
optopt("", "target-rustcflags", "flags to pass to rustc for target", "FLAGS"),
7784
optflag("", "verbose", "run tests verbosely, showing all output"),
7885
optopt("", "logfile", "file to log test execution to", "FILE"),
79-
optopt("", "save-metrics", "file to save metrics to", "FILE"),
80-
optopt("", "ratchet-metrics", "file to ratchet metrics against", "FILE"),
81-
optopt("", "ratchet-noise-percent",
82-
"percent change in metrics to consider noise", "N"),
8386
optflag("", "jit", "run tests under the JIT"),
8487
optopt("", "target", "the target to build for", "TARGET"),
8588
optopt("", "host", "the host to build for", "HOST"),
@@ -89,7 +92,6 @@ pub fn parse_config(args: Vec<String> ) -> Config {
8992
optopt("", "adb-path", "path to the android debugger", "PATH"),
9093
optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH"),
9194
optopt("", "lldb-python-dir", "directory containing LLDB's python module", "PATH"),
92-
optopt("", "test-shard", "run shard A, of B shards, worth of the testsuite", "A.B"),
9395
optflag("h", "help", "show this message"));
9496

9597
assert!(!args.is_empty());
@@ -120,14 +122,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
120122
}
121123

122124
let filter = if !matches.free.is_empty() {
123-
let s = matches.free[0].as_slice();
124-
match regex::Regex::new(s) {
125-
Ok(re) => Some(re),
126-
Err(e) => {
127-
println!("failed to parse filter /{}/: {:?}", s, e);
128-
panic!()
129-
}
130-
}
125+
Some(matches.free[0].clone())
131126
} else {
132127
None
133128
};
@@ -149,14 +144,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
149144
.as_slice()).expect("invalid mode"),
150145
run_ignored: matches.opt_present("ignored"),
151146
filter: filter,
152-
cfail_regex: Regex::new(errors::EXPECTED_PATTERN).unwrap(),
153147
logfile: matches.opt_str("logfile").map(|s| Path::new(s)),
154-
save_metrics: matches.opt_str("save-metrics").map(|s| Path::new(s)),
155-
ratchet_metrics:
156-
matches.opt_str("ratchet-metrics").map(|s| Path::new(s)),
157-
ratchet_noise_percent:
158-
matches.opt_str("ratchet-noise-percent")
159-
.and_then(|s| s.as_slice().parse::<f64>()),
160148
runtool: matches.opt_str("runtool"),
161149
host_rustcflags: matches.opt_str("host-rustcflags"),
162150
target_rustcflags: matches.opt_str("target-rustcflags"),
@@ -175,7 +163,6 @@ pub fn parse_config(args: Vec<String> ) -> Config {
175163
opt_str2(matches.opt_str("adb-test-dir")).as_slice() &&
176164
!opt_str2(matches.opt_str("adb-test-dir")).is_empty(),
177165
lldb_python_dir: matches.opt_str("lldb-python-dir"),
178-
test_shard: test::opt_shard(matches.opt_str("test-shard")),
179166
verbose: matches.opt_present("verbose"),
180167
}
181168
}
@@ -209,10 +196,6 @@ pub fn log_config(config: &Config) {
209196
logv(c, format!("adb_test_dir: {:?}", config.adb_test_dir));
210197
logv(c, format!("adb_device_status: {}",
211198
config.adb_device_status));
212-
match config.test_shard {
213-
None => logv(c, "test_shard: (all)".to_string()),
214-
Some((a,b)) => logv(c, format!("test_shard: {}.{}", a, b))
215-
}
216199
logv(c, format!("verbose: {}", config.verbose));
217200
logv(c, format!("\n"));
218201
}
@@ -263,6 +246,9 @@ pub fn run_tests(config: &Config) {
263246
// parallel (especially when we have lots and lots of child processes).
264247
// For context, see #8904
265248
io::test::raise_fd_limit();
249+
// Prevent issue #21352 UAC blocking .exe containing 'patch' etc. on Windows
250+
// If #11207 is resolved (adding manifest to .exe) this becomes unnecessary
251+
os::setenv("__COMPAT_LAYER", "RunAsInvoker");
266252
let res = test::run_tests_console(&opts, tests.into_iter().collect());
267253
match res {
268254
Ok(true) => {}
@@ -283,15 +269,8 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
283269
logfile: config.logfile.clone(),
284270
run_tests: true,
285271
run_benchmarks: true,
286-
ratchet_metrics: config.ratchet_metrics.clone(),
287-
ratchet_noise_percent: config.ratchet_noise_percent.clone(),
288-
save_metrics: config.save_metrics.clone(),
289-
test_shard: config.test_shard.clone(),
290272
nocapture: false,
291273
color: test::AutoColor,
292-
show_boxplot: false,
293-
boxplot_width: 50,
294-
show_all_stats: false,
295274
}
296275
}
297276

@@ -393,18 +372,24 @@ fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
393372
if full_version_line.as_slice().trim().len() > 0 => {
394373
let full_version_line = full_version_line.as_slice().trim();
395374

396-
let re = Regex::new(r"(^|[^0-9])([0-9]\.[0-9])([^0-9]|$)").unwrap();
397-
398-
match re.captures(full_version_line) {
399-
Some(captures) => {
400-
Some(captures.at(2).unwrap_or("").to_string())
375+
// used to be a regex "(^|[^0-9])([0-9]\.[0-9])([^0-9]|$)"
376+
for (pos, c) in full_version_line.char_indices() {
377+
if !c.is_digit(10) { continue }
378+
if pos + 2 >= full_version_line.len() { continue }
379+
if full_version_line.char_at(pos + 1) != '.' { continue }
380+
if !full_version_line.char_at(pos + 2).is_digit(10) { continue }
381+
if pos > 0 && full_version_line.char_at_reverse(pos).is_digit(10) {
382+
continue
401383
}
402-
None => {
403-
println!("Could not extract GDB version from line '{}'",
404-
full_version_line);
405-
None
384+
if pos + 3 < full_version_line.len() &&
385+
full_version_line.char_at(pos + 3).is_digit(10) {
386+
continue
406387
}
388+
return Some(full_version_line[pos..pos+3].to_string());
407389
}
390+
println!("Could not extract GDB version from line '{}'",
391+
full_version_line);
392+
None
408393
},
409394
_ => None
410395
}
@@ -427,18 +412,26 @@ fn extract_lldb_version(full_version_line: Option<String>) -> Option<String> {
427412
if full_version_line.as_slice().trim().len() > 0 => {
428413
let full_version_line = full_version_line.as_slice().trim();
429414

430-
let re = Regex::new(r"[Ll][Ll][Dd][Bb]-([0-9]+)").unwrap();
431-
432-
match re.captures(full_version_line) {
433-
Some(captures) => {
434-
Some(captures.at(1).unwrap_or("").to_string())
435-
}
436-
None => {
437-
println!("Could not extract LLDB version from line '{}'",
438-
full_version_line);
439-
None
440-
}
415+
for (pos, l) in full_version_line.char_indices() {
416+
if l != 'l' && l != 'L' { continue }
417+
if pos + 5 >= full_version_line.len() { continue }
418+
let l = full_version_line.char_at(pos + 1);
419+
if l != 'l' && l != 'L' { continue }
420+
let d = full_version_line.char_at(pos + 2);
421+
if d != 'd' && d != 'D' { continue }
422+
let b = full_version_line.char_at(pos + 3);
423+
if b != 'b' && b != 'B' { continue }
424+
let dash = full_version_line.char_at(pos + 4);
425+
if dash != '-' { continue }
426+
427+
let vers = full_version_line[pos + 5..].chars().take_while(|c| {
428+
c.is_digit(10)
429+
}).collect::<String>();
430+
if vers.len() > 0 { return Some(vers) }
441431
}
432+
println!("Could not extract LLDB version from line '{}'",
433+
full_version_line);
434+
None
442435
},
443436
_ => None
444437
}

0 commit comments

Comments
 (0)