Skip to content

Commit 88037a5

Browse files
committed
Add/update tests for 2015, 2018, rustfix
1 parent 3c3c642 commit 88037a5

8 files changed

+75
-75
lines changed
+14-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
// Test that anonymous parameters are disallowed in 2018 edition.
22

3+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
4+
// file at the top-level directory of this distribution and at
5+
// http://rust-lang.org/COPYRIGHT.
6+
//
7+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10+
// option. This file may not be copied, modified, or distributed
11+
// except according to those terms.
12+
13+
// Tests that anonymous parameters are a hard error in edition 2018.
14+
315
// edition:2018
416

517
trait T {
6-
fn foo(i32); //~ ERROR expected identifier
18+
fn foo(i32); //~ expected one of `:` or `@`, found `)`
719

820
fn bar_with_default_impl(String, String) {}
9-
//~^ ERROR expected identifier
10-
//~| ERROR expected identifier
21+
//~^ ERROR expected one of `:` or `@`, found `,`
1122
}
1223

1324
fn main() {}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: expected one of `:` or `@`, found `)`
2+
--> $DIR/anon-params-denied-2018.rs:18:15
3+
|
4+
LL | fn foo(i32); //~ expected one of `:` or `@`, found `)`
5+
| ^ expected one of `:` or `@` here
6+
7+
error: expected one of `:` or `@`, found `,`
8+
--> $DIR/anon-params-denied-2018.rs:20:36
9+
|
10+
LL | fn bar_with_default_impl(String, String) {}
11+
| ^ expected one of `:` or `@` here
12+
13+
error: aborting due to 2 previous errors
14+
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![warn(anonymous_parameters)]
12+
// Test for the anonymous_parameters deprecation lint (RFC 1685)
13+
14+
// compile-pass
15+
// edition:2015
16+
// run-rustfix
17+
18+
trait T {
19+
fn foo(_: i32); //~ WARNING anonymous parameters are deprecated
20+
//~| WARNING hard error
21+
22+
fn bar_with_default_impl(_: String, _: String) {}
23+
//~^ WARNING anonymous parameters are deprecated
24+
//~| WARNING hard error
25+
//~| WARNING anonymous parameters are deprecated
26+
//~| WARNING hard error
27+
}
28+
29+
fn main() {}

src/test/ui/anon-params-deprecated.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,21 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![forbid(anonymous_parameters)]
11+
#![warn(anonymous_parameters)]
1212
// Test for the anonymous_parameters deprecation lint (RFC 1685)
1313

14+
// compile-pass
15+
// edition:2015
16+
// run-rustfix
17+
1418
trait T {
15-
fn foo(i32); //~ ERROR anonymous parameters are deprecated
19+
fn foo(i32); //~ WARNING anonymous parameters are deprecated
1620
//~| WARNING hard error
1721

1822
fn bar_with_default_impl(String, String) {}
19-
//~^ ERROR anonymous parameters are deprecated
23+
//~^ WARNING anonymous parameters are deprecated
2024
//~| WARNING hard error
21-
//~| ERROR anonymous parameters are deprecated
25+
//~| WARNING anonymous parameters are deprecated
2226
//~| WARNING hard error
2327
}
2428

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
1-
error: anonymous parameters are deprecated and will be removed in the next edition.
2-
--> $DIR/anon-params-deprecated.rs:15:12
1+
warning: anonymous parameters are deprecated and will be removed in the next edition.
2+
--> $DIR/anon-params-deprecated.rs:19:12
33
|
4-
LL | fn foo(i32); //~ ERROR anonymous parameters are deprecated
4+
LL | fn foo(i32); //~ WARNING anonymous parameters are deprecated
55
| ^^^ help: Try naming the parameter or explicitly ignoring it: `_: i32`
66
|
77
note: lint level defined here
8-
--> $DIR/anon-params-deprecated.rs:11:11
8+
--> $DIR/anon-params-deprecated.rs:11:9
99
|
10-
LL | #![forbid(anonymous_parameters)]
11-
| ^^^^^^^^^^^^^^^^^^^^
10+
LL | #![warn(anonymous_parameters)]
11+
| ^^^^^^^^^^^^^^^^^^^^
1212
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1313
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
1414

15-
error: anonymous parameters are deprecated and will be removed in the next edition.
16-
--> $DIR/anon-params-deprecated.rs:18:30
15+
warning: anonymous parameters are deprecated and will be removed in the next edition.
16+
--> $DIR/anon-params-deprecated.rs:22:30
1717
|
1818
LL | fn bar_with_default_impl(String, String) {}
1919
| ^^^^^^ help: Try naming the parameter or explicitly ignoring it: `_: String`
2020
|
2121
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2222
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
2323

24-
error: anonymous parameters are deprecated and will be removed in the next edition.
25-
--> $DIR/anon-params-deprecated.rs:18:38
24+
warning: anonymous parameters are deprecated and will be removed in the next edition.
25+
--> $DIR/anon-params-deprecated.rs:22:38
2626
|
2727
LL | fn bar_with_default_impl(String, String) {}
2828
| ^^^^^^ help: Try naming the parameter or explicitly ignoring it: `_: String`
2929
|
3030
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
3131
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
3232

33-
error: aborting due to 3 previous errors
34-

src/test/ui/lint/lint-anon-param-edition.fixed

-23
This file was deleted.

src/test/ui/lint/lint-anon-param-edition.rs

-23
This file was deleted.

src/test/ui/lint/lint-anon-param-edition.stderr

-10
This file was deleted.

0 commit comments

Comments
 (0)