Skip to content

Commit 96bcdac

Browse files
committed
Make sufficiently old or low-impact compatibility lints deny-by-default
1 parent affb8ee commit 96bcdac

18 files changed

+24
-73
lines changed

src/librustc/lint/builtin.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,20 @@ declare_lint! {
144144

145145
declare_lint! {
146146
pub RESOLVE_TRAIT_ON_DEFAULTED_UNIT,
147-
Warn,
147+
Deny,
148148
"attempt to resolve a trait on an expression whose type cannot be inferred but which \
149149
currently defaults to ()"
150150
}
151151

152152
declare_lint! {
153153
pub SAFE_EXTERN_STATICS,
154-
Warn,
154+
Deny,
155155
"safe access to extern statics was erroneously allowed"
156156
}
157157

158158
declare_lint! {
159159
pub PATTERNS_IN_FNS_WITHOUT_BODY,
160-
Warn,
160+
Deny,
161161
"patterns in functions without body were erroneously allowed"
162162
}
163163

@@ -169,14 +169,14 @@ declare_lint! {
169169

170170
declare_lint! {
171171
pub LEGACY_DIRECTORY_OWNERSHIP,
172-
Warn,
172+
Deny,
173173
"non-inline, non-`#[path]` modules (e.g. `mod foo;`) were erroneously allowed in some files \
174174
not named `mod.rs`"
175175
}
176176

177177
declare_lint! {
178178
pub LEGACY_IMPORTS,
179-
Warn,
179+
Deny,
180180
"detects names that resolve to ambiguous glob imports with RFC 1560"
181181
}
182182

@@ -188,13 +188,13 @@ declare_lint! {
188188

189189
declare_lint! {
190190
pub MISSING_FRAGMENT_SPECIFIER,
191-
Warn,
191+
Deny,
192192
"detects missing fragment specifiers in unused `macro_rules!` patterns"
193193
}
194194

195195
declare_lint! {
196196
pub PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
197-
Warn,
197+
Deny,
198198
"detects parenthesized generic parameters in type and module names"
199199
}
200200

src/test/compile-fail/defaulted-unit-warning.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![allow(dead_code)]
12-
#![allow(unreachable_code)]
13-
#![deny(resolve_trait_on_defaulted_unit)]
11+
#![allow(unused)]
1412

1513
trait Deserialize: Sized {
1614
fn deserialize() -> Result<Self, String>;
@@ -38,4 +36,3 @@ fn smeg() {
3836
fn main() {
3937
smeg();
4038
}
41-

src/test/compile-fail/directory_ownership/backcompat-warnings.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@
1010

1111
// error-pattern: cannot declare a new module at this location
1212
// error-pattern: will become a hard error
13-
// error-pattern: compilation successful
14-
15-
#![feature(rustc_attrs)]
1613

1714
#[path="mod_file_not_owning_aux3.rs"]
1815
mod foo;
1916

20-
#[rustc_error]
2117
fn main() {}

src/test/compile-fail/imports/rfc-1560-warning-cycle.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(rustc_attrs)]
1211
#![allow(unused)]
1312

1413
pub struct Foo;
@@ -20,12 +19,11 @@ mod bar {
2019
use *; //~ NOTE `Foo` could refer to the name imported here
2120
use bar::*; //~ NOTE `Foo` could also refer to the name imported here
2221
fn f(_: Foo) {}
23-
//~^ WARN `Foo` is ambiguous
22+
//~^ ERROR `Foo` is ambiguous
2423
//~| WARN hard error in a future release
2524
//~| NOTE see issue #38260
26-
//~| NOTE #[warn(legacy_imports)] on by default
25+
//~| NOTE #[deny(legacy_imports)] on by default
2726
}
2827
}
2928

30-
#[rustc_error]
31-
fn main() {} //~ ERROR compilation successful
29+
fn main() {}

src/test/compile-fail/issue-32995-2.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,17 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(parenthesized_params_in_types_and_modules)]
12-
//~^ NOTE lint level defined here
13-
//~| NOTE lint level defined here
14-
//~| NOTE lint level defined here
15-
#![allow(dead_code, unused_variables)]
1611
#![feature(conservative_impl_trait)]
12+
#![allow(unused)]
1713

1814
fn main() {
1915
{ fn f<X: ::std::marker()::Send>() {} }
2016
//~^ ERROR parenthesized parameters may only be used with a trait
2117
//~| WARN previously accepted
22-
//~| NOTE issue #42238
2318

2419
{ fn f() -> impl ::std::marker()::Send { } }
2520
//~^ ERROR parenthesized parameters may only be used with a trait
2621
//~| WARN previously accepted
27-
//~| NOTE issue #42238
2822
}
2923

3024
#[derive(Clone)]
@@ -33,4 +27,3 @@ struct X;
3327
impl ::std::marker()::Copy for X {}
3428
//~^ ERROR parenthesized parameters may only be used with a trait
3529
//~| WARN previously accepted
36-
//~| NOTE issue #42238

src/test/compile-fail/issue-32995.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,16 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(parenthesized_params_in_types_and_modules)]
12-
//~^ NOTE lint level defined here
13-
//~| NOTE lint level defined here
14-
//~| NOTE lint level defined here
15-
//~| NOTE lint level defined here
16-
//~| NOTE lint level defined here
17-
//~| NOTE lint level defined here
18-
//~| NOTE lint level defined here
19-
#![allow(dead_code, unused_variables)]
11+
#![allow(unused)]
2012

2113
fn main() {
2214
let x: usize() = 1;
2315
//~^ ERROR parenthesized parameters may only be used with a trait
2416
//~| WARN previously accepted
25-
//~| NOTE issue #42238
2617

2718
let b: ::std::boxed()::Box<_> = Box::new(1);
2819
//~^ ERROR parenthesized parameters may only be used with a trait
2920
//~| WARN previously accepted
30-
//~| NOTE issue #42238
3121

3222
macro_rules! pathexpr {
3323
($p:path) => { $p }
@@ -36,27 +26,22 @@ fn main() {
3626
let p = pathexpr!(::std::str()::from_utf8)(b"foo").unwrap();
3727
//~^ ERROR parenthesized parameters may only be used with a trait
3828
//~| WARN previously accepted
39-
//~| NOTE issue #42238
4029

4130
let p = pathexpr!(::std::str::from_utf8())(b"foo").unwrap();
4231
//~^ ERROR parenthesized parameters may only be used with a trait
4332
//~| WARN previously accepted
44-
//~| NOTE issue #42238
4533

4634
let o : Box<::std::marker()::Send> = Box::new(1);
4735
//~^ ERROR parenthesized parameters may only be used with a trait
4836
//~| WARN previously accepted
49-
//~| NOTE issue #42238
5037

5138
let o : Box<Send + ::std::marker()::Sync> = Box::new(1);
5239
//~^ ERROR parenthesized parameters may only be used with a trait
5340
//~| WARN previously accepted
54-
//~| NOTE issue #42238
5541
}
5642

5743
fn foo<X:Default>() {
5844
let d : X() = Default::default();
5945
//~^ ERROR parenthesized parameters may only be used with a trait
6046
//~| WARN previously accepted
61-
//~| NOTE issue #42238
6247
}

src/test/compile-fail/issue-38293.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// Test that `fn foo::bar::{self}` only imports `bar` in the type namespace.
1212

1313
#![allow(unused)]
14-
#![deny(legacy_imports)]
1514

1615
mod foo {
1716
pub fn f() { }

src/test/compile-fail/issue-39404.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(missing_fragment_specifier)] //~ NOTE lint level defined here
12-
#![allow(unused_macros)]
11+
#![allow(unused)]
1312

1413
macro_rules! m { ($i) => {} }
1514
//~^ ERROR missing fragment specifier
1615
//~| WARN previously accepted
17-
//~| NOTE issue #40107
1816

1917
fn main() {}

src/test/compile-fail/no-patterns-in-args-2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(patterns_in_fns_without_body)]
12-
1311
trait Tr {
1412
fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in methods without bodies
1513
//~^ WARN was previously accepted
1614
fn f2(&arg: u8); //~ ERROR patterns aren't allowed in methods without bodies
1715
//~^ WARN was previously accepted
1816
fn g1(arg: u8); // OK
1917
fn g2(_: u8); // OK
18+
#[allow(anonymous_parameters)]
2019
fn g3(u8); // OK
2120
}
2221

src/test/compile-fail/safe-extern-statics-mut.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010

1111
// aux-build:extern-statics.rs
1212

13-
#![allow(unused)]
14-
#![deny(safe_extern_statics)]
15-
1613
extern crate extern_statics;
1714
use extern_statics::*;
1815

src/test/compile-fail/safe-extern-statics.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// aux-build:extern-statics.rs
1212

1313
#![allow(unused)]
14-
#![deny(safe_extern_statics)]
1514

1615
extern crate extern_statics;
1716
use extern_statics::*;

src/test/compile-fail/type-parameter-invalid-lint.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// gate-test-default_type_parameter_fallback
1212

13-
#![deny(invalid_type_param_default)]
1413
#![allow(unused)]
1514

1615
fn avg<T=i32>(_: T) {}

src/test/ui/compare-method/proj-outlives-region.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![allow(dead_code)]
12-
#![deny(extra_requirement_in_impl)]
13-
1411
// Test that we elaborate `Type: 'region` constraints and infer various important things.
1512

1613
trait Master<'a, T: ?Sized, U> {

src/test/ui/compare-method/proj-outlives-region.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
error[E0276]: impl has stricter requirements than trait
2-
--> $DIR/proj-outlives-region.rs:22:5
2+
--> $DIR/proj-outlives-region.rs:19:5
33
|
4-
17 | fn foo() where T: 'a;
4+
14 | fn foo() where T: 'a;
55
| --------------------- definition of `foo` from trait
66
...
7-
22 | fn foo() where U: 'a { } //~ ERROR E0276
7+
19 | fn foo() where U: 'a { } //~ ERROR E0276
88
| ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a`
99
|
1010
= note: #[deny(extra_requirement_in_impl)] on by default

src/test/ui/compare-method/region-extra.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![allow(dead_code)]
12-
#![deny(extra_requirement_in_impl)]
13-
1411
// Test that you cannot add an extra where clause in the impl relating
1512
// two regions.
1613

src/test/ui/compare-method/region-extra.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
error[E0276]: impl has stricter requirements than trait
2-
--> $DIR/region-extra.rs:22:5
2+
--> $DIR/region-extra.rs:19:5
33
|
4-
18 | fn foo();
4+
15 | fn foo();
55
| --------- definition of `foo` from trait
66
...
7-
22 | fn foo() where 'a: 'b { }
7+
19 | fn foo() where 'a: 'b { }
88
| ^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b`
99

1010
error: aborting due to previous error

src/test/ui/compare-method/region-unrelated.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![allow(dead_code)]
12-
#![deny(extra_requirement_in_impl)]
13-
1411
// Test that we elaborate `Type: 'region` constraints and infer various important things.
1512

1613
trait Master<'a, T: ?Sized, U> {

src/test/ui/compare-method/region-unrelated.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
error[E0276]: impl has stricter requirements than trait
2-
--> $DIR/region-unrelated.rs:22:5
2+
--> $DIR/region-unrelated.rs:19:5
33
|
4-
17 | fn foo() where T: 'a;
4+
14 | fn foo() where T: 'a;
55
| --------------------- definition of `foo` from trait
66
...
7-
22 | fn foo() where V: 'a { }
7+
19 | fn foo() where V: 'a { }
88
| ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `V: 'a`
99
|
1010
= note: #[deny(extra_requirement_in_impl)] on by default

0 commit comments

Comments
 (0)