Skip to content

Commit e098985

Browse files
committed
Deny bare_trait_objects globally
1 parent 4f1d4e4 commit e098985

File tree

52 files changed

+34
-87
lines changed

Some content is hidden

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

52 files changed

+34
-87
lines changed

src/bootstrap/bin/rustc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,9 @@ fn main() {
296296
cmd.arg("--color=always");
297297
}
298298

299-
if env::var_os("RUSTC_DENY_WARNINGS").is_some() {
299+
if env::var_os("RUSTC_DENY_WARNINGS").is_some() && env::var_os("RUSTC_EXT_TOOL").is_none() {
300300
cmd.arg("-Dwarnings");
301+
cmd.arg("-Dbare_trait_objects");
301302
}
302303

303304
if verbose > 1 {

src/bootstrap/check.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ impl Step for Rustdoc {
222222
Mode::ToolRustc,
223223
target,
224224
"check",
225-
"src/tools/rustdoc");
225+
"src/tools/rustdoc",
226+
false);
226227

227228
let _folder = builder.fold_output(|| format!("stage{}-rustdoc", compiler.stage));
228229
println!("Checking rustdoc artifacts ({} -> {})", &compiler.host, target);

src/bootstrap/doc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,7 @@ impl Step for Rustdoc {
814814
target,
815815
"doc",
816816
"src/tools/rustdoc",
817+
false
817818
);
818819

819820
cargo.env("RUSTDOCFLAGS", "--document-private-items");

src/bootstrap/test.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ impl Step for Rls {
286286
Mode::ToolRustc,
287287
host,
288288
"test",
289-
"src/tools/rls");
289+
"src/tools/rls",
290+
true);
290291

291292
// Don't build tests dynamically, just a pain to work with
292293
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
@@ -341,7 +342,8 @@ impl Step for Rustfmt {
341342
Mode::ToolRustc,
342343
host,
343344
"test",
344-
"src/tools/rustfmt");
345+
"src/tools/rustfmt",
346+
true);
345347

346348
// Don't build tests dynamically, just a pain to work with
347349
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
@@ -1739,7 +1741,8 @@ impl Step for CrateRustdoc {
17391741
Mode::ToolRustc,
17401742
target,
17411743
test_kind.subcommand(),
1742-
"src/tools/rustdoc");
1744+
"src/tools/rustdoc",
1745+
false);
17431746
if test_kind.subcommand() == "test" && !builder.fail_fast {
17441747
cargo.arg("--no-fail-fast");
17451748
}

src/bootstrap/tool.rs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,15 @@ impl Step for ToolBuild {
115115
_ => panic!("unexpected Mode for tool build")
116116
}
117117

118-
let mut cargo = prepare_tool_cargo(builder, compiler, self.mode, target, "build", path);
118+
let mut cargo = prepare_tool_cargo(
119+
builder,
120+
compiler,
121+
self.mode,
122+
target,
123+
"build",
124+
path,
125+
is_ext_tool,
126+
);
119127
cargo.arg("--features").arg(self.extra_features.join(" "));
120128

121129
let _folder = builder.fold_output(|| format!("stage{}-{}", compiler.stage, tool));
@@ -238,6 +246,7 @@ pub fn prepare_tool_cargo(
238246
target: Interned<String>,
239247
command: &'static str,
240248
path: &'static str,
249+
is_ext_tool: bool,
241250
) -> Command {
242251
let mut cargo = builder.cargo(compiler, mode, target, command);
243252
let dir = builder.src.join(path);
@@ -247,6 +256,10 @@ pub fn prepare_tool_cargo(
247256
// stages and such and it's just easier if they're not dynamically linked.
248257
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
249258

259+
if is_ext_tool {
260+
cargo.env("RUSTC_EXT_TOOL", "1");
261+
}
262+
250263
if let Some(dir) = builder.openssl_install_dir(target) {
251264
cargo.env("OPENSSL_STATIC", "1");
252265
cargo.env("OPENSSL_DIR", dir);
@@ -449,12 +462,15 @@ impl Step for Rustdoc {
449462
target: builder.config.build,
450463
});
451464

452-
let mut cargo = prepare_tool_cargo(builder,
453-
build_compiler,
454-
Mode::ToolRustc,
455-
target,
456-
"build",
457-
"src/tools/rustdoc");
465+
let mut cargo = prepare_tool_cargo(
466+
builder,
467+
build_compiler,
468+
Mode::ToolRustc,
469+
target,
470+
"build",
471+
"src/tools/rustdoc",
472+
false,
473+
);
458474

459475
// Most tools don't get debuginfo, but rustdoc should.
460476
cargo.env("RUSTC_DEBUGINFO", builder.config.rust_debuginfo.to_string())

src/build_helper/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(bare_trait_objects)]
12-
1311
use std::fs::File;
1412
use std::path::{Path, PathBuf};
1513
use std::process::{Command, Stdio};

src/liballoc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
7373
#![no_std]
7474
#![needs_allocator]
75-
#![deny(bare_trait_objects)]
7675
#![deny(missing_debug_implementations)]
7776

7877
#![cfg_attr(test, allow(deprecated))] // rand

src/liballoc_jemalloc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#![no_std]
1212
#![allow(unused_attributes)]
13-
#![deny(bare_trait_objects)]
1413
#![unstable(feature = "alloc_jemalloc",
1514
reason = "implementation detail of std, does not provide any public API",
1615
issue = "0")]

src/liballoc_system/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#![no_std]
1212
#![allow(unused_attributes)]
13-
#![deny(bare_trait_objects)]
1413
#![unstable(feature = "alloc_system",
1514
reason = "this library is unlikely to be stabilized in its current \
1615
form or name",

src/libarena/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#![cfg_attr(test, feature(test))]
3131

3232
#![allow(deprecated)]
33-
#![deny(bare_trait_objects)]
3433

3534
extern crate alloc;
3635
extern crate rustc_data_structures;

src/libcore/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))]
7171

7272
#![no_core]
73-
#![deny(bare_trait_objects)]
7473
#![deny(missing_docs)]
7574
#![deny(missing_debug_implementations)]
7675

src/libfmt_macros/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
//! Parsing does not happen at runtime: structures of `std::fmt::rt` are
1515
//! generated instead.
1616
17-
#![deny(bare_trait_objects)]
18-
1917
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2018
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2119
html_root_url = "https://doc.rust-lang.org/nightly/",

src/libgraphviz/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@
283283
//!
284284
//! * [DOT language](http://www.graphviz.org/doc/info/lang.html)
285285
286-
#![deny(bare_trait_objects)]
287-
288286
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
289287
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
290288
html_root_url = "https://doc.rust-lang.org/nightly/",

src/libpanic_abort/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
2222
#![panic_runtime]
2323
#![allow(unused_features)]
24-
#![deny(bare_trait_objects)]
2524

2625
#![feature(core_intrinsics)]
2726
#![feature(libc)]

src/libpanic_unwind/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
//! More documentation about each implementation can be found in the respective
2323
//! module.
2424
25-
#![deny(bare_trait_objects)]
2625
#![no_std]
2726
#![unstable(feature = "panic_unwind", issue = "32837")]
2827
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/libproc_macro/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
//! See [the book](../book/first-edition/procedural-macros.html) for more.
2323
2424
#![stable(feature = "proc_macro_lib", since = "1.15.0")]
25-
#![deny(bare_trait_objects)]
2625
#![deny(missing_docs)]
2726
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2827
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",

src/libprofiler_builtins/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@
1515
reason = "internal implementation detail of rustc right now",
1616
issue = "0")]
1717
#![allow(unused_features)]
18-
#![deny(bare_trait_objects)]
1918
#![feature(staged_api)]

src/librustc/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
//!
3737
//! This API is completely unstable and subject to change.
3838
39-
#![deny(bare_trait_objects)]
40-
4139
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
4240
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
4341
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc_allocator/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(bare_trait_objects)]
1211
#![feature(rustc_private)]
1312

1413
#[macro_use] extern crate log;

src/librustc_apfloat/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
//!
4141
//! This API is completely unstable and subject to change.
4242
43-
#![deny(bare_trait_objects)]
44-
4543
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
4644
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
4745
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc_asan/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(bare_trait_objects)]
12-
1311
#![sanitizer_runtime]
1412
#![feature(alloc_system)]
1513
#![feature(sanitizer_runtime)]

src/librustc_borrowck/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
html_root_url = "https://doc.rust-lang.org/nightly/")]
1414

1515
#![allow(non_camel_case_types)]
16-
#![deny(bare_trait_objects)]
1716

1817
#![feature(from_ref)]
1918
#![feature(quote)]

src/librustc_codegen_llvm/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#![feature(custom_attribute)]
2424
#![feature(fs_read_write)]
2525
#![allow(unused_attributes)]
26-
#![deny(bare_trait_objects)]
2726
#![feature(libc)]
2827
#![feature(quote)]
2928
#![feature(range_contains)]

src/librustc_codegen_utils/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#![feature(box_syntax)]
2121
#![feature(custom_attribute)]
2222
#![allow(unused_attributes)]
23-
#![deny(bare_trait_objects)]
2423
#![feature(quote)]
2524
#![feature(rustc_diagnostic_macros)]
2625

src/librustc_data_structures/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
//!
1717
//! This API is completely unstable and subject to change.
1818
19-
#![deny(bare_trait_objects)]
20-
2119
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2220
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
2321
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc_driver/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
//!
1515
//! This API is completely unstable and subject to change.
1616
17-
#![deny(bare_trait_objects)]
18-
1917
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2018
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2119
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc_errors/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(bare_trait_objects)]
12-
1311
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1412
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
1513
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc_incremental/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
//! Support for serializing the dep-graph and reloading it.
1212
13-
#![deny(bare_trait_objects)]
14-
1513
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1614
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
1715
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc_lint/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
//!
2020
//! This API is completely unstable and subject to change.
2121
22-
#![deny(bare_trait_objects)]
23-
2422
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2523
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2624
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc_llvm/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#![allow(non_camel_case_types)]
1313
#![allow(non_snake_case)]
1414
#![allow(dead_code)]
15-
#![deny(bare_trait_objects)]
1615

1716
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1817
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",

src/librustc_lsan/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(bare_trait_objects)]
12-
1311
#![sanitizer_runtime]
1412
#![feature(alloc_system)]
1513
#![feature(sanitizer_runtime)]

src/librustc_metadata/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(bare_trait_objects)]
12-
1311
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1412
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
1513
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc_mir/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
1414
1515
*/
1616

17-
#![deny(bare_trait_objects)]
18-
1917
#![feature(slice_patterns)]
2018
#![feature(slice_sort_by_cached_key)]
2119
#![feature(from_ref)]

src/librustc_msan/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(bare_trait_objects)]
12-
1311
#![sanitizer_runtime]
1412
#![feature(alloc_system)]
1513
#![feature(sanitizer_runtime)]

src/librustc_passes/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
//!
1515
//! This API is completely unstable and subject to change.
1616
17-
#![deny(bare_trait_objects)]
18-
1917
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2018
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2119
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc_platform_intrinsics/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
#![allow(bad_style)]
12-
#![deny(bare_trait_objects)]
1312

1413
pub struct Intrinsic {
1514
pub inputs: &'static [&'static Type],

src/librustc_plugin/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@
6060
//! See the [`plugin` feature](../unstable-book/language-features/plugin.html) of
6161
//! the Unstable Book for more examples.
6262
63-
#![deny(bare_trait_objects)]
64-
6563
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
6664
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
6765
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc_privacy/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(bare_trait_objects)]
12-
1311
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1412
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
1513
html_root_url = "https://doc.rust-lang.org/nightly/")]

0 commit comments

Comments
 (0)