Skip to content

Commit

Permalink
Auto merge of #31120 - alexcrichton:attribute-deny-warnings, r=brson
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Jan 26, 2016
2 parents a9e139b + cb343c3 commit 4b61585
Show file tree
Hide file tree
Showing 60 changed files with 188 additions and 161 deletions.
8 changes: 0 additions & 8 deletions mk/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ export CFG_COMPILER_HOST_TRIPLE
export CFG_DEFAULT_LINKER
export CFG_DEFAULT_AR

# The standard libraries should be held up to a higher standard than any old
# code, make sure that these common warnings are denied by default. These can
# be overridden during development temporarily. For stage0, we allow warnings
# which may be bugs in stage0 (should be fixed in stage1+)
RUST_LIB_FLAGS_ST0 += -W warnings
RUST_LIB_FLAGS_ST1 += -D warnings
RUST_LIB_FLAGS_ST2 += -D warnings

# Macro that generates the full list of dependencies for a crate at a particular
# stage/target/host tuple.
#
Expand Down
1 change: 0 additions & 1 deletion src/liballoc/boxed_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use core::ops::Deref;
use core::result::Result::{Ok, Err};
use core::clone::Clone;

use std::boxed;
use std::boxed::Box;

#[test]
Expand Down
14 changes: 6 additions & 8 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,35 +70,33 @@
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
#![no_std]
#![needs_allocator]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(allocator)]
#![feature(box_syntax)]
#![feature(coerce_unsized)]
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(custom_attribute)]
#![feature(drop_in_place)]
#![feature(dropck_parametricity)]
#![feature(fundamental)]
#![feature(lang_items)]
#![feature(needs_allocator)]
#![feature(optin_builtin_traits)]
#![feature(placement_in_syntax)]
#![feature(placement_new_protocol)]
#![feature(raw)]
#![feature(shared)]
#![feature(staged_api)]
#![feature(unboxed_closures)]
#![feature(unique)]
#![feature(unsafe_no_drop_flag, filling_drop)]
#![feature(dropck_parametricity)]
#![feature(unsize)]
#![feature(drop_in_place)]
#![feature(fn_traits)]
#![feature(const_fn)]

#![feature(needs_allocator)]

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

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

#[cfg(stage0)]
Expand Down
1 change: 1 addition & 0 deletions src/liballoc_jemalloc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
reason = "this library is unlikely to be stabilized in its current \
form or name",
issue = "27783")]
#![cfg_attr(not(stage0), deny(warnings))]
#![feature(allocator)]
#![feature(libc)]
#![feature(staged_api)]
Expand Down
1 change: 1 addition & 0 deletions src/liballoc_system/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#![crate_type = "rlib"]
#![no_std]
#![allocator]
#![cfg_attr(not(stage0), deny(warnings))]
#![unstable(feature = "alloc_system",
reason = "this library is unlikely to be stabilized in its current \
form or name",
Expand Down
1 change: 1 addition & 0 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
test(no_crate_inject, attr(deny(warnings))))]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(alloc)]
#![feature(core_intrinsics)]
Expand Down
3 changes: 2 additions & 1 deletion src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#![allow(trivial_casts)]
#![cfg_attr(test, allow(deprecated))] // rand
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(alloc)]
#![feature(box_patterns)]
Expand Down Expand Up @@ -55,7 +56,7 @@
#![feature(unicode)]
#![feature(unique)]
#![feature(unsafe_no_drop_flag)]
#![cfg_attr(test, feature(clone_from_slice, rand, test))]
#![cfg_attr(test, feature(rand, test))]

#![no_std]

Expand Down
15 changes: 2 additions & 13 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,14 @@

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

use alloc::boxed::Box;
use core::clone::Clone;
use core::cmp::Ordering::{self, Greater, Less};
use core::cmp::{self, Ord, PartialEq};
use core::iter::Iterator;
use core::marker::Sized;
use core::cmp;
use core::mem::size_of;
use core::mem;
use core::ops::FnMut;
use core::option::Option::{self, Some, None};
use core::ptr;
use core::result::Result;
use core::slice as core_slice;

use borrow::{Borrow, BorrowMut, ToOwned};
Expand Down Expand Up @@ -136,12 +130,7 @@ pub use self::hack::to_vec;
// `test_permutations` test
mod hack {
use alloc::boxed::Box;
use core::clone::Clone;
#[cfg(test)]
use core::iter::Iterator;
use core::mem;
#[cfg(test)]
use core::option::Option::{Some, None};

#[cfg(test)]
use string::ToString;
Expand Down
4 changes: 0 additions & 4 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
// It's cleaner to just turn off the unused_imports warning than to fix them.
#![allow(unused_imports)]

use core::clone::Clone;
use core::iter::{Iterator, Extend};
use core::option::Option::{self, Some, None};
use core::result::Result;
use core::str as core_str;
use core::str::pattern::Pattern;
use core::str::pattern::{Searcher, ReverseSearcher, DoubleEndedSearcher};
Expand Down
1 change: 0 additions & 1 deletion src/libcollectionstest/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

use std::cmp::Ordering::{Equal, Greater, Less};
use std::default::Default;
use std::mem;
use std::__rand::{Rng, thread_rng};
use std::rc::Rc;
Expand Down
1 change: 1 addition & 0 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

#![no_core]
#![deny(missing_docs)]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(allow_internal_unstable)]
#![feature(associated_type_defaults)]
Expand Down
1 change: 1 addition & 0 deletions src/libflate/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
test(attr(deny(warnings))))]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(libc)]
#![feature(staged_api)]
Expand Down
1 change: 1 addition & 0 deletions src/libfmt_macros/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/",
test(attr(deny(warnings))))]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(staged_api)]
#![feature(unicode)]
Expand Down
1 change: 1 addition & 0 deletions src/libgraphviz/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
test(attr(allow(unused_variables), deny(warnings))))]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(str_escape)]

Expand Down
1 change: 1 addition & 0 deletions src/liblog/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
html_playground_url = "https://play.rust-lang.org/",
test(attr(deny(warnings))))]
#![deny(missing_docs)]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(box_syntax)]
#![feature(const_fn)]
Expand Down
3 changes: 2 additions & 1 deletion src/librand/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/",
test(attr(deny(warnings))))]
#![cfg_attr(not(stage0), deny(warnings))]
#![no_std]
#![unstable(feature = "rand",
reason = "use `rand` from crates.io",
Expand All @@ -35,7 +36,7 @@
#![feature(custom_attribute)]
#![allow(unused_attributes)]

#![cfg_attr(test, feature(test, rand, rustc_private, iter_order_deprecated))]
#![cfg_attr(test, feature(test, rand, rustc_private))]

#![allow(deprecated)]

Expand Down
1 change: 1 addition & 0 deletions src/librbml/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/",
test(attr(deny(warnings))))]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(rustc_private)]
#![feature(staged_api)]
Expand Down
5 changes: 3 additions & 2 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#![crate_type = "dylib"]
#![crate_type = "rlib"]
#![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_root_url = "https://doc.rust-lang.org/nightly/")]
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(associated_consts)]
#![feature(box_patterns)]
Expand Down
1 change: 1 addition & 0 deletions src/librustc_back/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#![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_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(box_syntax)]
#![feature(libc)]
Expand Down
1 change: 1 addition & 0 deletions src/librustc_bitflags/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#![crate_type = "rlib"]
#![no_std]
#![unstable(feature = "rustc_private", issue = "27812")]
#![cfg_attr(not(stage0), deny(warnings))]

//! A typesafe bitmask flag generator.

Expand Down
1 change: 1 addition & 0 deletions src/librustc_borrowck/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#![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_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![allow(non_camel_case_types)]

Expand Down
1 change: 1 addition & 0 deletions src/librustc_data_structures/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(nonzero)]
#![feature(rustc_private)]
Expand Down
1 change: 1 addition & 0 deletions src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#![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_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(box_syntax)]
#![feature(libc)]
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_front/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#![crate_type = "dylib"]
#![crate_type = "rlib"]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(associated_consts)]
#![feature(box_patterns)]
Expand Down
1 change: 1 addition & 0 deletions src/librustc_lint/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#![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_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![cfg_attr(test, feature(test))]
#![feature(box_patterns)]
Expand Down
1 change: 1 addition & 0 deletions src/librustc_llvm/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#![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_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(associated_consts)]
#![feature(box_syntax)]
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_metadata/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
#![crate_type = "dylib"]
#![crate_type = "rlib"]
#![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_root_url = "https://doc.rust-lang.org/nightly/")]
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(box_patterns)]
#![feature(enumset)]
Expand Down
3 changes: 3 additions & 0 deletions src/librustc_mir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![crate_name = "rustc_mir"]
#![crate_type = "rlib"]
#![crate_type = "dylib"]
#![cfg_attr(not(stage0), deny(warnings))]
#![unstable(feature = "rustc_private", issue = "27812")]

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

#[macro_use] extern crate log;
extern crate graphviz as dot;
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_passes/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#![crate_type = "dylib"]
#![crate_type = "rlib"]
#![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_root_url = "https://doc.rust-lang.org/nightly/")]
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(rustc_diagnostic_macros)]
#![feature(staged_api)]
Expand Down
1 change: 1 addition & 0 deletions src/librustc_platform_intrinsics/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#![crate_type = "dylib"]
#![crate_type = "rlib"]
#![feature(staged_api, rustc_private)]
#![cfg_attr(not(stage0), deny(warnings))]

extern crate rustc_llvm as llvm;
extern crate rustc;
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_plugin/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@
#![crate_type = "dylib"]
#![crate_type = "rlib"]
#![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_root_url = "https://doc.rust-lang.org/nightly/")]
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(dynamic_lib)]
#![feature(staged_api)]
Expand Down
1 change: 1 addition & 0 deletions src/librustc_privacy/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#![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_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
Expand Down
1 change: 1 addition & 0 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#![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_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(associated_consts)]
#![feature(borrow_state)]
Expand Down
1 change: 1 addition & 0 deletions src/librustc_trans/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#![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_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(box_patterns)]
#![feature(box_syntax)]
Expand Down
1 change: 1 addition & 0 deletions src/librustc_typeck/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ This API is completely unstable and subject to change.
#![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_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![allow(non_camel_case_types)]

Expand Down
Loading

0 comments on commit 4b61585

Please sign in to comment.