From c2e43fffbc7936c33c68062f71892899bac23ba7 Mon Sep 17 00:00:00 2001 From: reddevilmidzy Date: Fri, 5 Dec 2025 16:15:20 +0900 Subject: [PATCH 1/2] moved tests --- src/tools/tidy/src/issues.txt | 1 - .../issue-3429.rs => closures/simple-capture-and-call.rs} | 0 .../issue-2642.rs => for-loop-while/nested-loop-break-unit.rs} | 0 .../issue-47673.rs => imports/duplicate-empty-imports.rs} | 0 .../{issues/issue-3500.rs => match/match-ref-option-pattern.rs} | 0 .../match-stack-overflow-72933-.rs} | 0 .../{issues/issue-3993.rs => privacy/private-item-simple-2.rs} | 0 .../issue-3993.stderr => privacy/private-item-simple-2.stderr} | 0 tests/ui/{issues/issue-47380.rs => str/str-add-operator-2.rs} | 0 .../{issues/issue-47380.stderr => str/str-add-operator-2.stderr} | 0 tests/ui/{issues/issue-47377.rs => str/str-add-operator.rs} | 0 .../{issues/issue-47377.stderr => str/str-add-operator.stderr} | 0 .../normalize-associated-type-in-where-clause.rs} | 0 .../{issues/issue-2151.rs => type/never-type-inference-fail.rs} | 0 .../issue-2151.stderr => type/never-type-inference-fail.stderr} | 0 tests/ui/typeck/{issue-10969.rs => non-function-call-error-2.rs} | 0 .../{issue-10969.stderr => non-function-call-error-2.stderr} | 0 .../{issues/issue-22468.rs => typeck/non-function-call-error.rs} | 0 .../issue-22468.stderr => typeck/non-function-call-error.stderr} | 0 19 files changed, 1 deletion(-) rename tests/ui/{issues/issue-3429.rs => closures/simple-capture-and-call.rs} (100%) rename tests/ui/{issues/issue-2642.rs => for-loop-while/nested-loop-break-unit.rs} (100%) rename tests/ui/{issues/issue-47673.rs => imports/duplicate-empty-imports.rs} (100%) rename tests/ui/{issues/issue-3500.rs => match/match-ref-option-pattern.rs} (100%) rename tests/ui/{issues/issue-72933-match-stack-overflow.rs => match/match-stack-overflow-72933-.rs} (100%) rename tests/ui/{issues/issue-3993.rs => privacy/private-item-simple-2.rs} (100%) rename tests/ui/{issues/issue-3993.stderr => privacy/private-item-simple-2.stderr} (100%) rename tests/ui/{issues/issue-47380.rs => str/str-add-operator-2.rs} (100%) rename tests/ui/{issues/issue-47380.stderr => str/str-add-operator-2.stderr} (100%) rename tests/ui/{issues/issue-47377.rs => str/str-add-operator.rs} (100%) rename tests/ui/{issues/issue-47377.stderr => str/str-add-operator.stderr} (100%) rename tests/ui/{issues/issue-51044.rs => traits/normalize-associated-type-in-where-clause.rs} (100%) rename tests/ui/{issues/issue-2151.rs => type/never-type-inference-fail.rs} (100%) rename tests/ui/{issues/issue-2151.stderr => type/never-type-inference-fail.stderr} (100%) rename tests/ui/typeck/{issue-10969.rs => non-function-call-error-2.rs} (100%) rename tests/ui/typeck/{issue-10969.stderr => non-function-call-error-2.stderr} (100%) rename tests/ui/{issues/issue-22468.rs => typeck/non-function-call-error.rs} (100%) rename tests/ui/{issues/issue-22468.stderr => typeck/non-function-call-error.stderr} (100%) diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index 0f3f2f37ebf26..1500c82c411ac 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -2892,7 +2892,6 @@ ui/typeck/issue-105946.rs ui/typeck/issue-106929.rs ui/typeck/issue-107087.rs ui/typeck/issue-107775.rs -ui/typeck/issue-10969.rs ui/typeck/issue-110017-format-into-help-deletes-macro.rs ui/typeck/issue-110052.rs ui/typeck/issue-112007-leaked-writeln-macro-internals.rs diff --git a/tests/ui/issues/issue-3429.rs b/tests/ui/closures/simple-capture-and-call.rs similarity index 100% rename from tests/ui/issues/issue-3429.rs rename to tests/ui/closures/simple-capture-and-call.rs diff --git a/tests/ui/issues/issue-2642.rs b/tests/ui/for-loop-while/nested-loop-break-unit.rs similarity index 100% rename from tests/ui/issues/issue-2642.rs rename to tests/ui/for-loop-while/nested-loop-break-unit.rs diff --git a/tests/ui/issues/issue-47673.rs b/tests/ui/imports/duplicate-empty-imports.rs similarity index 100% rename from tests/ui/issues/issue-47673.rs rename to tests/ui/imports/duplicate-empty-imports.rs diff --git a/tests/ui/issues/issue-3500.rs b/tests/ui/match/match-ref-option-pattern.rs similarity index 100% rename from tests/ui/issues/issue-3500.rs rename to tests/ui/match/match-ref-option-pattern.rs diff --git a/tests/ui/issues/issue-72933-match-stack-overflow.rs b/tests/ui/match/match-stack-overflow-72933-.rs similarity index 100% rename from tests/ui/issues/issue-72933-match-stack-overflow.rs rename to tests/ui/match/match-stack-overflow-72933-.rs diff --git a/tests/ui/issues/issue-3993.rs b/tests/ui/privacy/private-item-simple-2.rs similarity index 100% rename from tests/ui/issues/issue-3993.rs rename to tests/ui/privacy/private-item-simple-2.rs diff --git a/tests/ui/issues/issue-3993.stderr b/tests/ui/privacy/private-item-simple-2.stderr similarity index 100% rename from tests/ui/issues/issue-3993.stderr rename to tests/ui/privacy/private-item-simple-2.stderr diff --git a/tests/ui/issues/issue-47380.rs b/tests/ui/str/str-add-operator-2.rs similarity index 100% rename from tests/ui/issues/issue-47380.rs rename to tests/ui/str/str-add-operator-2.rs diff --git a/tests/ui/issues/issue-47380.stderr b/tests/ui/str/str-add-operator-2.stderr similarity index 100% rename from tests/ui/issues/issue-47380.stderr rename to tests/ui/str/str-add-operator-2.stderr diff --git a/tests/ui/issues/issue-47377.rs b/tests/ui/str/str-add-operator.rs similarity index 100% rename from tests/ui/issues/issue-47377.rs rename to tests/ui/str/str-add-operator.rs diff --git a/tests/ui/issues/issue-47377.stderr b/tests/ui/str/str-add-operator.stderr similarity index 100% rename from tests/ui/issues/issue-47377.stderr rename to tests/ui/str/str-add-operator.stderr diff --git a/tests/ui/issues/issue-51044.rs b/tests/ui/traits/normalize-associated-type-in-where-clause.rs similarity index 100% rename from tests/ui/issues/issue-51044.rs rename to tests/ui/traits/normalize-associated-type-in-where-clause.rs diff --git a/tests/ui/issues/issue-2151.rs b/tests/ui/type/never-type-inference-fail.rs similarity index 100% rename from tests/ui/issues/issue-2151.rs rename to tests/ui/type/never-type-inference-fail.rs diff --git a/tests/ui/issues/issue-2151.stderr b/tests/ui/type/never-type-inference-fail.stderr similarity index 100% rename from tests/ui/issues/issue-2151.stderr rename to tests/ui/type/never-type-inference-fail.stderr diff --git a/tests/ui/typeck/issue-10969.rs b/tests/ui/typeck/non-function-call-error-2.rs similarity index 100% rename from tests/ui/typeck/issue-10969.rs rename to tests/ui/typeck/non-function-call-error-2.rs diff --git a/tests/ui/typeck/issue-10969.stderr b/tests/ui/typeck/non-function-call-error-2.stderr similarity index 100% rename from tests/ui/typeck/issue-10969.stderr rename to tests/ui/typeck/non-function-call-error-2.stderr diff --git a/tests/ui/issues/issue-22468.rs b/tests/ui/typeck/non-function-call-error.rs similarity index 100% rename from tests/ui/issues/issue-22468.rs rename to tests/ui/typeck/non-function-call-error.rs diff --git a/tests/ui/issues/issue-22468.stderr b/tests/ui/typeck/non-function-call-error.stderr similarity index 100% rename from tests/ui/issues/issue-22468.stderr rename to tests/ui/typeck/non-function-call-error.stderr From 22a7457d12d7eb268e3d8b0ba50f6cd7153af9b4 Mon Sep 17 00:00:00 2001 From: reddevilmidzy Date: Fri, 5 Dec 2025 19:50:20 +0900 Subject: [PATCH 2/2] Cleaned up some tests Merged tests/ui/typeck/non-function-call-error-2 with tests/ui/typeck/non-function-call-error Add comment to tests/ui/traits/normalize-associated-type-in-where-clause.rs Merged tests/ui/privacy/private-item-simple-2.rs with tests/ui/privacy/private-item-simple.rs Merged tests/ui/str/str-add-operator-2.rs with tests/ui/str/str-add-operator.rs Add comment to tests/ui/imports/duplicate-empty-imports.rs Add comment to tests/ui/for-loop-while/nested-loop-break-unit.rs Add comment to tests/ui/match/match-ref-option-pattern.rs Add comment to tests/ui/closures/simple-capture-and-call.rs Add comment to tests/ui/type/never-type-inference-fail.rs Add comment to tests/ui/match/match-stack-overflow-72933.rs --- tests/ui/closures/simple-capture-and-call.rs | 9 +++---- .../for-loop-while/nested-loop-break-unit.rs | 1 + tests/ui/imports/duplicate-empty-imports.rs | 1 + tests/ui/match/match-ref-option-pattern.rs | 1 + tests/ui/match/match-stack-overflow-72933-.rs | 3 ++- tests/ui/privacy/private-item-simple-2.rs | 10 -------- tests/ui/privacy/private-item-simple-2.stderr | 15 ------------ tests/ui/privacy/private-item-simple.rs | 6 +++++ tests/ui/privacy/private-item-simple.stderr | 18 +++++++++++--- tests/ui/str/str-add-operator-2.rs | 5 ---- tests/ui/str/str-add-operator-2.stderr | 18 -------------- tests/ui/str/str-add-operator.rs | 1 + tests/ui/str/str-add-operator.stderr | 2 +- ...rmalize-associated-type-in-where-clause.rs | 18 +++++++------- tests/ui/type/never-type-inference-fail.rs | 2 ++ .../ui/type/never-type-inference-fail.stderr | 2 +- tests/ui/typeck/non-function-call-error-2.rs | 7 ------ .../typeck/non-function-call-error-2.stderr | 23 ------------------ tests/ui/typeck/non-function-call-error.rs | 10 ++++++++ .../ui/typeck/non-function-call-error.stderr | 24 +++++++++++++++++-- 20 files changed, 77 insertions(+), 99 deletions(-) delete mode 100644 tests/ui/privacy/private-item-simple-2.rs delete mode 100644 tests/ui/privacy/private-item-simple-2.stderr delete mode 100644 tests/ui/str/str-add-operator-2.rs delete mode 100644 tests/ui/str/str-add-operator-2.stderr delete mode 100644 tests/ui/typeck/non-function-call-error-2.rs delete mode 100644 tests/ui/typeck/non-function-call-error-2.stderr diff --git a/tests/ui/closures/simple-capture-and-call.rs b/tests/ui/closures/simple-capture-and-call.rs index 39d657573db76..112324eb72045 100644 --- a/tests/ui/closures/simple-capture-and-call.rs +++ b/tests/ui/closures/simple-capture-and-call.rs @@ -1,7 +1,8 @@ +//! regression test for issue #1895 //@ run-pass -pub fn main() { - let x = 1_usize; - let y = || x; - let _z = y(); +fn main() { + let x = 1_usize; + let y = || x; + let _z = y(); } diff --git a/tests/ui/for-loop-while/nested-loop-break-unit.rs b/tests/ui/for-loop-while/nested-loop-break-unit.rs index ad5721495090f..b31d9ee8f50db 100644 --- a/tests/ui/for-loop-while/nested-loop-break-unit.rs +++ b/tests/ui/for-loop-while/nested-loop-break-unit.rs @@ -1,3 +1,4 @@ +//! regression test for issue #2642 //@ run-pass #![allow(dead_code)] diff --git a/tests/ui/imports/duplicate-empty-imports.rs b/tests/ui/imports/duplicate-empty-imports.rs index d395ac677e751..7768dcfbbdac4 100644 --- a/tests/ui/imports/duplicate-empty-imports.rs +++ b/tests/ui/imports/duplicate-empty-imports.rs @@ -1,3 +1,4 @@ +//! regression test for issue #47673 //@ check-pass #![allow(unused_imports)] diff --git a/tests/ui/match/match-ref-option-pattern.rs b/tests/ui/match/match-ref-option-pattern.rs index 0860d0f592600..a6de2361503a8 100644 --- a/tests/ui/match/match-ref-option-pattern.rs +++ b/tests/ui/match/match-ref-option-pattern.rs @@ -1,3 +1,4 @@ +//! regression test for issue #3500 //@ run-pass pub fn main() { diff --git a/tests/ui/match/match-stack-overflow-72933-.rs b/tests/ui/match/match-stack-overflow-72933-.rs index 6d091a9108192..0883278be8391 100644 --- a/tests/ui/match/match-stack-overflow-72933-.rs +++ b/tests/ui/match/match-stack-overflow-72933-.rs @@ -1,6 +1,7 @@ +//! regression test for issue #72933 //@ build-pass // ignore-tidy-filelength -#![crate_type="rlib"] +#![crate_type = "rlib"] fn banana(v: &str) -> u32 { match v { diff --git a/tests/ui/privacy/private-item-simple-2.rs b/tests/ui/privacy/private-item-simple-2.rs deleted file mode 100644 index 9dea54ea779e1..0000000000000 --- a/tests/ui/privacy/private-item-simple-2.rs +++ /dev/null @@ -1,10 +0,0 @@ -use zoo::fly; //~ ERROR: function `fly` is private - -mod zoo { - fn fly() {} -} - - -fn main() { - fly(); -} diff --git a/tests/ui/privacy/private-item-simple-2.stderr b/tests/ui/privacy/private-item-simple-2.stderr deleted file mode 100644 index cf839a1314065..0000000000000 --- a/tests/ui/privacy/private-item-simple-2.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0603]: function `fly` is private - --> $DIR/issue-3993.rs:1:10 - | -LL | use zoo::fly; - | ^^^ private function - | -note: the function `fly` is defined here - --> $DIR/issue-3993.rs:4:5 - | -LL | fn fly() {} - | ^^^^^^^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0603`. diff --git a/tests/ui/privacy/private-item-simple.rs b/tests/ui/privacy/private-item-simple.rs index 1f718ed9201a6..68b20991a6262 100644 --- a/tests/ui/privacy/private-item-simple.rs +++ b/tests/ui/privacy/private-item-simple.rs @@ -1,3 +1,5 @@ +//! regression test for issue #3993 + mod a { fn f() {} } @@ -5,3 +7,7 @@ mod a { fn main() { a::f(); //~ ERROR function `f` is private } + +fn foo() { + use a::f; //~ ERROR function `f` is private +} diff --git a/tests/ui/privacy/private-item-simple.stderr b/tests/ui/privacy/private-item-simple.stderr index 330d892e939d0..95165857940e3 100644 --- a/tests/ui/privacy/private-item-simple.stderr +++ b/tests/ui/privacy/private-item-simple.stderr @@ -1,15 +1,27 @@ error[E0603]: function `f` is private - --> $DIR/private-item-simple.rs:6:8 + --> $DIR/private-item-simple.rs:12:12 + | +LL | use a::f; + | ^ private function + | +note: the function `f` is defined here + --> $DIR/private-item-simple.rs:4:5 + | +LL | fn f() {} + | ^^^^^^ + +error[E0603]: function `f` is private + --> $DIR/private-item-simple.rs:8:8 | LL | a::f(); | ^ private function | note: the function `f` is defined here - --> $DIR/private-item-simple.rs:2:5 + --> $DIR/private-item-simple.rs:4:5 | LL | fn f() {} | ^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0603`. diff --git a/tests/ui/str/str-add-operator-2.rs b/tests/ui/str/str-add-operator-2.rs deleted file mode 100644 index 61e096622252b..0000000000000 --- a/tests/ui/str/str-add-operator-2.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let b = "hello"; - println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!"; - //~^ ERROR E0369 -} diff --git a/tests/ui/str/str-add-operator-2.stderr b/tests/ui/str/str-add-operator-2.stderr deleted file mode 100644 index 4fca0296e437a..0000000000000 --- a/tests/ui/str/str-add-operator-2.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0369]: cannot add `&str` to `&str` - --> $DIR/issue-47380.rs:3:35 - | -LL | println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!"; - | - ^ ---------- &str - | | | - | | `+` cannot be used to concatenate two `&str` strings - | &str - | - = note: string concatenation requires an owned `String` on the left -help: create an owned `String` from a string reference - | -LL | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!"; - | +++++++++++ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/str/str-add-operator.rs b/tests/ui/str/str-add-operator.rs index 7a2e0fe6d21df..9c489f2091f8b 100644 --- a/tests/ui/str/str-add-operator.rs +++ b/tests/ui/str/str-add-operator.rs @@ -1,3 +1,4 @@ +//! regression test for issue #47377, #47380 // ignore-tidy-tab fn main() { let b = "hello"; diff --git a/tests/ui/str/str-add-operator.stderr b/tests/ui/str/str-add-operator.stderr index 12e5c15d77fc8..2354819d7fa1e 100644 --- a/tests/ui/str/str-add-operator.stderr +++ b/tests/ui/str/str-add-operator.stderr @@ -1,5 +1,5 @@ error[E0369]: cannot add `&str` to `&str` - --> $DIR/issue-47377.rs:4:14 + --> $DIR/str-add-operator.rs:5:14 | LL | let _a = b + ", World!"; | - ^ ---------- &str diff --git a/tests/ui/traits/normalize-associated-type-in-where-clause.rs b/tests/ui/traits/normalize-associated-type-in-where-clause.rs index d7761b50b4c4b..25ca4a41aa85d 100644 --- a/tests/ui/traits/normalize-associated-type-in-where-clause.rs +++ b/tests/ui/traits/normalize-associated-type-in-where-clause.rs @@ -1,30 +1,30 @@ //@ run-pass -// regression test for issue #50825 -// Check that the feature gate normalizes associated types. +//! regression test for issue #50825, #51044 +//! Check that the feature gate normalizes associated types. #![allow(dead_code)] struct Foo(T); struct Duck; struct Quack; -trait Hello where A: Animal { +trait Hello +where + A: Animal, +{ } trait Animal { type Noise; } -trait Loud { -} +trait Loud {} -impl Loud for f32 { -} +impl Loud for f32 {} impl Animal for Duck { type Noise = Quack; } -impl Hello for Foo where f32: Loud<::Noise> { -} +impl Hello for Foo where f32: Loud<::Noise> {} fn main() {} diff --git a/tests/ui/type/never-type-inference-fail.rs b/tests/ui/type/never-type-inference-fail.rs index 82cf49de8227e..76ee3c5f5d566 100644 --- a/tests/ui/type/never-type-inference-fail.rs +++ b/tests/ui/type/never-type-inference-fail.rs @@ -1,3 +1,5 @@ +//! regression test for issue #2151 + fn main() { let x = panic!(); //~ ERROR type annotations needed x.clone(); diff --git a/tests/ui/type/never-type-inference-fail.stderr b/tests/ui/type/never-type-inference-fail.stderr index b130f162414d0..1d2457103f1ca 100644 --- a/tests/ui/type/never-type-inference-fail.stderr +++ b/tests/ui/type/never-type-inference-fail.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-2151.rs:2:9 + --> $DIR/never-type-inference-fail.rs:4:9 | LL | let x = panic!(); | ^ diff --git a/tests/ui/typeck/non-function-call-error-2.rs b/tests/ui/typeck/non-function-call-error-2.rs deleted file mode 100644 index 0b78fc1bb7fa2..0000000000000 --- a/tests/ui/typeck/non-function-call-error-2.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn func(i: i32) { - i(); //~ERROR expected function, found `i32` -} -fn main() { - let i = 0i32; - i(); //~ERROR expected function, found `i32` -} diff --git a/tests/ui/typeck/non-function-call-error-2.stderr b/tests/ui/typeck/non-function-call-error-2.stderr deleted file mode 100644 index f64b61aaeb05c..0000000000000 --- a/tests/ui/typeck/non-function-call-error-2.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0618]: expected function, found `i32` - --> $DIR/issue-10969.rs:2:5 - | -LL | fn func(i: i32) { - | - `i` has type `i32` -LL | i(); - | ^-- - | | - | call expression requires function - -error[E0618]: expected function, found `i32` - --> $DIR/issue-10969.rs:6:5 - | -LL | let i = 0i32; - | - `i` has type `i32` -LL | i(); - | ^-- - | | - | call expression requires function - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0618`. diff --git a/tests/ui/typeck/non-function-call-error.rs b/tests/ui/typeck/non-function-call-error.rs index 197a19c038c4b..c61cf93d138a8 100644 --- a/tests/ui/typeck/non-function-call-error.rs +++ b/tests/ui/typeck/non-function-call-error.rs @@ -1,9 +1,19 @@ +//! Regression test for issue #10969, #22468 + fn main() { let foo = "bar"; let x = foo("baz"); //~^ ERROR: expected function, found `&str` + + let i = 0i32; + i(); + //~^ ERROR expected function, found `i32` } fn foo(file: &str) -> bool { true } + +fn func(i: i32) { + i(); //~ERROR expected function, found `i32` +} diff --git a/tests/ui/typeck/non-function-call-error.stderr b/tests/ui/typeck/non-function-call-error.stderr index 052888d2029b9..f4797ac3d8b7b 100644 --- a/tests/ui/typeck/non-function-call-error.stderr +++ b/tests/ui/typeck/non-function-call-error.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found `&str` - --> $DIR/issue-22468.rs:3:13 + --> $DIR/non-function-call-error.rs:5:13 | LL | let foo = "bar"; | --- `foo` has type `&str` @@ -11,6 +11,26 @@ LL | let x = foo("baz"); LL | fn foo(file: &str) -> bool { | -------------------------- this function of the same name is available here, but it's shadowed by the local binding -error: aborting due to 1 previous error +error[E0618]: expected function, found `i32` + --> $DIR/non-function-call-error.rs:9:5 + | +LL | let i = 0i32; + | - `i` has type `i32` +LL | i(); + | ^-- + | | + | call expression requires function + +error[E0618]: expected function, found `i32` + --> $DIR/non-function-call-error.rs:18:5 + | +LL | fn func(i: i32) { + | - `i` has type `i32` +LL | i(); + | ^-- + | | + | call expression requires function + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0618`.