diff options
| author | mejrs <59372212+mejrs@users.noreply.github.com> | 2025-05-12 16:35:09 +0200 |
|---|---|---|
| committer | mejrs <59372212+mejrs@users.noreply.github.com> | 2025-05-12 16:35:09 +0200 |
| commit | 60c32f61aeb5a22c1bd956b64fb9dfc24dd94fe5 (patch) | |
| tree | 6ecf05511b68c7f24fca93065ca9c0829e7d0a67 | |
| parent | dbab4e152bd9eed57ccfc096ef6060dd9af45a99 (diff) | |
| download | rust-60c32f61aeb5a22c1bd956b64fb9dfc24dd94fe5.tar.gz rust-60c32f61aeb5a22c1bd956b64fb9dfc24dd94fe5.zip | |
Move more tests/ui tests
| -rw-r--r-- | src/tools/tidy/src/issues.txt | 1 | ||||
| -rw-r--r-- | src/tools/tidy/src/ui_tests.rs | 2 | ||||
| -rw-r--r-- | tests/ui/attributes/positions/used.rs (renamed from tests/ui/used.rs) | 9 | ||||
| -rw-r--r-- | tests/ui/attributes/positions/used.stderr (renamed from tests/ui/used.stderr) | 18 | ||||
| -rw-r--r-- | tests/ui/attributes/used-issue-126789.rs | 6 | ||||
| -rw-r--r-- | tests/ui/attributes/used-issue-126789.stderr | 10 | ||||
| -rw-r--r-- | tests/ui/attributes/used/used-not-dead-code-lint.rs | 10 | ||||
| -rw-r--r-- | tests/ui/codemap_tests/utf8-bom.rs (renamed from tests/ui/utf8-bom.rs) | 0 | ||||
| -rw-r--r-- | tests/ui/issues/issue-41628.rs | 7 | ||||
| -rw-r--r-- | tests/ui/rfcs/rfc-2457-non-ascii-idents/utf8_idents.rs (renamed from tests/ui/utf8_idents.rs) | 9 |
10 files changed, 36 insertions, 36 deletions
diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index 2f0158609e0..2c20e21f451 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -2212,7 +2212,6 @@ ui/issues/issue-41479.rs ui/issues/issue-41498.rs ui/issues/issue-41549.rs ui/issues/issue-41604.rs -ui/issues/issue-41628.rs ui/issues/issue-41652/auxiliary/issue-41652-b.rs ui/issues/issue-41652/issue-41652.rs ui/issues/issue-41677.rs diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 44dd1e50f5b..8f9b07c49ac 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -17,7 +17,7 @@ use ignore::Walk; const ENTRY_LIMIT: u32 = 901; // FIXME: The following limits should be reduced eventually. -const ISSUES_ENTRY_LIMIT: u32 = 1624; +const ISSUES_ENTRY_LIMIT: u32 = 1623; const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[ "rs", // test source files diff --git a/tests/ui/used.rs b/tests/ui/attributes/positions/used.rs index f008724f428..7950fa773a1 100644 --- a/tests/ui/used.rs +++ b/tests/ui/attributes/positions/used.rs @@ -1,3 +1,6 @@ +//! Checks that `#[used]` cannot be used on invalid positions. +#![crate_type = "lib"] + #[used] static FOO: u32 = 0; // OK @@ -13,4 +16,8 @@ trait Bar {} #[used] //~ ERROR attribute must be applied to a `static` variable impl Bar for Foo {} -fn main() {} +// Regression test for <https://github.com/rust-lang/rust/issues/126789>. +extern "C" { + #[used] //~ ERROR attribute must be applied to a `static` variable + static BAR: i32; +} diff --git a/tests/ui/used.stderr b/tests/ui/attributes/positions/used.stderr index c586dc72293..96dd43a3a93 100644 --- a/tests/ui/used.stderr +++ b/tests/ui/attributes/positions/used.stderr @@ -1,5 +1,5 @@ error: attribute must be applied to a `static` variable - --> $DIR/used.rs:4:1 + --> $DIR/used.rs:7:1 | LL | #[used] | ^^^^^^^ @@ -7,7 +7,7 @@ LL | fn foo() {} | ----------- but this is a function error: attribute must be applied to a `static` variable - --> $DIR/used.rs:7:1 + --> $DIR/used.rs:10:1 | LL | #[used] | ^^^^^^^ @@ -15,7 +15,7 @@ LL | struct Foo {} | ------------- but this is a struct error: attribute must be applied to a `static` variable - --> $DIR/used.rs:10:1 + --> $DIR/used.rs:13:1 | LL | #[used] | ^^^^^^^ @@ -23,12 +23,20 @@ LL | trait Bar {} | ------------ but this is a trait error: attribute must be applied to a `static` variable - --> $DIR/used.rs:13:1 + --> $DIR/used.rs:16:1 | LL | #[used] | ^^^^^^^ LL | impl Bar for Foo {} | ------------------- but this is a implementation block -error: aborting due to 4 previous errors +error: attribute must be applied to a `static` variable + --> $DIR/used.rs:21:5 + | +LL | #[used] + | ^^^^^^^ +LL | static BAR: i32; + | ---------------- but this is a foreign static item + +error: aborting due to 5 previous errors diff --git a/tests/ui/attributes/used-issue-126789.rs b/tests/ui/attributes/used-issue-126789.rs deleted file mode 100644 index 90a1aa8d5cc..00000000000 --- a/tests/ui/attributes/used-issue-126789.rs +++ /dev/null @@ -1,6 +0,0 @@ -extern "C" { - #[used] //~ ERROR attribute must be applied to a `static` variable - static FOO: i32; -} - -fn main() {} diff --git a/tests/ui/attributes/used-issue-126789.stderr b/tests/ui/attributes/used-issue-126789.stderr deleted file mode 100644 index 6014f7af95c..00000000000 --- a/tests/ui/attributes/used-issue-126789.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: attribute must be applied to a `static` variable - --> $DIR/used-issue-126789.rs:2:5 - | -LL | #[used] - | ^^^^^^^ -LL | static FOO: i32; - | ---------------- but this is a foreign static item - -error: aborting due to 1 previous error - diff --git a/tests/ui/attributes/used/used-not-dead-code-lint.rs b/tests/ui/attributes/used/used-not-dead-code-lint.rs new file mode 100644 index 00000000000..ece40ed219d --- /dev/null +++ b/tests/ui/attributes/used/used-not-dead-code-lint.rs @@ -0,0 +1,10 @@ +//! Checks that the `dead_code` lint does not consider `#[used]` items unused. +//! Regression test for <https://github.com/rust-lang/rust/issues/41628>. + +//@ check-pass +#![deny(dead_code)] + +#[used] +static FOO: u32 = 0; + +fn main() {} diff --git a/tests/ui/utf8-bom.rs b/tests/ui/codemap_tests/utf8-bom.rs index eb82f6652cb..eb82f6652cb 100644 --- a/tests/ui/utf8-bom.rs +++ b/tests/ui/codemap_tests/utf8-bom.rs diff --git a/tests/ui/issues/issue-41628.rs b/tests/ui/issues/issue-41628.rs deleted file mode 100644 index 255e4243e01..00000000000 --- a/tests/ui/issues/issue-41628.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ check-pass -#![deny(dead_code)] - -#[used] -static FOO: u32 = 0; - -fn main() {} diff --git a/tests/ui/utf8_idents.rs b/tests/ui/rfcs/rfc-2457-non-ascii-idents/utf8_idents.rs index 0c34529d2de..3997e27bc9f 100644 --- a/tests/ui/utf8_idents.rs +++ b/tests/ui/rfcs/rfc-2457-non-ascii-idents/utf8_idents.rs @@ -1,14 +1,13 @@ +//! Check that non-ascii-idents are allowed. + //@ check-pass // #![allow(mixed_script_confusables, non_camel_case_types)] -fn foo< - 'β, - γ ->() {} +fn foo<'β, γ>() {} struct X { - δ: usize + δ: usize, } pub fn main() { |
