提交 96bcdac9 编写于 作者: V Vadim Petrochenkov

Make sufficiently old or low-impact compatibility lints deny-by-default

上级 affb8ee8
......@@ -144,20 +144,20 @@
declare_lint! {
pub RESOLVE_TRAIT_ON_DEFAULTED_UNIT,
Warn,
Deny,
"attempt to resolve a trait on an expression whose type cannot be inferred but which \
currently defaults to ()"
}
declare_lint! {
pub SAFE_EXTERN_STATICS,
Warn,
Deny,
"safe access to extern statics was erroneously allowed"
}
declare_lint! {
pub PATTERNS_IN_FNS_WITHOUT_BODY,
Warn,
Deny,
"patterns in functions without body were erroneously allowed"
}
......@@ -169,14 +169,14 @@
declare_lint! {
pub LEGACY_DIRECTORY_OWNERSHIP,
Warn,
Deny,
"non-inline, non-`#[path]` modules (e.g. `mod foo;`) were erroneously allowed in some files \
not named `mod.rs`"
}
declare_lint! {
pub LEGACY_IMPORTS,
Warn,
Deny,
"detects names that resolve to ambiguous glob imports with RFC 1560"
}
......@@ -188,13 +188,13 @@
declare_lint! {
pub MISSING_FRAGMENT_SPECIFIER,
Warn,
Deny,
"detects missing fragment specifiers in unused `macro_rules!` patterns"
}
declare_lint! {
pub PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
Warn,
Deny,
"detects parenthesized generic parameters in type and module names"
}
......
......@@ -8,9 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(dead_code)]
#![allow(unreachable_code)]
#![deny(resolve_trait_on_defaulted_unit)]
#![allow(unused)]
trait Deserialize: Sized {
fn deserialize() -> Result<Self, String>;
......@@ -38,4 +36,3 @@ fn smeg() {
fn main() {
smeg();
}
......@@ -10,12 +10,8 @@
// error-pattern: cannot declare a new module at this location
// error-pattern: will become a hard error
// error-pattern: compilation successful
#![feature(rustc_attrs)]
#[path="mod_file_not_owning_aux3.rs"]
mod foo;
#[rustc_error]
fn main() {}
......@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#![allow(unused)]
pub struct Foo;
......@@ -20,12 +19,11 @@ mod baz {
use *; //~ NOTE `Foo` could refer to the name imported here
use bar::*; //~ NOTE `Foo` could also refer to the name imported here
fn f(_: Foo) {}
//~^ WARN `Foo` is ambiguous
//~^ ERROR `Foo` is ambiguous
//~| WARN hard error in a future release
//~| NOTE see issue #38260
//~| NOTE #[warn(legacy_imports)] on by default
//~| NOTE #[deny(legacy_imports)] on by default
}
}
#[rustc_error]
fn main() {} //~ ERROR compilation successful
fn main() {}
......@@ -8,23 +8,17 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(parenthesized_params_in_types_and_modules)]
//~^ NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
#![allow(dead_code, unused_variables)]
#![feature(conservative_impl_trait)]
#![allow(unused)]
fn main() {
{ fn f<X: ::std::marker()::Send>() {} }
//~^ ERROR parenthesized parameters may only be used with a trait
//~| WARN previously accepted
//~| NOTE issue #42238
{ fn f() -> impl ::std::marker()::Send { } }
//~^ ERROR parenthesized parameters may only be used with a trait
//~| WARN previously accepted
//~| NOTE issue #42238
}
#[derive(Clone)]
......@@ -33,4 +27,3 @@ fn main() {
impl ::std::marker()::Copy for X {}
//~^ ERROR parenthesized parameters may only be used with a trait
//~| WARN previously accepted
//~| NOTE issue #42238
......@@ -8,26 +8,16 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(parenthesized_params_in_types_and_modules)]
//~^ NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
#![allow(dead_code, unused_variables)]
#![allow(unused)]
fn main() {
let x: usize() = 1;
//~^ ERROR parenthesized parameters may only be used with a trait
//~| WARN previously accepted
//~| NOTE issue #42238
let b: ::std::boxed()::Box<_> = Box::new(1);
//~^ ERROR parenthesized parameters may only be used with a trait
//~| WARN previously accepted
//~| NOTE issue #42238
macro_rules! pathexpr {
($p:path) => { $p }
......@@ -36,27 +26,22 @@ fn main() {
let p = pathexpr!(::std::str()::from_utf8)(b"foo").unwrap();
//~^ ERROR parenthesized parameters may only be used with a trait
//~| WARN previously accepted
//~| NOTE issue #42238
let p = pathexpr!(::std::str::from_utf8())(b"foo").unwrap();
//~^ ERROR parenthesized parameters may only be used with a trait
//~| WARN previously accepted
//~| NOTE issue #42238
let o : Box<::std::marker()::Send> = Box::new(1);
//~^ ERROR parenthesized parameters may only be used with a trait
//~| WARN previously accepted
//~| NOTE issue #42238
let o : Box<Send + ::std::marker()::Sync> = Box::new(1);
//~^ ERROR parenthesized parameters may only be used with a trait
//~| WARN previously accepted
//~| NOTE issue #42238
}
fn foo<X:Default>() {
let d : X() = Default::default();
//~^ ERROR parenthesized parameters may only be used with a trait
//~| WARN previously accepted
//~| NOTE issue #42238
}
......@@ -11,7 +11,6 @@
// Test that `fn foo::bar::{self}` only imports `bar` in the type namespace.
#![allow(unused)]
#![deny(legacy_imports)]
mod foo {
pub fn f() { }
......
......@@ -8,12 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(missing_fragment_specifier)] //~ NOTE lint level defined here
#![allow(unused_macros)]
#![allow(unused)]
macro_rules! m { ($i) => {} }
//~^ ERROR missing fragment specifier
//~| WARN previously accepted
//~| NOTE issue #40107
fn main() {}
......@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(patterns_in_fns_without_body)]
trait Tr {
fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in methods without bodies
//~^ WARN was previously accepted
......@@ -17,6 +15,7 @@ trait Tr {
//~^ WARN was previously accepted
fn g1(arg: u8); // OK
fn g2(_: u8); // OK
#[allow(anonymous_parameters)]
fn g3(u8); // OK
}
......
......@@ -10,9 +10,6 @@
// aux-build:extern-statics.rs
#![allow(unused)]
#![deny(safe_extern_statics)]
extern crate extern_statics;
use extern_statics::*;
......
......@@ -11,7 +11,6 @@
// aux-build:extern-statics.rs
#![allow(unused)]
#![deny(safe_extern_statics)]
extern crate extern_statics;
use extern_statics::*;
......
......@@ -10,7 +10,6 @@
// gate-test-default_type_parameter_fallback
#![deny(invalid_type_param_default)]
#![allow(unused)]
fn avg<T=i32>(_: T) {}
......
......@@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(dead_code)]
#![deny(extra_requirement_in_impl)]
// Test that we elaborate `Type: 'region` constraints and infer various important things.
trait Master<'a, T: ?Sized, U> {
......
error[E0276]: impl has stricter requirements than trait
--> $DIR/proj-outlives-region.rs:22:5
--> $DIR/proj-outlives-region.rs:19:5
|
17 | fn foo() where T: 'a;
14 | fn foo() where T: 'a;
| --------------------- definition of `foo` from trait
...
22 | fn foo() where U: 'a { } //~ ERROR E0276
19 | fn foo() where U: 'a { } //~ ERROR E0276
| ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a`
|
= note: #[deny(extra_requirement_in_impl)] on by default
......
......@@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(dead_code)]
#![deny(extra_requirement_in_impl)]
// Test that you cannot add an extra where clause in the impl relating
// two regions.
......
error[E0276]: impl has stricter requirements than trait
--> $DIR/region-extra.rs:22:5
--> $DIR/region-extra.rs:19:5
|
18 | fn foo();
15 | fn foo();
| --------- definition of `foo` from trait
...
22 | fn foo() where 'a: 'b { }
19 | fn foo() where 'a: 'b { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b`
error: aborting due to previous error
......
......@@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(dead_code)]
#![deny(extra_requirement_in_impl)]
// Test that we elaborate `Type: 'region` constraints and infer various important things.
trait Master<'a, T: ?Sized, U> {
......
error[E0276]: impl has stricter requirements than trait
--> $DIR/region-unrelated.rs:22:5
--> $DIR/region-unrelated.rs:19:5
|
17 | fn foo() where T: 'a;
14 | fn foo() where T: 'a;
| --------------------- definition of `foo` from trait
...
22 | fn foo() where V: 'a { }
19 | fn foo() where V: 'a { }
| ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `V: 'a`
|
= note: #[deny(extra_requirement_in_impl)] on by default
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册