mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 04:39:16 +00:00
Deny bare trait objects in librustc_target and libtest
This commit is contained in:
parent
c946c2539e
commit
21d9ac1d04
@ -21,6 +21,8 @@
|
|||||||
//! one that doesn't; the one that doesn't might get decent parallel
|
//! one that doesn't; the one that doesn't might get decent parallel
|
||||||
//! build speedups.
|
//! build speedups.
|
||||||
|
|
||||||
|
#![deny(bare_trait_objects)]
|
||||||
|
|
||||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||||
|
@ -229,7 +229,7 @@ macro_rules! supported_targets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_targets() -> Box<Iterator<Item=String>> {
|
pub fn get_targets() -> Box<dyn Iterator<Item=String>> {
|
||||||
Box::new(TARGETS.iter().filter_map(|t| -> Option<String> {
|
Box::new(TARGETS.iter().filter_map(|t| -> Option<String> {
|
||||||
load_specific(t)
|
load_specific(t)
|
||||||
.and(Ok(t.to_string()))
|
.and(Ok(t.to_string()))
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
// NB: this is also specified in this crate's Cargo.toml, but libsyntax contains logic specific to
|
// NB: this is also specified in this crate's Cargo.toml, but libsyntax contains logic specific to
|
||||||
// this crate, which relies on this attribute (rather than the value of `--crate-name` passed by
|
// this crate, which relies on this attribute (rather than the value of `--crate-name` passed by
|
||||||
// cargo) to detect this crate.
|
// cargo) to detect this crate.
|
||||||
|
|
||||||
|
#![deny(bare_trait_objects)]
|
||||||
|
|
||||||
#![crate_name = "test"]
|
#![crate_name = "test"]
|
||||||
#![unstable(feature = "test", issue = "27812")]
|
#![unstable(feature = "test", issue = "27812")]
|
||||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||||
@ -165,8 +168,8 @@ pub trait TDynBenchFn: Send {
|
|||||||
pub enum TestFn {
|
pub enum TestFn {
|
||||||
StaticTestFn(fn()),
|
StaticTestFn(fn()),
|
||||||
StaticBenchFn(fn(&mut Bencher)),
|
StaticBenchFn(fn(&mut Bencher)),
|
||||||
DynTestFn(Box<FnBox() + Send>),
|
DynTestFn(Box<dyn FnBox() + Send>),
|
||||||
DynBenchFn(Box<TDynBenchFn + 'static>),
|
DynBenchFn(Box<dyn TDynBenchFn + 'static>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TestFn {
|
impl TestFn {
|
||||||
@ -840,7 +843,7 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
|
|||||||
fn callback(
|
fn callback(
|
||||||
event: &TestEvent,
|
event: &TestEvent,
|
||||||
st: &mut ConsoleTestState,
|
st: &mut ConsoleTestState,
|
||||||
out: &mut OutputFormatter,
|
out: &mut dyn OutputFormatter,
|
||||||
) -> io::Result<()> {
|
) -> io::Result<()> {
|
||||||
match (*event).clone() {
|
match (*event).clone() {
|
||||||
TeFiltered(ref filtered_tests) => {
|
TeFiltered(ref filtered_tests) => {
|
||||||
@ -897,7 +900,7 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
|
|||||||
|
|
||||||
let is_multithreaded = opts.test_threads.unwrap_or_else(get_concurrency) > 1;
|
let is_multithreaded = opts.test_threads.unwrap_or_else(get_concurrency) > 1;
|
||||||
|
|
||||||
let mut out: Box<OutputFormatter> = match opts.format {
|
let mut out: Box<dyn OutputFormatter> = match opts.format {
|
||||||
OutputFormat::Pretty => Box::new(PrettyFormatter::new(
|
OutputFormat::Pretty => Box::new(PrettyFormatter::new(
|
||||||
output,
|
output,
|
||||||
use_color(opts),
|
use_color(opts),
|
||||||
@ -1386,7 +1389,7 @@ pub fn run_test(
|
|||||||
desc: TestDesc,
|
desc: TestDesc,
|
||||||
monitor_ch: Sender<MonitorMsg>,
|
monitor_ch: Sender<MonitorMsg>,
|
||||||
nocapture: bool,
|
nocapture: bool,
|
||||||
testfn: Box<FnBox() + Send>,
|
testfn: Box<dyn FnBox() + Send>,
|
||||||
) {
|
) {
|
||||||
// Buffer for capturing standard I/O
|
// Buffer for capturing standard I/O
|
||||||
let data = Arc::new(Mutex::new(Vec::new()));
|
let data = Arc::new(Mutex::new(Vec::new()));
|
||||||
@ -1459,7 +1462,7 @@ fn __rust_begin_short_backtrace<F: FnOnce()>(f: F) {
|
|||||||
f()
|
f()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn calc_result(desc: &TestDesc, task_result: Result<(), Box<Any + Send>>) -> TestResult {
|
fn calc_result(desc: &TestDesc, task_result: Result<(), Box<dyn Any + Send>>) -> TestResult {
|
||||||
match (&desc.should_panic, task_result) {
|
match (&desc.should_panic, task_result) {
|
||||||
(&ShouldPanic::No, Ok(())) | (&ShouldPanic::Yes, Err(_)) => TrOk,
|
(&ShouldPanic::No, Ok(())) | (&ShouldPanic::Yes, Err(_)) => TrOk,
|
||||||
(&ShouldPanic::YesWithMessage(msg), Err(ref err)) => {
|
(&ShouldPanic::YesWithMessage(msg), Err(ref err)) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user