From bf8756d2dd820c560cf8172b43dedfcba00d7d88 Mon Sep 17 00:00:00 2001 From: Gil Shoshan Date: Wed, 3 May 2023 14:53:54 +0300 Subject: [PATCH 1/5] Don't lint snake-case on executable crate name Co-authored-by: Jieyou Xu --- compiler/rustc_lint/src/nonstandard_style.rs | 5 ++++- tests/ui/lint/lint-non-snake-case-crate-2.stderr | 11 ----------- tests/ui/lint/lint-non-snake-case-crate-bin.rs | 6 ++++++ ...rate-2.rs => lint-non-snake-case-crate-bin2.rs} | 2 +- tests/ui/lint/lint-non-snake-case-crate-bin3.rs | 7 +++++++ tests/ui/lint/lint-non-snake-case-crate-cdylib.rs | 6 ++++++ .../lint/lint-non-snake-case-crate-cdylib.stderr | 14 ++++++++++++++ tests/ui/lint/lint-non-snake-case-crate-dylib.rs | 6 ++++++ .../ui/lint/lint-non-snake-case-crate-dylib.stderr | 14 ++++++++++++++ ...e-crate.rs => lint-non-snake-case-crate-lib.rs} | 1 + ...stderr => lint-non-snake-case-crate-lib.stderr} | 4 ++-- .../lint/lint-non-snake-case-crate-proc-macro.rs | 6 ++++++ .../lint-non-snake-case-crate-proc-macro.stderr | 14 ++++++++++++++ tests/ui/lint/lint-non-snake-case-crate-rlib.rs | 6 ++++++ .../ui/lint/lint-non-snake-case-crate-rlib.stderr | 14 ++++++++++++++ .../ui/lint/lint-non-snake-case-crate-staticlib.rs | 8 ++++++++ .../lint-non-snake-case-crate-staticlib.stderr | 14 ++++++++++++++ 17 files changed, 123 insertions(+), 15 deletions(-) delete mode 100644 tests/ui/lint/lint-non-snake-case-crate-2.stderr create mode 100644 tests/ui/lint/lint-non-snake-case-crate-bin.rs rename tests/ui/lint/{lint-non-snake-case-crate-2.rs => lint-non-snake-case-crate-bin2.rs} (54%) create mode 100644 tests/ui/lint/lint-non-snake-case-crate-bin3.rs create mode 100644 tests/ui/lint/lint-non-snake-case-crate-cdylib.rs create mode 100644 tests/ui/lint/lint-non-snake-case-crate-cdylib.stderr create mode 100644 tests/ui/lint/lint-non-snake-case-crate-dylib.rs create mode 100644 tests/ui/lint/lint-non-snake-case-crate-dylib.stderr rename tests/ui/lint/{lint-non-snake-case-crate.rs => lint-non-snake-case-crate-lib.rs} (85%) rename tests/ui/lint/{lint-non-snake-case-crate.stderr => lint-non-snake-case-crate-lib.stderr} (77%) create mode 100644 tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs create mode 100644 tests/ui/lint/lint-non-snake-case-crate-proc-macro.stderr create mode 100644 tests/ui/lint/lint-non-snake-case-crate-rlib.rs create mode 100644 tests/ui/lint/lint-non-snake-case-crate-rlib.stderr create mode 100644 tests/ui/lint/lint-non-snake-case-crate-staticlib.rs create mode 100644 tests/ui/lint/lint-non-snake-case-crate-staticlib.stderr diff --git a/compiler/rustc_lint/src/nonstandard_style.rs b/compiler/rustc_lint/src/nonstandard_style.rs index 4ecd87e37d3b5..d77bc743ca9df 100644 --- a/compiler/rustc_lint/src/nonstandard_style.rs +++ b/compiler/rustc_lint/src/nonstandard_style.rs @@ -10,6 +10,7 @@ use rustc_hir::def::{DefKind, Res}; use rustc_hir::intravisit::FnKind; use rustc_hir::{GenericParamKind, PatKind}; use rustc_middle::ty; +use rustc_session::config::CrateType; use rustc_span::def_id::LocalDefId; use rustc_span::symbol::{sym, Ident}; use rustc_span::{BytePos, Span}; @@ -366,7 +367,9 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase { }) }; - if let Some(ident) = &crate_ident { + if let Some(ident) = &crate_ident + && cx.tcx.crate_types().iter().all(|&crate_type| crate_type != CrateType::Executable) + { self.check_snake_case(cx, "crate", ident); } } diff --git a/tests/ui/lint/lint-non-snake-case-crate-2.stderr b/tests/ui/lint/lint-non-snake-case-crate-2.stderr deleted file mode 100644 index f3207226cd93e..0000000000000 --- a/tests/ui/lint/lint-non-snake-case-crate-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: crate `NonSnakeCase` should have a snake case name - | - = help: convert the identifier to snake case: `non_snake_case` -note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate-2.rs:4:9 - | -LL | #![deny(non_snake_case)] - | ^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/lint/lint-non-snake-case-crate-bin.rs b/tests/ui/lint/lint-non-snake-case-crate-bin.rs new file mode 100644 index 0000000000000..ac1a03369ef45 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-bin.rs @@ -0,0 +1,6 @@ +//@ check-pass +#![crate_name = "NonSnakeCase"] + +#![deny(non_snake_case)] + +fn main() {} diff --git a/tests/ui/lint/lint-non-snake-case-crate-2.rs b/tests/ui/lint/lint-non-snake-case-crate-bin2.rs similarity index 54% rename from tests/ui/lint/lint-non-snake-case-crate-2.rs rename to tests/ui/lint/lint-non-snake-case-crate-bin2.rs index b4b816a5a5775..78eb5d1b6cdfb 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-2.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-bin2.rs @@ -1,5 +1,5 @@ //@ compile-flags: --crate-name NonSnakeCase -//@ error-pattern: crate `NonSnakeCase` should have a snake case name +//@ check-pass #![deny(non_snake_case)] diff --git a/tests/ui/lint/lint-non-snake-case-crate-bin3.rs b/tests/ui/lint/lint-non-snake-case-crate-bin3.rs new file mode 100644 index 0000000000000..1e801802b43b9 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-bin3.rs @@ -0,0 +1,7 @@ +//@ check-pass +#![crate_type = "bin"] +#![crate_name = "NonSnakeCase"] + +#![deny(non_snake_case)] + +fn main() {} diff --git a/tests/ui/lint/lint-non-snake-case-crate-cdylib.rs b/tests/ui/lint/lint-non-snake-case-crate-cdylib.rs new file mode 100644 index 0000000000000..d2cd62fd68a8d --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-cdylib.rs @@ -0,0 +1,6 @@ +#![crate_type = "cdylib"] +#![crate_name = "NonSnakeCase"] +//~^ ERROR crate `NonSnakeCase` should have a snake case name +#![deny(non_snake_case)] + +fn main() {} diff --git a/tests/ui/lint/lint-non-snake-case-crate-cdylib.stderr b/tests/ui/lint/lint-non-snake-case-crate-cdylib.stderr new file mode 100644 index 0000000000000..4bb129f31b772 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-cdylib.stderr @@ -0,0 +1,14 @@ +error: crate `NonSnakeCase` should have a snake case name + --> $DIR/lint-non-snake-case-crate-cdylib.rs:2: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-cdylib.rs:4:9 + | +LL | #![deny(non_snake_case)] + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/lint-non-snake-case-crate-dylib.rs b/tests/ui/lint/lint-non-snake-case-crate-dylib.rs new file mode 100644 index 0000000000000..1ab974c54f6e3 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-dylib.rs @@ -0,0 +1,6 @@ +#![crate_type = "dylib"] +#![crate_name = "NonSnakeCase"] +//~^ ERROR crate `NonSnakeCase` should have a snake case name +#![deny(non_snake_case)] + +fn main() {} diff --git a/tests/ui/lint/lint-non-snake-case-crate-dylib.stderr b/tests/ui/lint/lint-non-snake-case-crate-dylib.stderr new file mode 100644 index 0000000000000..23d40c2394d95 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-dylib.stderr @@ -0,0 +1,14 @@ +error: crate `NonSnakeCase` should have a snake case name + --> $DIR/lint-non-snake-case-crate-dylib.rs:2: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-dylib.rs:4:9 + | +LL | #![deny(non_snake_case)] + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/lint-non-snake-case-crate.rs b/tests/ui/lint/lint-non-snake-case-crate-lib.rs similarity index 85% rename from tests/ui/lint/lint-non-snake-case-crate.rs rename to tests/ui/lint/lint-non-snake-case-crate-lib.rs index e4e84261a4ee9..79e020f07ba2a 100644 --- a/tests/ui/lint/lint-non-snake-case-crate.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-lib.rs @@ -1,3 +1,4 @@ +#![crate_type = "lib"] #![crate_name = "NonSnakeCase"] //~^ ERROR crate `NonSnakeCase` should have a snake case name #![deny(non_snake_case)] diff --git a/tests/ui/lint/lint-non-snake-case-crate.stderr b/tests/ui/lint/lint-non-snake-case-crate-lib.stderr similarity index 77% rename from tests/ui/lint/lint-non-snake-case-crate.stderr rename to tests/ui/lint/lint-non-snake-case-crate-lib.stderr index 1136b707d595b..6d40a6bdb6c66 100644 --- a/tests/ui/lint/lint-non-snake-case-crate.stderr +++ b/tests/ui/lint/lint-non-snake-case-crate-lib.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate.rs:1:18 + --> $DIR/lint-non-snake-case-crate-lib.rs:2: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:3:9 + --> $DIR/lint-non-snake-case-crate-lib.rs:4:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs b/tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs new file mode 100644 index 0000000000000..949abe5573c79 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs @@ -0,0 +1,6 @@ +#![crate_type = "proc-macro"] +#![crate_name = "NonSnakeCase"] +//~^ ERROR crate `NonSnakeCase` should have a snake case name +#![deny(non_snake_case)] + +fn main() {} diff --git a/tests/ui/lint/lint-non-snake-case-crate-proc-macro.stderr b/tests/ui/lint/lint-non-snake-case-crate-proc-macro.stderr new file mode 100644 index 0000000000000..4963eef88e4b8 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-proc-macro.stderr @@ -0,0 +1,14 @@ +error: crate `NonSnakeCase` should have a snake case name + --> $DIR/lint-non-snake-case-crate-proc-macro.rs:2: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-proc-macro.rs:4:9 + | +LL | #![deny(non_snake_case)] + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/lint-non-snake-case-crate-rlib.rs b/tests/ui/lint/lint-non-snake-case-crate-rlib.rs new file mode 100644 index 0000000000000..1d5334d81f303 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-rlib.rs @@ -0,0 +1,6 @@ +#![crate_type = "rlib"] +#![crate_name = "NonSnakeCase"] +//~^ ERROR crate `NonSnakeCase` should have a snake case name +#![deny(non_snake_case)] + +fn main() {} diff --git a/tests/ui/lint/lint-non-snake-case-crate-rlib.stderr b/tests/ui/lint/lint-non-snake-case-crate-rlib.stderr new file mode 100644 index 0000000000000..ba0b85f6f0042 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-rlib.stderr @@ -0,0 +1,14 @@ +error: crate `NonSnakeCase` should have a snake case name + --> $DIR/lint-non-snake-case-crate-rlib.rs:2: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-rlib.rs:4:9 + | +LL | #![deny(non_snake_case)] + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/lint-non-snake-case-crate-staticlib.rs b/tests/ui/lint/lint-non-snake-case-crate-staticlib.rs new file mode 100644 index 0000000000000..fbb4ea7d0b5a8 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-staticlib.rs @@ -0,0 +1,8 @@ +//@ ignore-wasm + +#![crate_type = "staticlib"] +#![crate_name = "NonSnakeCase"] +//~^ ERROR crate `NonSnakeCase` should have a snake case name +#![deny(non_snake_case)] + +fn main() {} diff --git a/tests/ui/lint/lint-non-snake-case-crate-staticlib.stderr b/tests/ui/lint/lint-non-snake-case-crate-staticlib.stderr new file mode 100644 index 0000000000000..49438414c278b --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-staticlib.stderr @@ -0,0 +1,14 @@ +error: crate `NonSnakeCase` should have a snake case name + --> $DIR/lint-non-snake-case-crate-staticlib.rs:4: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-staticlib.rs:6:9 + | +LL | #![deny(non_snake_case)] + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + From d363db71f83711b392f2f2667aa2c15247e9e21d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= Date: Fri, 1 Mar 2024 19:16:02 +0000 Subject: [PATCH 2/5] Hoist only-executables check above producing crate ident --- compiler/rustc_lint/src/nonstandard_style.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_lint/src/nonstandard_style.rs b/compiler/rustc_lint/src/nonstandard_style.rs index d77bc743ca9df..ee863672017d5 100644 --- a/compiler/rustc_lint/src/nonstandard_style.rs +++ b/compiler/rustc_lint/src/nonstandard_style.rs @@ -332,6 +332,10 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase { return; } + if cx.tcx.crate_types().iter().all(|&crate_type| crate_type == CrateType::Executable) { + return; + } + let crate_ident = if let Some(name) = &cx.tcx.sess.opts.crate_name { Some(Ident::from_str(name)) } else { @@ -367,9 +371,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase { }) }; - if let Some(ident) = &crate_ident - && cx.tcx.crate_types().iter().all(|&crate_type| crate_type != CrateType::Executable) - { + if let Some(ident) = &crate_ident { self.check_snake_case(cx, "crate", ident); } } From 6e355ae44c319d42ffdff6a1ed175b41b1525507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= Date: Sat, 2 Mar 2024 11:49:36 +0000 Subject: [PATCH 3/5] Ignore wasm in dylib/proc-macro crate type tests --- tests/ui/lint/lint-non-snake-case-crate-dylib.rs | 1 + tests/ui/lint/lint-non-snake-case-crate-dylib.stderr | 4 ++-- tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs | 1 + tests/ui/lint/lint-non-snake-case-crate-proc-macro.stderr | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/ui/lint/lint-non-snake-case-crate-dylib.rs b/tests/ui/lint/lint-non-snake-case-crate-dylib.rs index 1ab974c54f6e3..d735a91adf605 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-dylib.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-dylib.rs @@ -1,3 +1,4 @@ +//@ ignore-wasm #![crate_type = "dylib"] #![crate_name = "NonSnakeCase"] //~^ ERROR crate `NonSnakeCase` should have a snake case name diff --git a/tests/ui/lint/lint-non-snake-case-crate-dylib.stderr b/tests/ui/lint/lint-non-snake-case-crate-dylib.stderr index 23d40c2394d95..4ee1a9cb3ddd5 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-dylib.stderr +++ b/tests/ui/lint/lint-non-snake-case-crate-dylib.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate-dylib.rs:2:18 + --> $DIR/lint-non-snake-case-crate-dylib.rs:3: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-dylib.rs:4:9 + --> $DIR/lint-non-snake-case-crate-dylib.rs:5:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs b/tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs index 949abe5573c79..78bc630cc4e0d 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs @@ -1,3 +1,4 @@ +//@ ignore-wasm #![crate_type = "proc-macro"] #![crate_name = "NonSnakeCase"] //~^ ERROR crate `NonSnakeCase` should have a snake case name diff --git a/tests/ui/lint/lint-non-snake-case-crate-proc-macro.stderr b/tests/ui/lint/lint-non-snake-case-crate-proc-macro.stderr index 4963eef88e4b8..e0091057bc971 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-proc-macro.stderr +++ b/tests/ui/lint/lint-non-snake-case-crate-proc-macro.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate-proc-macro.rs:2:18 + --> $DIR/lint-non-snake-case-crate-proc-macro.rs:3: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-proc-macro.rs:4:9 + --> $DIR/lint-non-snake-case-crate-proc-macro.rs:5:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ From 82ceec9d1d77f220dca3975c20fde90430fc1bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= Date: Sun, 3 Mar 2024 13:05:11 +0000 Subject: [PATCH 4/5] Ignore cdylib test for i686-unknown-linux-musl --- tests/ui/lint/lint-non-snake-case-crate-cdylib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/ui/lint/lint-non-snake-case-crate-cdylib.rs b/tests/ui/lint/lint-non-snake-case-crate-cdylib.rs index d2cd62fd68a8d..5f09e2b3755f4 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-cdylib.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-cdylib.rs @@ -1,3 +1,4 @@ +//@ ignore-i686-unknown-linux-musl #![crate_type = "cdylib"] #![crate_name = "NonSnakeCase"] //~^ ERROR crate `NonSnakeCase` should have a snake case name From d0111cb57ad477d286c525c57da7a3ca8c3b53b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= Date: Sun, 3 Mar 2024 13:24:28 +0000 Subject: [PATCH 5/5] Only run lint tests on x86_64-unknown-linux-gnu We're trying to test lint behavior, not per-target crate-type support. --- tests/ui/lint/lint-non-snake-case-crate-bin.rs | 1 + tests/ui/lint/lint-non-snake-case-crate-bin2.rs | 1 + tests/ui/lint/lint-non-snake-case-crate-bin3.rs | 1 + tests/ui/lint/lint-non-snake-case-crate-cdylib.rs | 2 +- tests/ui/lint/lint-non-snake-case-crate-cdylib.stderr | 4 ++-- tests/ui/lint/lint-non-snake-case-crate-dylib.rs | 2 +- tests/ui/lint/lint-non-snake-case-crate-lib.rs | 1 + tests/ui/lint/lint-non-snake-case-crate-lib.stderr | 4 ++-- tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs | 2 +- tests/ui/lint/lint-non-snake-case-crate-rlib.rs | 1 + tests/ui/lint/lint-non-snake-case-crate-rlib.stderr | 4 ++-- tests/ui/lint/lint-non-snake-case-crate-staticlib.rs | 3 +-- tests/ui/lint/lint-non-snake-case-crate-staticlib.stderr | 4 ++-- 13 files changed, 17 insertions(+), 13 deletions(-) diff --git a/tests/ui/lint/lint-non-snake-case-crate-bin.rs b/tests/ui/lint/lint-non-snake-case-crate-bin.rs index ac1a03369ef45..f8aad88eceecf 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-bin.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-bin.rs @@ -1,3 +1,4 @@ +//@ only-x86_64-unknown-linux-gnu //@ check-pass #![crate_name = "NonSnakeCase"] diff --git a/tests/ui/lint/lint-non-snake-case-crate-bin2.rs b/tests/ui/lint/lint-non-snake-case-crate-bin2.rs index 78eb5d1b6cdfb..c077d81e9e542 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-bin2.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-bin2.rs @@ -1,3 +1,4 @@ +//@ only-x86_64-unknown-linux-gnu //@ compile-flags: --crate-name NonSnakeCase //@ check-pass diff --git a/tests/ui/lint/lint-non-snake-case-crate-bin3.rs b/tests/ui/lint/lint-non-snake-case-crate-bin3.rs index 1e801802b43b9..278f7cfd3ee48 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-bin3.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-bin3.rs @@ -1,3 +1,4 @@ +//@ only-x86_64-unknown-linux-gnu //@ check-pass #![crate_type = "bin"] #![crate_name = "NonSnakeCase"] diff --git a/tests/ui/lint/lint-non-snake-case-crate-cdylib.rs b/tests/ui/lint/lint-non-snake-case-crate-cdylib.rs index 5f09e2b3755f4..781c6794fc2aa 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-cdylib.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-cdylib.rs @@ -1,4 +1,4 @@ -//@ ignore-i686-unknown-linux-musl +//@ only-x86_64-unknown-linux-gnu #![crate_type = "cdylib"] #![crate_name = "NonSnakeCase"] //~^ ERROR crate `NonSnakeCase` should have a snake case name diff --git a/tests/ui/lint/lint-non-snake-case-crate-cdylib.stderr b/tests/ui/lint/lint-non-snake-case-crate-cdylib.stderr index 4bb129f31b772..f9167aa8df349 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-cdylib.stderr +++ b/tests/ui/lint/lint-non-snake-case-crate-cdylib.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate-cdylib.rs:2:18 + --> $DIR/lint-non-snake-case-crate-cdylib.rs:3: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-cdylib.rs:4:9 + --> $DIR/lint-non-snake-case-crate-cdylib.rs:5:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/lint-non-snake-case-crate-dylib.rs b/tests/ui/lint/lint-non-snake-case-crate-dylib.rs index d735a91adf605..3f65295f06839 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-dylib.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-dylib.rs @@ -1,4 +1,4 @@ -//@ ignore-wasm +//@ only-x86_64-unknown-linux-gnu #![crate_type = "dylib"] #![crate_name = "NonSnakeCase"] //~^ ERROR crate `NonSnakeCase` should have a snake case name diff --git a/tests/ui/lint/lint-non-snake-case-crate-lib.rs b/tests/ui/lint/lint-non-snake-case-crate-lib.rs index 79e020f07ba2a..20c58e66aa626 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-lib.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-lib.rs @@ -1,3 +1,4 @@ +//@ only-x86_64-unknown-linux-gnu #![crate_type = "lib"] #![crate_name = "NonSnakeCase"] //~^ ERROR crate `NonSnakeCase` should have a snake case name diff --git a/tests/ui/lint/lint-non-snake-case-crate-lib.stderr b/tests/ui/lint/lint-non-snake-case-crate-lib.stderr index 6d40a6bdb6c66..a68c0e832b88c 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-lib.stderr +++ b/tests/ui/lint/lint-non-snake-case-crate-lib.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate-lib.rs:2:18 + --> $DIR/lint-non-snake-case-crate-lib.rs:3: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-lib.rs:4:9 + --> $DIR/lint-non-snake-case-crate-lib.rs:5:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs b/tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs index 78bc630cc4e0d..f0f2fa4393ee8 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs @@ -1,4 +1,4 @@ -//@ ignore-wasm +//@ only-x86_64-unknown-linux-gnu #![crate_type = "proc-macro"] #![crate_name = "NonSnakeCase"] //~^ ERROR crate `NonSnakeCase` should have a snake case name diff --git a/tests/ui/lint/lint-non-snake-case-crate-rlib.rs b/tests/ui/lint/lint-non-snake-case-crate-rlib.rs index 1d5334d81f303..1a558def3d02e 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-rlib.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-rlib.rs @@ -1,3 +1,4 @@ +//@ only-x86_64-unknown-linux-gnu #![crate_type = "rlib"] #![crate_name = "NonSnakeCase"] //~^ ERROR crate `NonSnakeCase` should have a snake case name diff --git a/tests/ui/lint/lint-non-snake-case-crate-rlib.stderr b/tests/ui/lint/lint-non-snake-case-crate-rlib.stderr index ba0b85f6f0042..6e9d54bd5bcde 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-rlib.stderr +++ b/tests/ui/lint/lint-non-snake-case-crate-rlib.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate-rlib.rs:2:18 + --> $DIR/lint-non-snake-case-crate-rlib.rs:3: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-rlib.rs:4:9 + --> $DIR/lint-non-snake-case-crate-rlib.rs:5:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/lint-non-snake-case-crate-staticlib.rs b/tests/ui/lint/lint-non-snake-case-crate-staticlib.rs index fbb4ea7d0b5a8..2ec53c15eb804 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-staticlib.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-staticlib.rs @@ -1,5 +1,4 @@ -//@ ignore-wasm - +//@ only-x86_64-unknown-linux-gnu #![crate_type = "staticlib"] #![crate_name = "NonSnakeCase"] //~^ ERROR crate `NonSnakeCase` should have a snake case name diff --git a/tests/ui/lint/lint-non-snake-case-crate-staticlib.stderr b/tests/ui/lint/lint-non-snake-case-crate-staticlib.stderr index 49438414c278b..4ee6d5bd4d46f 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-staticlib.stderr +++ b/tests/ui/lint/lint-non-snake-case-crate-staticlib.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate-staticlib.rs:4:18 + --> $DIR/lint-non-snake-case-crate-staticlib.rs:3: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-staticlib.rs:6:9 + --> $DIR/lint-non-snake-case-crate-staticlib.rs:5:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^