Skip to content

Commit 0f938f6

Browse files
committed
Rustup to rustc 1.40.0-nightly (2daa404 2019-10-02)
1 parent e676998 commit 0f938f6

File tree

4 files changed

+60
-59
lines changed

4 files changed

+60
-59
lines changed

config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fi
1212

1313
TARGET_TRIPLE=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")
1414

15-
export RUSTFLAGS='-Cpanic=abort -Cdebuginfo=2 -Zcodegen-backend='$(pwd)'/target/'$CHANNEL'/librustc_codegen_cranelift.'$dylib_ext' --sysroot '$(pwd)'/build_sysroot/sysroot'
15+
export RUSTFLAGS='-Cpanic=abort -Cdebuginfo=2 -Zpanic-abort-tests -Zcodegen-backend='$(pwd)'/target/'$CHANNEL'/librustc_codegen_cranelift.'$dylib_ext' --sysroot '$(pwd)'/build_sysroot/sysroot'
1616
RUSTC="rustc $RUSTFLAGS -L crate=target/out --out-dir target/out"
1717
export RUSTC_LOG=warn # display metadata load errors
1818

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,35 @@
1-
From e77c222bb7ec0a99a69dcbb039c75fd1ea9db368 Mon Sep 17 00:00:00 2001
1+
From e06143d3373293d0490df482261cd4a842f1a5c5 Mon Sep 17 00:00:00 2001
22
From: bjorn3 <[email protected]>
3-
Date: Thu, 3 Oct 2019 16:22:21 +0200
3+
Date: Thu, 3 Oct 2019 16:51:34 +0200
44
Subject: [PATCH] Fix libtest compilation
55

66
---
7-
src/libtest/lib.rs | 30 +++++-------------------------
8-
1 file changed, 5 insertions(+), 25 deletions(-)
7+
src/libtest/lib.rs | 28 ++++++++--------------------
8+
1 file changed, 8 insertions(+), 20 deletions(-)
99

1010
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
11-
index e441514..8e8b4df 100644
11+
index 8b76080..9e65de2 100644
1212
--- a/src/libtest/lib.rs
1313
+++ b/src/libtest/lib.rs
14-
@@ -24,7 +24,6 @@
15-
#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc, rustc_private))]
16-
#![feature(nll)]
17-
#![feature(set_stdio)]
18-
-#![feature(panic_unwind)]
19-
#![feature(staged_api)]
20-
#![feature(termination_trait_lib)]
21-
#![feature(test)]
22-
@@ -34,16 +33,6 @@ use getopts;
23-
extern crate libc;
24-
use term;
25-
26-
-// FIXME(#54291): rustc and/or LLVM don't yet support building with panic-unwind
27-
-// on aarch64-pc-windows-msvc, or thumbv7a-pc-windows-msvc
28-
-// so we don't link libtest against libunwind (for the time being)
29-
-// even though it means that libtest won't be fully functional on
30-
-// these platforms.
31-
-//
32-
-// See also: https://github.com/rust-lang/rust/issues/54190#issuecomment-422904437
33-
-#[cfg(not(all(windows, any(target_arch = "aarch64", target_arch = "arm"))))]
34-
-extern crate panic_unwind;
35-
-
36-
pub use self::ColorConfig::*;
37-
use self::NamePadding::*;
38-
use self::OutputLocation::*;
39-
@@ -61,7 +50,6 @@ use std::fmt;
14+
@@ -52,7 +52,7 @@ use std::fmt;
4015
use std::fs::File;
4116
use std::io;
4217
use std::io::prelude::*;
43-
-use std::panic::{catch_unwind, AssertUnwindSafe};
18+
-use std::panic::{self, catch_unwind, AssertUnwindSafe, PanicInfo};
19+
+use std::panic::{self, PanicInfo};
4420
use std::path::PathBuf;
4521
use std::process;
46-
use std::process::Termination;
47-
@@ -1434,7 +1422,7 @@ pub fn run_test(
48-
monitor_ch: Sender<MonitorMsg>,
49-
nocapture: bool,
22+
use std::process::{ExitStatus, Command, Termination};
23+
@@ -1493,7 +1493,7 @@ pub fn run_test(
5024
report_time: bool,
25+
strategy: RunStrategy,
26+
monitor_ch: Sender<MonitorMsg>,
5127
- testfn: Box<dyn FnOnce() + Send>,
5228
+ testfn: Box<impl FnOnce() + Send + 'static>,
5329
concurrency: Concurrent,
5430
) {
55-
// Buffer for capturing standard I/O
56-
@@ -1457,7 +1445,7 @@ pub fn run_test(
57-
} else {
58-
None
59-
};
60-
- let result = catch_unwind(AssertUnwindSafe(testfn));
61-
+ let result = Ok(testfn());
62-
let exec_time = start.map(|start| {
63-
let duration = start.elapsed();
64-
TestExecTime(duration)
65-
@@ -1478,7 +1466,7 @@ pub fn run_test(
31+
let name = desc.name.clone();
32+
@@ -1509,7 +1509,7 @@ pub fn run_test(
6633
// If the platform is single-threaded we're just going to run
6734
// the test synchronously, regardless of the concurrency
6835
// level.
@@ -71,25 +38,56 @@ index e441514..8e8b4df 100644
7138
if concurrency == Concurrent::Yes && supports_threads {
7239
let cfg = thread::Builder::new().name(name.as_slice().to_owned());
7340
cfg.spawn(runtest).unwrap();
74-
@@ -1498,16 +1486,8 @@ pub fn run_test(
41+
@@ -1531,20 +1531,8 @@ pub fn run_test(
7542
(benchfn.clone())(harness)
7643
});
7744
}
7845
- DynTestFn(f) => {
79-
- let cb = move || __rust_begin_short_backtrace(f);
46+
- match strategy {
47+
- RunStrategy::InProcess => (),
48+
- _ => panic!("Cannot run dynamic test fn out-of-process"),
49+
- };
8050
- run_test_inner(
8151
- desc,
82-
- monitor_ch,
8352
- opts.nocapture,
8453
- opts.report_time,
85-
- Box::new(cb),
86-
- concurrency,
87-
- )
54+
- strategy,
55+
- monitor_ch,
56+
- Box::new(move || __rust_begin_short_backtrace(f)),
57+
- concurrency
58+
- );
8859
+ DynTestFn(_f) => {
8960
+ unimplemented!();
9061
}
9162
StaticTestFn(f) => run_test_inner(
9263
desc,
64+
@@ -1604,7 +1592,7 @@ fn get_result_from_exit_code(desc: &TestDesc, code: i32) -> TestResult {
65+
fn run_test_in_process(desc: TestDesc,
66+
nocapture: bool,
67+
report_time: bool,
68+
- testfn: Box<dyn FnOnce() + Send>,
69+
+ testfn: Box<impl FnOnce() + Send + 'static>,
70+
monitor_ch: Sender<MonitorMsg>) {
71+
// Buffer for capturing standard I/O
72+
let data = Arc::new(Mutex::new(Vec::new()));
73+
@@ -1623,7 +1611,7 @@ fn run_test_in_process(desc: TestDesc,
74+
} else {
75+
None
76+
};
77+
- let result = catch_unwind(AssertUnwindSafe(testfn));
78+
+ let result = Ok::<(), Box<dyn Any + Send>>(testfn());
79+
let exec_time = start.map(|start| {
80+
let duration = start.elapsed();
81+
TestExecTime(duration)
82+
@@ -1688,7 +1676,7 @@ fn spawn_test_subprocess(desc: TestDesc, report_time: bool, monitor_ch: Sender<M
83+
monitor_ch.send((desc.clone(), result, exec_time, test_output)).unwrap();
84+
}
85+
86+
-fn run_test_in_spawned_subprocess(desc: TestDesc, testfn: Box<dyn FnOnce() + Send>) -> ! {
87+
+fn run_test_in_spawned_subprocess(desc: TestDesc, testfn: Box<impl FnOnce() + Send + 'static>) -> ! {
88+
let builtin_panic_hook = panic::take_hook();
89+
let record_result = Arc::new(move |panic_info: Option<&'_ PanicInfo<'_>>| {
90+
let test_result = match panic_info {
9391
--
9492
2.20.1
9593

src/driver.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ fn run_aot(
219219
rustc_incremental::finalize_session_directory(tcx.sess, tcx.crate_hash(LOCAL_CRATE));
220220

221221
let metadata_module = if need_metadata_module {
222-
tcx.sess.profiler(|p| p.start_activity("codegen crate metadata"));
222+
let _timer = tcx.prof.generic_activity("codegen crate metadata");
223223
let (metadata_cgu_name, tmp_file) = rustc::util::common::time(tcx.sess, "write compressed metadata", || {
224224
use rustc::mir::mono::CodegenUnitNameBuilder;
225225

@@ -244,7 +244,6 @@ fn run_aot(
244244

245245
(metadata_cgu_name, tmp_file)
246246
});
247-
tcx.sess.profiler(|p| p.end_activity("codegen crate metadata"));
248247

249248
Some(CompiledModule {
250249
name: metadata_cgu_name,

src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ extern crate rustc_data_structures;
1010
extern crate rustc_driver;
1111
extern crate rustc_fs_util;
1212
extern crate rustc_incremental;
13+
extern crate rustc_index;
1314
extern crate rustc_mir;
1415
extern crate rustc_target;
1516
extern crate syntax;
@@ -74,11 +75,14 @@ mod prelude {
7475
self, FnSig, Instance, InstanceDef, ParamEnv, PolyFnSig, Ty, TyCtxt, TypeAndMut,
7576
TypeFoldable,
7677
};
78+
7779
pub use rustc_data_structures::{
7880
fx::{FxHashMap, FxHashSet},
79-
indexed_vec::Idx,
8081
sync::Lrc,
8182
};
83+
84+
pub use rustc_index::vec::Idx;
85+
8286
pub use rustc_mir::monomorphize::collector;
8387

8488
pub use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
@@ -225,7 +229,8 @@ impl CodegenBackend for CraneliftCodegenBackend {
225229
.downcast::<CodegenResults>()
226230
.expect("Expected CraneliftCodegenBackend's CodegenResult, found Box<Any>");
227231

228-
sess.profiler(|p| p.start_activity("link_crate"));
232+
let _timer = sess.prof.generic_activity("link_crate");
233+
229234
rustc::util::common::time(sess, "linking", || {
230235
let target_cpu = crate::target_triple(sess).to_string();
231236
link_binary::<crate::archive::ArArchiveBuilder<'_>>(
@@ -236,7 +241,6 @@ impl CodegenBackend for CraneliftCodegenBackend {
236241
&target_cpu,
237242
);
238243
});
239-
sess.profiler(|p| p.end_activity("link_crate"));
240244

241245
Ok(())
242246
}

0 commit comments

Comments
 (0)