|
26 | 26 | // NB: this is also specified in this crate's Cargo.toml, but libsyntax contains logic specific to
|
27 | 27 | // this crate, which relies on this attribute (rather than the value of `--crate-name` passed by
|
28 | 28 | // cargo) to detect this crate.
|
| 29 | + |
| 30 | +#![deny(bare_trait_objects)] |
| 31 | + |
29 | 32 | #![crate_name = "test"]
|
30 | 33 | #![unstable(feature = "test", issue = "27812")]
|
31 | 34 | #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
@@ -165,8 +168,8 @@ pub trait TDynBenchFn: Send {
|
165 | 168 | pub enum TestFn {
|
166 | 169 | StaticTestFn(fn()),
|
167 | 170 | StaticBenchFn(fn(&mut Bencher)),
|
168 |
| - DynTestFn(Box<FnBox() + Send>), |
169 |
| - DynBenchFn(Box<TDynBenchFn + 'static>), |
| 171 | + DynTestFn(Box<dyn FnBox() + Send>), |
| 172 | + DynBenchFn(Box<dyn TDynBenchFn + 'static>), |
170 | 173 | }
|
171 | 174 |
|
172 | 175 | impl TestFn {
|
@@ -840,7 +843,7 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
|
840 | 843 | fn callback(
|
841 | 844 | event: &TestEvent,
|
842 | 845 | st: &mut ConsoleTestState,
|
843 |
| - out: &mut OutputFormatter, |
| 846 | + out: &mut dyn OutputFormatter, |
844 | 847 | ) -> io::Result<()> {
|
845 | 848 | match (*event).clone() {
|
846 | 849 | TeFiltered(ref filtered_tests) => {
|
@@ -897,7 +900,7 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
|
897 | 900 |
|
898 | 901 | let is_multithreaded = opts.test_threads.unwrap_or_else(get_concurrency) > 1;
|
899 | 902 |
|
900 |
| - let mut out: Box<OutputFormatter> = match opts.format { |
| 903 | + let mut out: Box<dyn OutputFormatter> = match opts.format { |
901 | 904 | OutputFormat::Pretty => Box::new(PrettyFormatter::new(
|
902 | 905 | output,
|
903 | 906 | use_color(opts),
|
@@ -1386,7 +1389,7 @@ pub fn run_test(
|
1386 | 1389 | desc: TestDesc,
|
1387 | 1390 | monitor_ch: Sender<MonitorMsg>,
|
1388 | 1391 | nocapture: bool,
|
1389 |
| - testfn: Box<FnBox() + Send>, |
| 1392 | + testfn: Box<dyn FnBox() + Send>, |
1390 | 1393 | ) {
|
1391 | 1394 | // Buffer for capturing standard I/O
|
1392 | 1395 | let data = Arc::new(Mutex::new(Vec::new()));
|
@@ -1459,7 +1462,7 @@ fn __rust_begin_short_backtrace<F: FnOnce()>(f: F) {
|
1459 | 1462 | f()
|
1460 | 1463 | }
|
1461 | 1464 |
|
1462 |
| -fn calc_result(desc: &TestDesc, task_result: Result<(), Box<Any + Send>>) -> TestResult { |
| 1465 | +fn calc_result(desc: &TestDesc, task_result: Result<(), Box<dyn Any + Send>>) -> TestResult { |
1463 | 1466 | match (&desc.should_panic, task_result) {
|
1464 | 1467 | (&ShouldPanic::No, Ok(())) | (&ShouldPanic::Yes, Err(_)) => TrOk,
|
1465 | 1468 | (&ShouldPanic::YesWithMessage(msg), Err(ref err)) => {
|
|
0 commit comments