forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#130599 - jieyouxu:snake_case_binary_cleanup, …
…r=petrochenkov Explain why `non_snake_case` is skipped for binary crates and cleanup tests - Explain `non_snake_case` lint is skipped for bin crate names because binaries are not intended to be distributed or consumed like library crates (rust-lang#45127). - Coalesce the bunch of tests into a single one but with revisions, which is easier to compare the differences for `non_snake_case` behavior with respect to crate types. Follow-up to rust-lang#121749 with some more comments and test cleanup. cc `@saethlin` who bumped into one of the tests and was confused why it was `only-x86_64-unknown-linux-gnu`.
- Loading branch information
Showing
20 changed files
with
66 additions
and
100 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
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
7 changes: 0 additions & 7 deletions
7
tests/ui/lint/non-snake-case/lint-non-snake-case-crate-bin.rs
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
tests/ui/lint/non-snake-case/lint-non-snake-case-crate-bin2.rs
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
tests/ui/lint/non-snake-case/lint-non-snake-case-crate-bin3.rs
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
tests/ui/lint/non-snake-case/lint-non-snake-case-crate-cdylib.rs
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
tests/ui/lint/non-snake-case/lint-non-snake-case-crate-dylib.rs
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
tests/ui/lint/non-snake-case/lint-non-snake-case-crate-lib.rs
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
tests/ui/lint/non-snake-case/lint-non-snake-case-crate-proc-macro.rs
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
tests/ui/lint/non-snake-case/lint-non-snake-case-crate-proc-macro.stderr
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
tests/ui/lint/non-snake-case/lint-non-snake-case-crate-rlib.rs
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
tests/ui/lint/non-snake-case/lint-non-snake-case-crate-staticlib.rs
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
tests/ui/lint/non-snake-case/lint-non-snake-case-crate-staticlib.stderr
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...case/lint-non-snake-case-crate-lib.stderr → .../lint-non-snake-case-crate.cdylib_.stderr
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
4 changes: 2 additions & 2 deletions
4
...ase/lint-non-snake-case-crate-rlib.stderr → ...e/lint-non-snake-case-crate.dylib_.stderr
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
4 changes: 2 additions & 2 deletions
4
...se/lint-non-snake-case-crate-dylib.stderr → ...ase/lint-non-snake-case-crate.lib_.stderr
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
4 changes: 2 additions & 2 deletions
4
...e/lint-non-snake-case-crate-cdylib.stderr → ...t-non-snake-case-crate.proc_macro_.stderr
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
14 changes: 14 additions & 0 deletions
14
tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rlib_.stderr
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: crate `NonSnakeCase` should have a snake case name | ||
--> $DIR/lint-non-snake-case-crate.rs:22:18 | ||
| | ||
LL | #![crate_name = "NonSnakeCase"] | ||
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/lint-non-snake-case-crate.rs:24:9 | ||
| | ||
LL | #![deny(non_snake_case)] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
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,26 @@ | ||
//! Don't lint on binary crate with non-snake-case names. | ||
//! | ||
//! See <https://github.com/rust-lang/rust/issues/45127>. | ||
|
||
//@ revisions: bin_ cdylib_ dylib_ lib_ proc_macro_ rlib_ staticlib_ | ||
|
||
// Should not fire on binary crates. | ||
//@[bin_] compile-flags: --crate-type=bin | ||
//@[bin_] check-pass | ||
|
||
// But should fire on non-binary crates. | ||
//@[cdylib_] compile-flags: --crate-type=cdylib | ||
//@[cdylib_] ignore-i686-unknown-linux-musl (cdylib is not supported) | ||
//@[dylib_] compile-flags: --crate-type=dylib | ||
//@[dylib_] ignore-wasm (dylib is not supported) | ||
//@[lib_] compile-flags: --crate-type=lib | ||
//@[proc_macro_] compile-flags: --crate-type=proc-macro | ||
//@[proc_macro_] ignore-wasm (dylib is not supported) | ||
//@[rlib_] compile-flags: --crate-type=rlib | ||
//@[staticlib_] compile-flags: --crate-type=staticlib | ||
|
||
#![crate_name = "NonSnakeCase"] | ||
//[cdylib_,dylib_,lib_,proc_macro_,rlib_,staticlib_]~^ ERROR crate `NonSnakeCase` should have a snake case name | ||
#![deny(non_snake_case)] | ||
|
||
fn main() {} |
14 changes: 14 additions & 0 deletions
14
tests/ui/lint/non-snake-case/lint-non-snake-case-crate.staticlib_.stderr
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: crate `NonSnakeCase` should have a snake case name | ||
--> $DIR/lint-non-snake-case-crate.rs:22:18 | ||
| | ||
LL | #![crate_name = "NonSnakeCase"] | ||
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/lint-non-snake-case-crate.rs:24:9 | ||
| | ||
LL | #![deny(non_snake_case)] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|