diff --git a/mk/target.mk b/mk/target.mk index f90b09479c9..32a3eb5c20d 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -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. # diff --git a/src/liballoc/boxed_test.rs b/src/liballoc/boxed_test.rs index e7da6d04d3f..120301afa44 100644 --- a/src/liballoc/boxed_test.rs +++ b/src/liballoc/boxed_test.rs @@ -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] diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 0a232ed0620..1438103d7f6 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -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)] diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs index 91d229b819d..b009dfd8c75 100644 --- a/src/liballoc_jemalloc/lib.rs +++ b/src/liballoc_jemalloc/lib.rs @@ -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)] diff --git a/src/liballoc_system/lib.rs b/src/liballoc_system/lib.rs index ffb6999d6e3..8a9e32daa72 100644 --- a/src/liballoc_system/lib.rs +++ b/src/liballoc_system/lib.rs @@ -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", diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index cd2093984e6..46a63390c83 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -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)] diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 6077a4c0104..4958f750166 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -28,6 +28,7 @@ #![allow(trivial_casts)] #![cfg_attr(test, allow(deprecated))] // rand +#![cfg_attr(not(stage0), deny(warnings))] #![feature(alloc)] #![feature(box_patterns)] @@ -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] diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 8b4497e6f03..6252e4888eb 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -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}; @@ -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; diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 9ce1a111cf8..094b7f1d034 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -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}; diff --git a/src/libcollectionstest/slice.rs b/src/libcollectionstest/slice.rs index 80dcd48fbfa..e5e15025625 100644 --- a/src/libcollectionstest/slice.rs +++ b/src/libcollectionstest/slice.rs @@ -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; diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index e8803976937..f76b8655ad1 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -56,6 +56,7 @@ #![no_core] #![deny(missing_docs)] +#![cfg_attr(not(stage0), deny(warnings))] #![feature(allow_internal_unstable)] #![feature(associated_type_defaults)] diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs index a60a1c67e17..f316250d96d 100644 --- a/src/libflate/lib.rs +++ b/src/libflate/lib.rs @@ -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)] diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 7a229ad5222..07d26cddfdb 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -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)] diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 38b45ec0fea..2e26cc1b266 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -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)] diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index dbd553acd68..011f5a744dc 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -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)] diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 06f4c8dfd20..531be63b7bb 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -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", @@ -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)] diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index 913314c4899..8404026df14 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -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)] diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index a7a6b40e6b4..54c12b67970 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -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)] diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs index 746d3ba07d6..4d8cfc23804 100644 --- a/src/librustc_back/lib.rs +++ b/src/librustc_back/lib.rs @@ -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)] diff --git a/src/librustc_bitflags/lib.rs b/src/librustc_bitflags/lib.rs index e2a929f58e1..e2025eaa8ee 100644 --- a/src/librustc_bitflags/lib.rs +++ b/src/librustc_bitflags/lib.rs @@ -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. diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index d730b383a80..e7f5fddc7bb 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -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)] diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index 20caf7dd0cf..e4b13ff548a 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -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)] diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 31151e10a5a..9a63751d889 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -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)] diff --git a/src/librustc_front/lib.rs b/src/librustc_front/lib.rs index b12c41d060a..02ad69e8a7c 100644 --- a/src/librustc_front/lib.rs +++ b/src/librustc_front/lib.rs @@ -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)] diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 78252c491ec..6868b4f2ab7 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -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)] diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 0f85c4528d2..0bb3ddc9ad1 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -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)] diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index 42332c46969..f416ec75010 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -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)] diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index 9cc40bbc383..6f4128fc24d 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -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; diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index fcdbd6384d5..91bfb19aa9d 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -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)] diff --git a/src/librustc_platform_intrinsics/lib.rs b/src/librustc_platform_intrinsics/lib.rs index e857434682d..6a43ef65d6a 100644 --- a/src/librustc_platform_intrinsics/lib.rs +++ b/src/librustc_platform_intrinsics/lib.rs @@ -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; diff --git a/src/librustc_plugin/lib.rs b/src/librustc_plugin/lib.rs index 333c226c2a3..c55e97412bb 100644 --- a/src/librustc_plugin/lib.rs +++ b/src/librustc_plugin/lib.rs @@ -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)] diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index cfd0540cc60..929ec523f63 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -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)] diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 6fa3887763c..2536a12dfcb 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -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)] diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index c1ab0284ade..9ab056a187b 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -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)] diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 17d71fa7be9..49de0efa61d 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -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)] diff --git a/src/librustc_unicode/lib.rs b/src/librustc_unicode/lib.rs index 161da079110..4cbcfd5a0b2 100644 --- a/src/librustc_unicode/lib.rs +++ b/src/librustc_unicode/lib.rs @@ -29,6 +29,7 @@ html_playground_url = "https://play.rust-lang.org/", issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))] +#![cfg_attr(not(stage0), deny(warnings))] #![no_std] #![feature(core_char_ext)] diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index ac5b64f37aa..c52459f6c10 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -16,6 +16,7 @@ html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/", html_playground_url = "https://play.rust-lang.org/")] +#![cfg_attr(not(stage0), deny(warnings))] #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 9e1e3c6a558..2310a8237f4 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -2606,7 +2606,6 @@ impl FromStr for Json { mod tests { extern crate test; use self::Animal::*; - use self::DecodeEnum::*; use self::test::Bencher; use {Encodable, Decodable}; use super::Json::*; diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index 8bb596c8bb2..d683769af7b 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -25,6 +25,7 @@ Core encoding and decoding interfaces. html_root_url = "https://doc.rust-lang.org/nightly/", html_playground_url = "https://play.rust-lang.org/", test(attr(allow(unused_variables), deny(warnings))))] +#![cfg_attr(not(stage0), deny(warnings))] #![feature(box_syntax)] #![feature(collections)] diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index 41001153c3c..585051a98e5 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -16,7 +16,6 @@ reason = "API has not been scrutinized and is highly likely to \ either disappear or change", issue = "27810")] -#![rustc_deprecated(since = "1.5.0", reason = "replaced with 'dylib' on crates.io")] #![allow(missing_docs)] #![allow(deprecated)] @@ -26,6 +25,11 @@ use env; use ffi::{CString, OsString}; use path::{Path, PathBuf}; +#[unstable(feature = "dynamic_lib", + reason = "API has not been scrutinized and is highly likely to \ + either disappear or change", + issue = "27810")] +#[rustc_deprecated(since = "1.5.0", reason = "replaced with 'dylib' on crates.io")] pub struct DynamicLibrary { handle: *mut u8 } @@ -43,6 +47,11 @@ impl Drop for DynamicLibrary { } } +#[unstable(feature = "dynamic_lib", + reason = "API has not been scrutinized and is highly likely to \ + either disappear or change", + issue = "27810")] +#[rustc_deprecated(since = "1.5.0", reason = "replaced with 'dylib' on crates.io")] impl DynamicLibrary { /// Lazily open a dynamic library. When passed None it gives a /// handle to the calling process @@ -126,7 +135,6 @@ mod tests { use prelude::v1::*; use libc; use mem; - use path::Path; #[test] #[cfg_attr(any(windows, @@ -167,6 +175,8 @@ mod tests { target_os = "openbsd"))] #[allow(deprecated)] fn test_errors_do_not_crash() { + use path::Path; + // Open /dev/null as a library to get an error, and make sure // that only causes an error, and not a crash. let path = Path::new("/dev/null"); diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 5ec51eaa567..ccebf3682c2 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -1095,8 +1095,8 @@ mod tests { thread::spawn(|| { let mut writer = BufWriter::new(PanicWriter); - writer.write(b"hello world"); - writer.flush(); + let _ = writer.write(b"hello world"); + let _ = writer.flush(); }).join().err().unwrap(); assert_eq!(WRITES.load(Ordering::SeqCst), 1); diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index e7bcdcc785f..416c01b539f 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -274,6 +274,7 @@ #![deny(missing_docs)] #![allow(unused_features)] // std may use features in a platform-specific way +#![cfg_attr(not(stage0), deny(warnings))] #[cfg(test)] extern crate test; #[cfg(test)] #[macro_use] extern crate log; diff --git a/src/libstd/os/raw.rs b/src/libstd/os/raw.rs index 62080fee48e..31d889fd422 100644 --- a/src/libstd/os/raw.rs +++ b/src/libstd/os/raw.rs @@ -68,6 +68,7 @@ pub enum c_void { } #[cfg(test)] +#[allow(unused_imports)] mod tests { use any::TypeId; use libc; diff --git a/src/libstd/path.rs b/src/libstd/path.rs index e398a5a28c9..207c4d02e48 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -3326,11 +3326,13 @@ mod tests { "{:?}.ends_with({:?}), expected {:?}, got {:?}", $path1, $path2, $ends_with, ends_with); - let relative_from = path1.relative_from(path2).map(|p| p.to_str().unwrap()); + let relative_from = path1.strip_prefix(path2) + .map(|p| p.to_str().unwrap()) + .ok(); let exp: Option<&str> = $relative_from; assert!(relative_from == exp, - "{:?}.relative_from({:?}), expected {:?}, got {:?}", $path1, $path2, - exp, relative_from); + "{:?}.strip_prefix({:?}), expected {:?}, got {:?}", + $path1, $path2, exp, relative_from); }); ); diff --git a/src/libstd/process.rs b/src/libstd/process.rs index be1fe9b2a9b..7197dfa8b2d 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -618,8 +618,8 @@ mod tests { // FIXME(#10380) these tests should not all be ignored on android. - #[cfg(not(target_os="android"))] #[test] + #[cfg_attr(target_os = "android", ignore)] fn smoke() { let p = Command::new("true").spawn(); assert!(p.is_ok()); @@ -627,8 +627,8 @@ mod tests { assert!(p.wait().unwrap().success()); } - #[cfg(not(target_os="android"))] #[test] + #[cfg_attr(target_os = "android", ignore)] fn smoke_failure() { match Command::new("if-this-is-a-binary-then-the-world-has-ended").spawn() { Ok(..) => panic!(), @@ -636,8 +636,8 @@ mod tests { } } - #[cfg(not(target_os="android"))] #[test] + #[cfg_attr(target_os = "android", ignore)] fn exit_reported_right() { let p = Command::new("false").spawn(); assert!(p.is_ok()); @@ -646,8 +646,9 @@ mod tests { drop(p.wait()); } - #[cfg(all(unix, not(target_os="android")))] #[test] + #[cfg(unix)] + #[cfg_attr(target_os = "android", ignore)] fn signal_reported_right() { use os::unix::process::ExitStatusExt; @@ -674,16 +675,16 @@ mod tests { return ret; } - #[cfg(not(target_os="android"))] #[test] + #[cfg_attr(target_os = "android", ignore)] fn stdout_works() { let mut cmd = Command::new("echo"); cmd.arg("foobar").stdout(Stdio::piped()); assert_eq!(run_output(cmd), "foobar\n"); } - #[cfg(all(unix, not(target_os="android")))] #[test] + #[cfg_attr(any(windows, target_os = "android"), ignore)] fn set_current_dir_works() { let mut cmd = Command::new("/bin/sh"); cmd.arg("-c").arg("pwd") @@ -692,8 +693,8 @@ mod tests { assert_eq!(run_output(cmd), "/\n"); } - #[cfg(all(unix, not(target_os="android")))] #[test] + #[cfg_attr(any(windows, target_os = "android"), ignore)] fn stdin_works() { let mut p = Command::new("/bin/sh") .arg("-c").arg("read line; echo $line") @@ -709,8 +710,9 @@ mod tests { } - #[cfg(all(unix, not(target_os="android")))] #[test] + #[cfg_attr(target_os = "android", ignore)] + #[cfg(unix)] fn uid_works() { use os::unix::prelude::*; use libc; @@ -722,8 +724,9 @@ mod tests { assert!(p.wait().unwrap().success()); } - #[cfg(all(unix, not(target_os="android")))] #[test] + #[cfg_attr(target_os = "android", ignore)] + #[cfg(unix)] fn uid_to_root_fails() { use os::unix::prelude::*; use libc; @@ -734,8 +737,8 @@ mod tests { assert!(Command::new("/bin/ls").uid(0).gid(0).spawn().is_err()); } - #[cfg(not(target_os="android"))] #[test] + #[cfg_attr(target_os = "android", ignore)] fn test_process_status() { let mut status = Command::new("false").status().unwrap(); assert!(status.code() == Some(1)); @@ -752,8 +755,8 @@ mod tests { } } - #[cfg(not(target_os="android"))] #[test] + #[cfg_attr(target_os = "android", ignore)] fn test_process_output_output() { let Output {status, stdout, stderr} = Command::new("echo").arg("hello").output().unwrap(); @@ -764,8 +767,8 @@ mod tests { assert_eq!(stderr, Vec::new()); } - #[cfg(not(target_os="android"))] #[test] + #[cfg_attr(target_os = "android", ignore)] fn test_process_output_error() { let Output {status, stdout, stderr} = Command::new("mkdir").arg(".").output().unwrap(); @@ -775,23 +778,23 @@ mod tests { assert!(!stderr.is_empty()); } - #[cfg(not(target_os="android"))] #[test] + #[cfg_attr(target_os = "android", ignore)] fn test_finish_once() { let mut prog = Command::new("false").spawn().unwrap(); assert!(prog.wait().unwrap().code() == Some(1)); } - #[cfg(not(target_os="android"))] #[test] + #[cfg_attr(target_os = "android", ignore)] fn test_finish_twice() { let mut prog = Command::new("false").spawn().unwrap(); assert!(prog.wait().unwrap().code() == Some(1)); assert!(prog.wait().unwrap().code() == Some(1)); } - #[cfg(not(target_os="android"))] #[test] + #[cfg_attr(target_os = "android", ignore)] fn test_wait_with_output_once() { let prog = Command::new("echo").arg("hello").stdout(Stdio::piped()) .spawn().unwrap(); @@ -821,7 +824,6 @@ mod tests { cmd } - #[cfg(not(target_os="android"))] #[test] fn test_inherit_env() { use env; @@ -830,36 +832,22 @@ mod tests { let output = String::from_utf8(result.stdout).unwrap(); for (ref k, ref v) in env::vars() { + // don't check android RANDOM variables + if cfg!(target_os = "android") && *k == "RANDOM" { + continue + } + // Windows has hidden environment variables whose names start with // equals signs (`=`). Those do not show up in the output of the // `set` command. assert!((cfg!(windows) && k.starts_with("=")) || k.starts_with("DYLD") || - output.contains(&format!("{}={}", *k, *v)), + output.contains(&format!("{}={}", *k, *v)) || + output.contains(&format!("{}='{}'", *k, *v)), "output doesn't contain `{}={}`\n{}", k, v, output); } } - #[cfg(target_os="android")] - #[test] - fn test_inherit_env() { - use env; - - let mut result = env_cmd().output().unwrap(); - let output = String::from_utf8(result.stdout).unwrap(); - - for (ref k, ref v) in env::vars() { - // don't check android RANDOM variables - if *k != "RANDOM".to_string() { - assert!(output.contains(&format!("{}={}", - *k, - *v)) || - output.contains(&format!("{}=\'{}\'", - *k, - *v))); - } - } - } #[test] fn test_override_env() { diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index d743cbb1890..5aa4ce81b8a 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -789,7 +789,7 @@ mod tests { fn fmt_debug_handle() { let (_, rx) = channel::(); let sel = Select::new(); - let mut handle = sel.handle(&rx); + let handle = sel.handle(&rx); assert_eq!(format!("{:?}", handle), "Handle { .. }"); } } diff --git a/src/libstd/sync/semaphore.rs b/src/libstd/sync/semaphore.rs index ac5ce298c5c..dd76444d3ae 100644 --- a/src/libstd/sync/semaphore.rs +++ b/src/libstd/sync/semaphore.rs @@ -12,9 +12,6 @@ reason = "the interaction between semaphores and the acquisition/release \ of resources is currently unclear", issue = "27798")] -#![rustc_deprecated(since = "1.7.0", - reason = "easily confused with system semaphores and not \ - used enough to pull its weight")] #![allow(deprecated)] use ops::Drop; @@ -49,6 +46,13 @@ use sync::{Mutex, Condvar}; /// // Release our initially acquired resource /// sem.release(); /// ``` +#[rustc_deprecated(since = "1.7.0", + reason = "easily confused with system semaphores and not \ + used enough to pull its weight")] +#[unstable(feature = "semaphore", + reason = "the interaction between semaphores and the acquisition/release \ + of resources is currently unclear", + issue = "27798")] pub struct Semaphore { lock: Mutex, cvar: Condvar, @@ -56,10 +60,24 @@ pub struct Semaphore { /// An RAII guard which will release a resource acquired from a semaphore when /// dropped. +#[rustc_deprecated(since = "1.7.0", + reason = "easily confused with system semaphores and not \ + used enough to pull its weight")] +#[unstable(feature = "semaphore", + reason = "the interaction between semaphores and the acquisition/release \ + of resources is currently unclear", + issue = "27798")] pub struct SemaphoreGuard<'a> { sem: &'a Semaphore, } +#[rustc_deprecated(since = "1.7.0", + reason = "easily confused with system semaphores and not \ + used enough to pull its weight")] +#[unstable(feature = "semaphore", + reason = "the interaction between semaphores and the acquisition/release \ + of resources is currently unclear", + issue = "27798")] impl Semaphore { /// Creates a new semaphore with the initial count specified. /// diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index 9771b057d8d..2e89becfa67 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -8,14 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(missing_docs)] -#![allow(non_camel_case_types)] +#![allow(missing_docs, bad_style)] use io::{self, ErrorKind}; use libc; use num::One; use ops::Neg; -use alloc::oom; #[cfg(target_os = "android")] pub use os::android as platform; #[cfg(target_os = "bitrig")] pub use os::bitrig as platform; @@ -46,25 +44,10 @@ pub mod thread_local; pub mod time; pub mod stdio; -// A nicer handler for out-of-memory situations than the default one. This one -// prints a message to stderr before aborting. It is critical that this code -// does not allocate any memory since we are in an OOM situation. Any errors are -// ignored while printing since there's nothing we can do about them and we are -// about to exit anyways. -fn oom_handler() -> ! { - use intrinsics; - let msg = "fatal runtime error: out of memory\n"; - unsafe { - libc::write(libc::STDERR_FILENO, - msg.as_ptr() as *const libc::c_void, - msg.len() as libc::size_t); - intrinsics::abort(); - } -} - -#[cfg(not(any(target_os = "nacl", test)))] +#[cfg(not(test))] pub fn init() { - use libc::signal; + use alloc::oom; + // By default, some platforms will send a *signal* when an EPIPE error // would otherwise be delivered. This runtime doesn't install a SIGPIPE // handler, causing it to kill the program, which isn't exactly what we @@ -73,15 +56,33 @@ pub fn init() { // Hence, we set SIGPIPE to ignore when the program starts up in order // to prevent this problem. unsafe { - assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != !0); + reset_sigpipe(); } oom::set_oom_handler(oom_handler); -} -#[cfg(all(target_os = "nacl", not(test)))] -pub fn init() { - oom::set_oom_handler(oom_handler); + // A nicer handler for out-of-memory situations than the default one. This + // one prints a message to stderr before aborting. It is critical that this + // code does not allocate any memory since we are in an OOM situation. Any + // errors are ignored while printing since there's nothing we can do about + // them and we are about to exit anyways. + fn oom_handler() -> ! { + use intrinsics; + let msg = "fatal runtime error: out of memory\n"; + unsafe { + libc::write(libc::STDERR_FILENO, + msg.as_ptr() as *const libc::c_void, + msg.len() as libc::size_t); + intrinsics::abort(); + } + } + + #[cfg(not(target_os = "nacl"))] + unsafe fn reset_sigpipe() { + assert!(libc::signal(libc::SIGPIPE, libc::SIG_IGN) != !0); + } + #[cfg(target_os = "nacl")] + unsafe fn reset_sigpipe() {} } pub fn decode_error_kind(errno: i32) -> ErrorKind { diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs index fc49f4257be..c7614db3299 100644 --- a/src/libstd/sys/unix/stack_overflow.rs +++ b/src/libstd/sys/unix/stack_overflow.rs @@ -7,6 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. + #![cfg_attr(test, allow(dead_code))] use libc; diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 4d715b579c6..9e28cf06d61 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(dead_code)] - use prelude::v1::*; use alloc::boxed::FnBox; @@ -174,6 +172,7 @@ impl Drop for Thread { not(target_os = "bitrig"), not(all(target_os = "netbsd", not(target_vendor = "rumprun"))), not(target_os = "openbsd")))] +#[cfg_attr(test, allow(dead_code))] pub mod guard { pub unsafe fn current() -> Option { None } pub unsafe fn init() -> Option { None } @@ -185,15 +184,13 @@ pub mod guard { target_os = "bitrig", all(target_os = "netbsd", not(target_vendor = "rumprun")), target_os = "openbsd"))] -#[allow(unused_imports)] +#[cfg_attr(test, allow(dead_code))] pub mod guard { use prelude::v1::*; - use libc::{self, pthread_t}; + use libc; use libc::mmap; use libc::{PROT_NONE, MAP_PRIVATE, MAP_ANON, MAP_FAILED, MAP_FIXED}; - use mem; - use ptr; use sys::os; #[cfg(any(target_os = "macos", @@ -206,10 +203,10 @@ pub mod guard { #[cfg(any(target_os = "linux", target_os = "android", target_os = "netbsd"))] unsafe fn get_stack_start() -> Option<*mut libc::c_void> { let mut ret = None; - let mut attr: libc::pthread_attr_t = mem::zeroed(); + let mut attr: libc::pthread_attr_t = ::mem::zeroed(); assert_eq!(libc::pthread_attr_init(&mut attr), 0); if libc::pthread_getattr_np(libc::pthread_self(), &mut attr) == 0 { - let mut stackaddr = ptr::null_mut(); + let mut stackaddr = ::ptr::null_mut(); let mut stacksize = 0; assert_eq!(libc::pthread_attr_getstack(&attr, &mut stackaddr, &mut stacksize), 0); @@ -265,7 +262,7 @@ pub mod guard { #[cfg(any(target_os = "openbsd", target_os = "bitrig"))] pub unsafe fn current() -> Option { - let mut current_stack: libc::stack_t = mem::zeroed(); + let mut current_stack: libc::stack_t = ::mem::zeroed(); assert_eq!(libc::pthread_stackseg_np(libc::pthread_self(), &mut current_stack), 0); @@ -282,7 +279,7 @@ pub mod guard { #[cfg(any(target_os = "linux", target_os = "android", target_os = "netbsd"))] pub unsafe fn current() -> Option { let mut ret = None; - let mut attr: libc::pthread_attr_t = mem::zeroed(); + let mut attr: libc::pthread_attr_t = ::mem::zeroed(); assert_eq!(libc::pthread_attr_init(&mut attr), 0); if libc::pthread_getattr_np(libc::pthread_self(), &mut attr) == 0 { let mut guardsize = 0; @@ -290,7 +287,7 @@ pub mod guard { if guardsize == 0 { panic!("there is no guard page"); } - let mut stackaddr = ptr::null_mut(); + let mut stackaddr = ::ptr::null_mut(); let mut size = 0; assert_eq!(libc::pthread_attr_getstack(&attr, &mut stackaddr, &mut size), 0); diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs index 60e3f7c22bd..a8b82ef5f29 100644 --- a/src/libstd/sys/windows/fs.rs +++ b/src/libstd/sys/windows/fs.rs @@ -639,7 +639,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result { fn directory_junctions_are_directories() { use ffi::OsStr; use env; - use rand::{self, StdRng, Rng}; + use rand::{self, Rng}; use vec::Vec; macro_rules! t { @@ -683,7 +683,7 @@ fn directory_junctions_are_directories() { let mut data = [0u8; c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; let mut db = data.as_mut_ptr() as *mut c::REPARSE_MOUNTPOINT_DATA_BUFFER; - let mut buf = &mut (*db).ReparseTarget as *mut _; + let buf = &mut (*db).ReparseTarget as *mut _; let mut i = 0; let v = br"\??\"; let v = v.iter().map(|x| *x as u16); diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index 16c4ae8257c..9ecef5ee92c 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -8,9 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] +#![allow(missing_docs, bad_style)] use prelude::v1::*; @@ -20,7 +18,6 @@ use num::Zero; use os::windows::ffi::{OsStrExt, OsStringExt}; use path::PathBuf; use time::Duration; -use alloc::oom; #[macro_use] pub mod compat; @@ -43,25 +40,26 @@ pub mod thread_local; pub mod time; pub mod stdio; -// See comment in sys/unix/mod.rs -fn oom_handler() -> ! { - use intrinsics; - use ptr; - let msg = "fatal runtime error: out of memory\n"; - unsafe { - // WriteFile silently fails if it is passed an invalid handle, so there - // is no need to check the result of GetStdHandle. - c::WriteFile(c::GetStdHandle(c::STD_ERROR_HANDLE), - msg.as_ptr() as c::LPVOID, - msg.len() as c::DWORD, - ptr::null_mut(), - ptr::null_mut()); - intrinsics::abort(); - } -} - +#[cfg(not(test))] pub fn init() { - oom::set_oom_handler(oom_handler); + ::alloc::oom::set_oom_handler(oom_handler); + + // See comment in sys/unix/mod.rs + fn oom_handler() -> ! { + use intrinsics; + use ptr; + let msg = "fatal runtime error: out of memory\n"; + unsafe { + // WriteFile silently fails if it is passed an invalid handle, so + // there is no need to check the result of GetStdHandle. + c::WriteFile(c::GetStdHandle(c::STD_ERROR_HANDLE), + msg.as_ptr() as c::LPVOID, + msg.len() as c::DWORD, + ptr::null_mut(), + ptr::null_mut()); + intrinsics::abort(); + } + } } pub fn decode_error_kind(errno: i32) -> ErrorKind { diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index 61f73b00265..8b17a053162 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -391,7 +391,6 @@ impl Stdio { #[cfg(test)] mod tests { use prelude::v1::*; - use str; use ffi::{OsStr, OsString}; use super::make_command_line; diff --git a/src/libstd/sys/windows/stack_overflow.rs b/src/libstd/sys/windows/stack_overflow.rs index 01317bec0de..4a406d70e63 100644 --- a/src/libstd/sys/windows/stack_overflow.rs +++ b/src/libstd/sys/windows/stack_overflow.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![cfg_attr(test, allow(dead_code))] + use sys_common::util::report_overflow; use sys::c; diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs index 1ba85867563..b18772c0c24 100644 --- a/src/libstd/sys/windows/thread.rs +++ b/src/libstd/sys/windows/thread.rs @@ -83,6 +83,7 @@ impl Thread { pub fn into_handle(self) -> Handle { self.handle } } +#[cfg_attr(test, allow(dead_code))] pub mod guard { pub unsafe fn current() -> Option { None } pub unsafe fn init() -> Option { None } diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 795f4044f6e..d7d3e576a61 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -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(associated_consts)] #![feature(filling_drop)] diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index fe54651590f..e80297eb797 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -3149,7 +3149,6 @@ mod tests { use super::*; use ast; - use ast_util; use codemap; use parse::token; diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index 0f049fa9792..97531d4279d 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -11,13 +11,13 @@ //! Syntax extensions in the Rust compiler. #![crate_name = "syntax_ext"] +#![unstable(feature = "rustc_private", issue = "27812")] #![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/")] - -#![unstable(feature = "rustc_private", issue = "27812")] +#![cfg_attr(not(stage0), deny(warnings))] #![feature(rustc_private)] #![feature(staged_api)] diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index df1fedf3d4e..771e2470455 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -52,6 +52,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(staged_api)] diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index ac5b235854a..130ce3a9637 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -31,6 +31,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(asm)] #![feature(box_syntax)]