]> git.lizzy.rs Git - rust.git/commitdiff
Make sufficiently old or low-impact compatibility lints deny-by-default
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Thu, 27 Oct 2016 09:06:03 +0000 (12:06 +0300)
src/librustc/lint/builtin.rs
src/librustc_const_eval/diagnostics.rs
src/librustc_lint/lib.rs
src/test/compile-fail/extern-crate-visibility.rs
src/test/compile-fail/inherent-overlap.rs
src/test/compile-fail/issue-6804.rs
src/test/compile-fail/lifetime-underscore.rs
src/test/compile-fail/use-super-global-path.rs
src/test/run-pass/type-macros-simple.rs

index 7fc3f638979ff4a671608a6ba2a66205f265d908..4ef42bb68eb6afab1c36c9ff75671d609268b0da 100644 (file)
 
 declare_lint! {
     pub INACCESSIBLE_EXTERN_CRATE,
-    Warn,
+    Deny,
     "use of inaccessible extern crate erroneously allowed"
 }
 
 declare_lint! {
     pub INVALID_TYPE_PARAM_DEFAULT,
-    Warn,
+    Deny,
     "type parameter default erroneously allowed in invalid location"
 }
 
 declare_lint! {
     pub ILLEGAL_FLOATING_POINT_CONSTANT_PATTERN,
-    Warn,
+    Deny,
     "floating-point constants cannot be used in patterns"
 }
 
 declare_lint! {
     pub ILLEGAL_STRUCT_OR_ENUM_CONSTANT_PATTERN,
-    Warn,
+    Deny,
     "constants of struct or enum type can only be used in a pattern if \
      the struct or enum has `#[derive(PartialEq, Eq)]`"
 }
 
 declare_lint! {
     pub OVERLAPPING_INHERENT_IMPLS,
-    Warn,
+    Deny,
     "two overlapping inherent impls define an item with the same name were erroneously allowed"
 }
 
 
 declare_lint! {
     pub SUPER_OR_SELF_IN_GLOBAL_PATH,
-    Warn,
+    Deny,
     "detects super or self keywords at the beginning of global path"
 }
 
 declare_lint! {
     pub LIFETIME_UNDERSCORE,
-    Warn,
+    Deny,
     "lifetimes or labels named `'_` were erroneously allowed"
 }
 
index f70583db70a60e483c1f8b145f631fac99c793d4..092638cdee260c72e4924a434eaf31e637e69e5e 100644 (file)
@@ -76,8 +76,6 @@ fn foo(x: Option<String>) {
 match the input to a match expression. So, the following will not compile:
 
 ```compile_fail
-#![deny(illegal_floating_point_constant_pattern)]
-
 const NAN: f32 = 0.0 / 0.0;
 
 let number = 0.1f32;
index 74483b89cea22f1671b75cc8840dbe6cd79cba55..061f6318c2a2ee1a634e0f4ea876bf0edd509eeb 100644 (file)
@@ -174,15 +174,15 @@ macro_rules! add_lint_group {
         },
         FutureIncompatibleInfo {
             id: LintId::of(INACCESSIBLE_EXTERN_CRATE),
-            reference: "PR 31362 <https://github.com/rust-lang/rust/pull/31362>",
+            reference: "issue #36886 <https://github.com/rust-lang/rust/issues/36886>",
         },
         FutureIncompatibleInfo {
             id: LintId::of(INVALID_TYPE_PARAM_DEFAULT),
-            reference: "PR 30724 <https://github.com/rust-lang/rust/pull/30724>",
+            reference: "issue #36887 <https://github.com/rust-lang/rust/issues/36887>",
         },
         FutureIncompatibleInfo {
             id: LintId::of(SUPER_OR_SELF_IN_GLOBAL_PATH),
-            reference: "PR #32403 <https://github.com/rust-lang/rust/pull/32403>",
+            reference: "issue #36888 <https://github.com/rust-lang/rust/issues/36888>",
         },
         FutureIncompatibleInfo {
             id: LintId::of(TRANSMUTE_FROM_FN_ITEM_TYPES),
@@ -190,15 +190,15 @@ macro_rules! add_lint_group {
         },
         FutureIncompatibleInfo {
             id: LintId::of(OVERLAPPING_INHERENT_IMPLS),
-            reference: "issue #22889 <https://github.com/rust-lang/rust/issues/22889>",
+            reference: "issue #36889 <https://github.com/rust-lang/rust/issues/36889>",
         },
         FutureIncompatibleInfo {
             id: LintId::of(ILLEGAL_FLOATING_POINT_CONSTANT_PATTERN),
-            reference: "RFC 1445 <https://github.com/rust-lang/rfcs/pull/1445>",
+            reference: "issue #36890 <https://github.com/rust-lang/rust/issues/36890>",
         },
         FutureIncompatibleInfo {
             id: LintId::of(ILLEGAL_STRUCT_OR_ENUM_CONSTANT_PATTERN),
-            reference: "RFC 1445 <https://github.com/rust-lang/rfcs/pull/1445>",
+            reference: "issue #36891 <https://github.com/rust-lang/rust/issues/36891>",
         },
         FutureIncompatibleInfo {
             id: LintId::of(HR_LIFETIME_IN_ASSOC_TYPE),
@@ -206,11 +206,11 @@ macro_rules! add_lint_group {
         },
         FutureIncompatibleInfo {
             id: LintId::of(LIFETIME_UNDERSCORE),
-            reference: "RFC 1177 <https://github.com/rust-lang/rfcs/pull/1177>",
+            reference: "issue #36892 <https://github.com/rust-lang/rust/issues/36892>",
         },
         FutureIncompatibleInfo {
             id: LintId::of(SAFE_EXTERN_STATICS),
-            reference: "issue 36247 <https://github.com/rust-lang/rust/issues/35112>",
+            reference: "issue #36247 <https://github.com/rust-lang/rust/issues/35112>",
         },
         ]);
 
index 86aae47214804b28888f106310b8e8099354dd29..81e0cb249f382f91250f451ec60444d5dcc29637 100644 (file)
@@ -8,9 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
-#![allow(dead_code)]
-#![allow(unused_imports)]
+#![allow(unused)]
 
 mod foo {
     extern crate core;
@@ -19,11 +17,11 @@ mod foo {
 // Check that private crates can be used from outside their modules, albeit with warnings
 use foo::core; //~ WARN extern crate `core` is private
 //~^ WARN this was previously accepted by the compiler but is being phased out
-use foo::core::cell; //~ WARN extern crate `core` is private
+use foo::core::cell; //~ ERROR extern crate `core` is private
 //~^ WARN this was previously accepted by the compiler but is being phased out
 
 fn f() {
-    foo::core::cell::Cell::new(0); //~ WARN extern crate `core` is private
+    foo::core::cell::Cell::new(0); //~ ERROR extern crate `core` is private
     //~^ WARN this was previously accepted by the compiler but is being phased out
 
     use foo::*;
@@ -39,5 +37,4 @@ mod baz {
     use self::core::cell; // Check that public extern crates are glob imported
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+fn main() {}
index 333a4ee04b27becd0319463b9a1a9a745939ba34..00d41244639f55f0b42ae92e6d4cc1f3dd5f623c 100644 (file)
 // Test that you cannot define items with the same name in overlapping inherent
 // impl blocks.
 
-#![feature(rustc_attrs)]
-#![allow(dead_code)]
+#![allow(unused)]
 
 struct Foo;
 
 impl Foo {
-    fn id() {} //~ WARN duplicate definitions
+    fn id() {} //~ ERROR duplicate definitions
     //~^ WARN previously accepted
 }
 
@@ -28,7 +27,7 @@ fn id() {}
 struct Bar<T>(T);
 
 impl<T> Bar<T> {
-    fn bar(&self) {} //~ WARN duplicate definitions
+    fn bar(&self) {} //~ ERROR duplicate definitions
     //~^ WARN previously accepted
 }
 
@@ -39,7 +38,7 @@ fn bar(&self) {}
 struct Baz<T>(T);
 
 impl<T: Copy> Baz<T> {
-    fn baz(&self) {} //~ WARN duplicate definitions
+    fn baz(&self) {} //~ ERROR duplicate definitions
     //~^ WARN previously accepted
 }
 
@@ -47,5 +46,4 @@ impl<T> Baz<Vec<T>> {
     fn baz(&self) {}
 }
 
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+fn main() {}
index 8f2670725ced7982805c6a937103f7a4de70790c..f7d3ce60c66ccf3573ccfc73323c325decfb8fa6 100644 (file)
@@ -8,16 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
-#![feature(slice_patterns)]
-#![allow(dead_code)]
-#![deny(illegal_floating_point_constant_pattern)]
-
 // Matching against NaN should result in a warning
 
+#![feature(slice_patterns)]
+#![allow(unused)]
+
 use std::f64::NAN;
 
-#[rustc_error]
 fn main() {
     let x = NAN;
     match x {
index 102d3576e5467922bb8afb530b8d8c197f3300df..b768009132ca919f3a046a6c1fb32b8c8ae58f05 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![deny(lifetime_underscore)]
-
 fn _f<'_>() //~ ERROR invalid lifetime name `'_`
 //~^ WARN this was previously accepted
     -> &'_ u8 //~ ERROR invalid lifetime name `'_`
index 1d0d60a775fda7d02699ee2bcf682ea72a1fa92b..3fa0712fb4ca394a7565914e2bec63a7927d57da 100644 (file)
@@ -8,22 +8,20 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rustc_attrs)]
-#![allow(unused_imports, dead_code)]
+#![allow(unused)]
 
 struct S;
 struct Z;
 
 mod foo {
-    use ::super::{S, Z}; //~ WARN global paths cannot start with `super`
+    use ::super::{S, Z}; //~ ERROR global paths cannot start with `super`
     //~^ WARN this was previously accepted by the compiler but is being phased out
 
     pub fn g() {
-        use ::super::main; //~ WARN global paths cannot start with `super`
+        use ::super::main; //~ ERROR global paths cannot start with `super`
         //~^ WARN this was previously accepted by the compiler but is being phased out
         main();
     }
 }
 
-#[rustc_error]
-fn main() { foo::g(); } //~ ERROR compilation successful
+fn main() { foo::g(); }
index 6b0deff3ba4fa394c82706178ff9d3226e3b3580..c61133f795b345c36676868fb8815d9d86a0b5ef 100644 (file)
@@ -23,7 +23,7 @@ macro_rules! m { () => { i32 } }
 
     let x: m!() = m!();
     std::cell::Cell::<m!()>::new(m!());
-    impl<T = m!()> std::ops::Index<m!()> for Trait<(m!(), T)>
+    impl<T> std::ops::Index<m!()> for Trait<(m!(), T)>
         where T: Trait<m!()>
     {
         type Output = m!();