-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add/update tests for 2015, 2018, rustfix
- Loading branch information
Showing
8 changed files
with
75 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
// Test that anonymous parameters are disallowed in 2018 edition. | ||
|
||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// Tests that anonymous parameters are a hard error in edition 2018. | ||
|
||
// edition:2018 | ||
|
||
trait T { | ||
fn foo(i32); //~ ERROR expected identifier | ||
fn foo(i32); //~ expected one of `:` or `@`, found `)` | ||
|
||
fn bar_with_default_impl(String, String) {} | ||
//~^ ERROR expected identifier | ||
//~| ERROR expected identifier | ||
//~^ ERROR expected one of `:` or `@`, found `,` | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: expected one of `:` or `@`, found `)` | ||
--> $DIR/anon-params-denied-2018.rs:18:15 | ||
| | ||
LL | fn foo(i32); //~ expected one of `:` or `@`, found `)` | ||
| ^ expected one of `:` or `@` here | ||
|
||
error: expected one of `:` or `@`, found `,` | ||
--> $DIR/anon-params-denied-2018.rs:20:36 | ||
| | ||
LL | fn bar_with_default_impl(String, String) {} | ||
| ^ expected one of `:` or `@` here | ||
|
||
error: aborting due to 2 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
#![warn(anonymous_parameters)] | ||
// Test for the anonymous_parameters deprecation lint (RFC 1685) | ||
|
||
// compile-pass | ||
// edition:2015 | ||
// run-rustfix | ||
|
||
trait T { | ||
fn foo(_: i32); //~ WARNING anonymous parameters are deprecated | ||
//~| WARNING hard error | ||
|
||
fn bar_with_default_impl(_: String, _: String) {} | ||
//~^ WARNING anonymous parameters are deprecated | ||
//~| WARNING hard error | ||
//~| WARNING anonymous parameters are deprecated | ||
//~| WARNING hard error | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
error: anonymous parameters are deprecated and will be removed in the next edition. | ||
--> $DIR/anon-params-deprecated.rs:15:12 | ||
warning: anonymous parameters are deprecated and will be removed in the next edition. | ||
--> $DIR/anon-params-deprecated.rs:19:12 | ||
| | ||
LL | fn foo(i32); //~ ERROR anonymous parameters are deprecated | ||
LL | fn foo(i32); //~ WARNING anonymous parameters are deprecated | ||
| ^^^ help: Try naming the parameter or explicitly ignoring it: `_: i32` | ||
| | ||
note: lint level defined here | ||
--> $DIR/anon-params-deprecated.rs:11:11 | ||
--> $DIR/anon-params-deprecated.rs:11:9 | ||
| | ||
LL | #![forbid(anonymous_parameters)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
LL | #![warn(anonymous_parameters)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> | ||
|
||
error: anonymous parameters are deprecated and will be removed in the next edition. | ||
--> $DIR/anon-params-deprecated.rs:18:30 | ||
warning: anonymous parameters are deprecated and will be removed in the next edition. | ||
--> $DIR/anon-params-deprecated.rs:22:30 | ||
| | ||
LL | fn bar_with_default_impl(String, String) {} | ||
| ^^^^^^ help: Try naming the parameter or explicitly ignoring it: `_: String` | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> | ||
|
||
error: anonymous parameters are deprecated and will be removed in the next edition. | ||
--> $DIR/anon-params-deprecated.rs:18:38 | ||
warning: anonymous parameters are deprecated and will be removed in the next edition. | ||
--> $DIR/anon-params-deprecated.rs:22:38 | ||
| | ||
LL | fn bar_with_default_impl(String, String) {} | ||
| ^^^^^^ help: Try naming the parameter or explicitly ignoring it: `_: String` | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> | ||
|
||
error: aborting due to 3 previous errors | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.