Skip to content

Commit 4b61585

Browse files
committed
Auto merge of #31120 - alexcrichton:attribute-deny-warnings, r=brson
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
2 parents a9e139b + cb343c3 commit 4b61585

File tree

60 files changed

+188
-161
lines changed

Some content is hidden

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

60 files changed

+188
-161
lines changed

Diff for: mk/target.mk

-8
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
#

Diff for: src/liballoc/boxed_test.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use core::ops::Deref;
1515
use core::result::Result::{Ok, Err};
1616
use core::clone::Clone;
1717

18-
use std::boxed;
1918
use std::boxed::Box;
2019

2120
#[test]

Diff for: src/liballoc/lib.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -70,35 +70,33 @@
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)]
7677
#![feature(coerce_unsized)]
78+
#![feature(const_fn)]
7779
#![feature(core_intrinsics)]
7880
#![feature(custom_attribute)]
81+
#![feature(drop_in_place)]
82+
#![feature(dropck_parametricity)]
7983
#![feature(fundamental)]
8084
#![feature(lang_items)]
85+
#![feature(needs_allocator)]
8186
#![feature(optin_builtin_traits)]
8287
#![feature(placement_in_syntax)]
83-
#![feature(placement_new_protocol)]
84-
#![feature(raw)]
8588
#![feature(shared)]
8689
#![feature(staged_api)]
8790
#![feature(unboxed_closures)]
8891
#![feature(unique)]
8992
#![feature(unsafe_no_drop_flag, filling_drop)]
90-
#![feature(dropck_parametricity)]
9193
#![feature(unsize)]
92-
#![feature(drop_in_place)]
93-
#![feature(fn_traits)]
94-
#![feature(const_fn)]
95-
96-
#![feature(needs_allocator)]
9794

9895
// Issue# 30592: Systematically use alloc_system during stage0 since jemalloc
9996
// might be unavailable or disabled
10097
#![cfg_attr(stage0, feature(alloc_system))]
10198

99+
#![cfg_attr(not(test), feature(raw, fn_traits, placement_new_protocol))]
102100
#![cfg_attr(test, feature(test, rustc_private, box_heap))]
103101

104102
#[cfg(stage0)]

Diff for: src/liballoc_jemalloc/lib.rs

+1
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)]

Diff for: src/liballoc_system/lib.rs

+1
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",

Diff for: src/libarena/lib.rs

+1
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)]

Diff for: src/libcollections/lib.rs

+2-1
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)]
@@ -55,7 +56,7 @@
5556
#![feature(unicode)]
5657
#![feature(unique)]
5758
#![feature(unsafe_no_drop_flag)]
58-
#![cfg_attr(test, feature(clone_from_slice, rand, test))]
59+
#![cfg_attr(test, feature(rand, test))]
5960

6061
#![no_std]
6162

Diff for: src/libcollections/slice.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,14 @@
8383

8484
// Many of the usings in this module are only used in the test configuration.
8585
// It's cleaner to just turn off the unused_imports warning than to fix them.
86-
#![allow(unused_imports)]
86+
#![cfg_attr(test, allow(unused_imports, dead_code))]
8787

8888
use alloc::boxed::Box;
89-
use core::clone::Clone;
9089
use core::cmp::Ordering::{self, Greater, Less};
91-
use core::cmp::{self, Ord, PartialEq};
92-
use core::iter::Iterator;
93-
use core::marker::Sized;
90+
use core::cmp;
9491
use core::mem::size_of;
9592
use core::mem;
96-
use core::ops::FnMut;
97-
use core::option::Option::{self, Some, None};
9893
use core::ptr;
99-
use core::result::Result;
10094
use core::slice as core_slice;
10195

10296
use borrow::{Borrow, BorrowMut, ToOwned};
@@ -136,12 +130,7 @@ pub use self::hack::to_vec;
136130
// `test_permutations` test
137131
mod hack {
138132
use alloc::boxed::Box;
139-
use core::clone::Clone;
140-
#[cfg(test)]
141-
use core::iter::Iterator;
142133
use core::mem;
143-
#[cfg(test)]
144-
use core::option::Option::{Some, None};
145134

146135
#[cfg(test)]
147136
use string::ToString;

Diff for: src/libcollections/str.rs

-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
// It's cleaner to just turn off the unused_imports warning than to fix them.
2020
#![allow(unused_imports)]
2121

22-
use core::clone::Clone;
23-
use core::iter::{Iterator, Extend};
24-
use core::option::Option::{self, Some, None};
25-
use core::result::Result;
2622
use core::str as core_str;
2723
use core::str::pattern::Pattern;
2824
use core::str::pattern::{Searcher, ReverseSearcher, DoubleEndedSearcher};

Diff for: src/libcollectionstest/slice.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
use std::cmp::Ordering::{Equal, Greater, Less};
12-
use std::default::Default;
1312
use std::mem;
1413
use std::__rand::{Rng, thread_rng};
1514
use std::rc::Rc;

Diff for: src/libcore/lib.rs

+1
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)]

Diff for: src/libflate/lib.rs

+1
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)]

Diff for: src/libfmt_macros/lib.rs

+1
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)]

Diff for: src/libgraphviz/lib.rs

+1
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

Diff for: src/liblog/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
html_playground_url = "https://play.rust-lang.org/",
169169
test(attr(deny(warnings))))]
170170
#![deny(missing_docs)]
171+
#![cfg_attr(not(stage0), deny(warnings))]
171172

172173
#![feature(box_syntax)]
173174
#![feature(const_fn)]

Diff for: src/librand/lib.rs

+2-1
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
#![no_std]
2728
#![unstable(feature = "rand",
2829
reason = "use `rand` from crates.io",
@@ -35,7 +36,7 @@
3536
#![feature(custom_attribute)]
3637
#![allow(unused_attributes)]
3738

38-
#![cfg_attr(test, feature(test, rand, rustc_private, iter_order_deprecated))]
39+
#![cfg_attr(test, feature(test, rand, rustc_private))]
3940

4041
#![allow(deprecated)]
4142

Diff for: src/librbml/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
html_root_url = "https://doc.rust-lang.org/nightly/",
121121
html_playground_url = "https://play.rust-lang.org/",
122122
test(attr(deny(warnings))))]
123+
#![cfg_attr(not(stage0), deny(warnings))]
123124

124125
#![feature(rustc_private)]
125126
#![feature(staged_api)]

Diff for: src/librustc/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
#![crate_type = "dylib"]
2020
#![crate_type = "rlib"]
2121
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
22-
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
23-
html_root_url = "https://doc.rust-lang.org/nightly/")]
22+
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
23+
html_root_url = "https://doc.rust-lang.org/nightly/")]
24+
#![cfg_attr(not(stage0), deny(warnings))]
2425

2526
#![feature(associated_consts)]
2627
#![feature(box_patterns)]

Diff for: src/librustc_back/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2929
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
3030
html_root_url = "https://doc.rust-lang.org/nightly/")]
31+
#![cfg_attr(not(stage0), deny(warnings))]
3132

3233
#![feature(box_syntax)]
3334
#![feature(libc)]

Diff for: src/librustc_bitflags/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#![crate_type = "rlib"]
1616
#![no_std]
1717
#![unstable(feature = "rustc_private", issue = "27812")]
18+
#![cfg_attr(not(stage0), deny(warnings))]
1819

1920
//! A typesafe bitmask flag generator.
2021

Diff for: src/librustc_borrowck/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1616
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
1717
html_root_url = "https://doc.rust-lang.org/nightly/")]
18+
#![cfg_attr(not(stage0), deny(warnings))]
1819

1920
#![allow(non_camel_case_types)]
2021

Diff for: src/librustc_data_structures/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2424
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
2525
html_root_url = "https://doc.rust-lang.org/nightly/")]
26+
#![cfg_attr(not(stage0), deny(warnings))]
2627

2728
#![feature(nonzero)]
2829
#![feature(rustc_private)]

Diff for: src/librustc_driver/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2222
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2323
html_root_url = "https://doc.rust-lang.org/nightly/")]
24+
#![cfg_attr(not(stage0), deny(warnings))]
2425

2526
#![feature(box_syntax)]
2627
#![feature(libc)]

Diff for: src/librustc_front/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
#![crate_type = "dylib"]
2020
#![crate_type = "rlib"]
2121
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
22-
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
23-
html_root_url = "http://doc.rust-lang.org/nightly/")]
22+
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
23+
html_root_url = "http://doc.rust-lang.org/nightly/")]
24+
#![cfg_attr(not(stage0), deny(warnings))]
2425

2526
#![feature(associated_consts)]
2627
#![feature(box_patterns)]

Diff for: src/librustc_lint/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2727
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2828
html_root_url = "https://doc.rust-lang.org/nightly/")]
29+
#![cfg_attr(not(stage0), deny(warnings))]
2930

3031
#![cfg_attr(test, feature(test))]
3132
#![feature(box_patterns)]

Diff for: src/librustc_llvm/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2222
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2323
html_root_url = "https://doc.rust-lang.org/nightly/")]
24+
#![cfg_attr(not(stage0), deny(warnings))]
2425

2526
#![feature(associated_consts)]
2627
#![feature(box_syntax)]

Diff for: src/librustc_metadata/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
#![crate_type = "dylib"]
1414
#![crate_type = "rlib"]
1515
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
16-
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
17-
html_root_url = "https://doc.rust-lang.org/nightly/")]
16+
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
17+
html_root_url = "https://doc.rust-lang.org/nightly/")]
18+
#![cfg_attr(not(stage0), deny(warnings))]
1819

1920
#![feature(box_patterns)]
2021
#![feature(enumset)]

Diff for: src/librustc_mir/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
1717
#![crate_name = "rustc_mir"]
1818
#![crate_type = "rlib"]
1919
#![crate_type = "dylib"]
20+
#![cfg_attr(not(stage0), deny(warnings))]
21+
#![unstable(feature = "rustc_private", issue = "27812")]
2022

2123
#![feature(rustc_private)]
24+
#![feature(staged_api)]
2225

2326
#[macro_use] extern crate log;
2427
extern crate graphviz as dot;

Diff for: src/librustc_passes/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
#![crate_type = "dylib"]
2020
#![crate_type = "rlib"]
2121
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
22-
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
23-
html_root_url = "https://doc.rust-lang.org/nightly/")]
22+
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
23+
html_root_url = "https://doc.rust-lang.org/nightly/")]
24+
#![cfg_attr(not(stage0), deny(warnings))]
2425

2526
#![feature(rustc_diagnostic_macros)]
2627
#![feature(staged_api)]

Diff for: src/librustc_platform_intrinsics/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#![crate_type = "dylib"]
1414
#![crate_type = "rlib"]
1515
#![feature(staged_api, rustc_private)]
16+
#![cfg_attr(not(stage0), deny(warnings))]
1617

1718
extern crate rustc_llvm as llvm;
1819
extern crate rustc;

Diff for: src/librustc_plugin/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@
5555
#![crate_type = "dylib"]
5656
#![crate_type = "rlib"]
5757
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
58-
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
59-
html_root_url = "https://doc.rust-lang.org/nightly/")]
58+
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
59+
html_root_url = "https://doc.rust-lang.org/nightly/")]
60+
#![cfg_attr(not(stage0), deny(warnings))]
6061

6162
#![feature(dynamic_lib)]
6263
#![feature(staged_api)]

Diff for: src/librustc_privacy/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1616
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
1717
html_root_url = "https://doc.rust-lang.org/nightly/")]
18+
#![cfg_attr(not(stage0), deny(warnings))]
1819

1920
#![feature(rustc_diagnostic_macros)]
2021
#![feature(rustc_private)]

Diff for: src/librustc_resolve/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1616
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
1717
html_root_url = "https://doc.rust-lang.org/nightly/")]
18+
#![cfg_attr(not(stage0), deny(warnings))]
1819

1920
#![feature(associated_consts)]
2021
#![feature(borrow_state)]

Diff for: src/librustc_trans/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2222
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2323
html_root_url = "https://doc.rust-lang.org/nightly/")]
24+
#![cfg_attr(not(stage0), deny(warnings))]
2425

2526
#![feature(box_patterns)]
2627
#![feature(box_syntax)]

Diff for: src/librustc_typeck/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ This API is completely unstable and subject to change.
7070
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
7171
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
7272
html_root_url = "https://doc.rust-lang.org/nightly/")]
73+
#![cfg_attr(not(stage0), deny(warnings))]
7374

7475
#![allow(non_camel_case_types)]
7576

0 commit comments

Comments
 (0)