Skip to content

Commit 2273b52

Browse files
committed
mk: Move from -D warnings to #![deny(warnings)]
This commit removes the `-D warnings` flag being passed through the makefiles to all crates to instead be a crate attribute. We want these attributes always applied for all our standard builds, and this is more amenable to Cargo-based builds as well. Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)` attribute currently to match the same semantics we have today
1 parent 6866f13 commit 2273b52

File tree

39 files changed

+49
-20
lines changed

39 files changed

+49
-20
lines changed

mk/target.mk

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ export CFG_COMPILER_HOST_TRIPLE
1717
export CFG_DEFAULT_LINKER
1818
export CFG_DEFAULT_AR
1919

20-
# The standard libraries should be held up to a higher standard than any old
21-
# code, make sure that these common warnings are denied by default. These can
22-
# be overridden during development temporarily. For stage0, we allow warnings
23-
# which may be bugs in stage0 (should be fixed in stage1+)
24-
RUST_LIB_FLAGS_ST0 += -W warnings
25-
RUST_LIB_FLAGS_ST1 += -D warnings
26-
RUST_LIB_FLAGS_ST2 += -D warnings
27-
2820
# Macro that generates the full list of dependencies for a crate at a particular
2921
# stage/target/host tuple.
3022
#

src/liballoc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
7171
#![no_std]
7272
#![needs_allocator]
73+
#![cfg_attr(not(stage0), deny(warnings))]
7374

7475
#![feature(allocator)]
7576
#![feature(box_syntax)]

src/liballoc_jemalloc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
reason = "this library is unlikely to be stabilized in its current \
1717
form or name",
1818
issue = "27783")]
19+
#![cfg_attr(not(stage0), deny(warnings))]
1920
#![feature(allocator)]
2021
#![feature(libc)]
2122
#![feature(staged_api)]

src/liballoc_system/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#![crate_type = "rlib"]
1313
#![no_std]
1414
#![allocator]
15+
#![cfg_attr(not(stage0), deny(warnings))]
1516
#![unstable(feature = "alloc_system",
1617
reason = "this library is unlikely to be stabilized in its current \
1718
form or name",

src/libarena/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2828
html_root_url = "https://doc.rust-lang.org/nightly/",
2929
test(no_crate_inject, attr(deny(warnings))))]
30+
#![cfg_attr(not(stage0), deny(warnings))]
3031

3132
#![feature(alloc)]
3233
#![feature(core_intrinsics)]

src/libcollections/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#![allow(trivial_casts)]
3030
#![cfg_attr(test, allow(deprecated))] // rand
31+
#![cfg_attr(not(stage0), deny(warnings))]
3132

3233
#![feature(alloc)]
3334
#![feature(box_patterns)]

src/libcore/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656

5757
#![no_core]
5858
#![deny(missing_docs)]
59+
#![cfg_attr(not(stage0), deny(warnings))]
5960

6061
#![feature(allow_internal_unstable)]
6162
#![feature(associated_type_defaults)]

src/libflate/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2323
html_root_url = "https://doc.rust-lang.org/nightly/",
2424
test(attr(deny(warnings))))]
25+
#![cfg_attr(not(stage0), deny(warnings))]
2526

2627
#![feature(libc)]
2728
#![feature(staged_api)]

src/libfmt_macros/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
html_root_url = "https://doc.rust-lang.org/nightly/",
2424
html_playground_url = "https://play.rust-lang.org/",
2525
test(attr(deny(warnings))))]
26+
#![cfg_attr(not(stage0), deny(warnings))]
2627

2728
#![feature(staged_api)]
2829
#![feature(unicode)]

src/libgraphviz/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@
280280
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
281281
html_root_url = "https://doc.rust-lang.org/nightly/",
282282
test(attr(allow(unused_variables), deny(warnings))))]
283+
#![cfg_attr(not(stage0), deny(warnings))]
283284

284285
#![feature(str_escape)]
285286

0 commit comments

Comments
 (0)