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/closures/simple-capture-and-call.rs b/tests/ui/closures/simple-capture-and-call.rs new file mode 100644 index 0000000000000..112324eb72045 --- /dev/null +++ b/tests/ui/closures/simple-capture-and-call.rs @@ -0,0 +1,8 @@ +//! regression test for issue #1895 +//@ run-pass + +fn main() { + let x = 1_usize; + let y = || x; + let _z = y(); +} diff --git a/tests/ui/issues/issue-2642.rs b/tests/ui/for-loop-while/nested-loop-break-unit.rs similarity index 75% rename from tests/ui/issues/issue-2642.rs rename to tests/ui/for-loop-while/nested-loop-break-unit.rs index ad5721495090f..b31d9ee8f50db 100644 --- a/tests/ui/issues/issue-2642.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/issues/issue-47673.rs b/tests/ui/imports/duplicate-empty-imports.rs similarity index 65% rename from tests/ui/issues/issue-47673.rs rename to tests/ui/imports/duplicate-empty-imports.rs index d395ac677e751..7768dcfbbdac4 100644 --- a/tests/ui/issues/issue-47673.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/issues/issue-22468.rs b/tests/ui/issues/issue-22468.rs deleted file mode 100644 index 197a19c038c4b..0000000000000 --- a/tests/ui/issues/issue-22468.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn main() { - let foo = "bar"; - let x = foo("baz"); - //~^ ERROR: expected function, found `&str` -} - -fn foo(file: &str) -> bool { - true -} diff --git a/tests/ui/issues/issue-22468.stderr b/tests/ui/issues/issue-22468.stderr deleted file mode 100644 index 052888d2029b9..0000000000000 --- a/tests/ui/issues/issue-22468.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0618]: expected function, found `&str` - --> $DIR/issue-22468.rs:3:13 - | -LL | let foo = "bar"; - | --- `foo` has type `&str` -LL | let x = foo("baz"); - | ^^^------- - | | - | call expression requires function -... -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 - -For more information about this error, try `rustc --explain E0618`. diff --git a/tests/ui/issues/issue-3429.rs b/tests/ui/issues/issue-3429.rs deleted file mode 100644 index 39d657573db76..0000000000000 --- a/tests/ui/issues/issue-3429.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass - -pub fn main() { - let x = 1_usize; - let y = || x; - let _z = y(); -} diff --git a/tests/ui/issues/issue-3993.rs b/tests/ui/issues/issue-3993.rs deleted file mode 100644 index 9dea54ea779e1..0000000000000 --- a/tests/ui/issues/issue-3993.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/issues/issue-3993.stderr b/tests/ui/issues/issue-3993.stderr deleted file mode 100644 index cf839a1314065..0000000000000 --- a/tests/ui/issues/issue-3993.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/issues/issue-47377.rs b/tests/ui/issues/issue-47377.rs deleted file mode 100644 index 7a2e0fe6d21df..0000000000000 --- a/tests/ui/issues/issue-47377.rs +++ /dev/null @@ -1,6 +0,0 @@ -// ignore-tidy-tab -fn main() { - let b = "hello"; - let _a = b + ", World!"; - //~^ ERROR E0369 -} diff --git a/tests/ui/issues/issue-47377.stderr b/tests/ui/issues/issue-47377.stderr deleted file mode 100644 index 12e5c15d77fc8..0000000000000 --- a/tests/ui/issues/issue-47377.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0369]: cannot add `&str` to `&str` - --> $DIR/issue-47377.rs:4:14 - | -LL | 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 | 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/issues/issue-47380.rs b/tests/ui/issues/issue-47380.rs deleted file mode 100644 index 61e096622252b..0000000000000 --- a/tests/ui/issues/issue-47380.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let b = "hello"; - println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!"; - //~^ ERROR E0369 -} diff --git a/tests/ui/issues/issue-3500.rs b/tests/ui/match/match-ref-option-pattern.rs similarity index 76% rename from tests/ui/issues/issue-3500.rs rename to tests/ui/match/match-ref-option-pattern.rs index 0860d0f592600..a6de2361503a8 100644 --- a/tests/ui/issues/issue-3500.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/issues/issue-72933-match-stack-overflow.rs b/tests/ui/match/match-stack-overflow-72933-.rs similarity index 99% rename from tests/ui/issues/issue-72933-match-stack-overflow.rs rename to tests/ui/match/match-stack-overflow-72933-.rs index 6d091a9108192..0883278be8391 100644 --- a/tests/ui/issues/issue-72933-match-stack-overflow.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.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.rs b/tests/ui/str/str-add-operator.rs new file mode 100644 index 0000000000000..26814b232b11a --- /dev/null +++ b/tests/ui/str/str-add-operator.rs @@ -0,0 +1,11 @@ +//! regression test for issue #47377, #47380 +// ignore-tidy-tab +fn main() { + let b = "hello"; + let _a = b + ", World!"; + //~^ ERROR E0369 + + let b = "hello"; + println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!"; + //~^ ERROR E0369 +} diff --git a/tests/ui/issues/issue-47380.stderr b/tests/ui/str/str-add-operator.stderr similarity index 55% rename from tests/ui/issues/issue-47380.stderr rename to tests/ui/str/str-add-operator.stderr index 4fca0296e437a..a3851f6ffe812 100644 --- a/tests/ui/issues/issue-47380.stderr +++ b/tests/ui/str/str-add-operator.stderr @@ -1,5 +1,20 @@ error[E0369]: cannot add `&str` to `&str` - --> $DIR/issue-47380.rs:3:35 + --> $DIR/str-add-operator.rs:5:14 + | +LL | 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 | let _a = b.to_owned() + ", World!"; + | +++++++++++ + +error[E0369]: cannot add `&str` to `&str` + --> $DIR/str-add-operator.rs:9:35 | LL | println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!"; | - ^ ---------- &str @@ -13,6 +28,6 @@ help: create an owned `String` from a string reference LL | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!"; | +++++++++++ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/issues/issue-51044.rs b/tests/ui/traits/normalize-associated-type-in-where-clause.rs similarity index 55% rename from tests/ui/issues/issue-51044.rs rename to tests/ui/traits/normalize-associated-type-in-where-clause.rs index d7761b50b4c4b..25ca4a41aa85d 100644 --- a/tests/ui/issues/issue-51044.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/issues/issue-2151.rs b/tests/ui/type/never-type-inference-fail.rs similarity index 69% rename from tests/ui/issues/issue-2151.rs rename to tests/ui/type/never-type-inference-fail.rs index 82cf49de8227e..76ee3c5f5d566 100644 --- a/tests/ui/issues/issue-2151.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/issues/issue-2151.stderr b/tests/ui/type/never-type-inference-fail.stderr similarity index 89% rename from tests/ui/issues/issue-2151.stderr rename to tests/ui/type/never-type-inference-fail.stderr index b130f162414d0..1d2457103f1ca 100644 --- a/tests/ui/issues/issue-2151.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/issue-10969.rs b/tests/ui/typeck/issue-10969.rs deleted file mode 100644 index 0b78fc1bb7fa2..0000000000000 --- a/tests/ui/typeck/issue-10969.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/issue-10969.stderr b/tests/ui/typeck/issue-10969.stderr deleted file mode 100644 index f64b61aaeb05c..0000000000000 --- a/tests/ui/typeck/issue-10969.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 new file mode 100644 index 0000000000000..c61cf93d138a8 --- /dev/null +++ b/tests/ui/typeck/non-function-call-error.rs @@ -0,0 +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 new file mode 100644 index 0000000000000..f4797ac3d8b7b --- /dev/null +++ b/tests/ui/typeck/non-function-call-error.stderr @@ -0,0 +1,36 @@ +error[E0618]: expected function, found `&str` + --> $DIR/non-function-call-error.rs:5:13 + | +LL | let foo = "bar"; + | --- `foo` has type `&str` +LL | let x = foo("baz"); + | ^^^------- + | | + | call expression requires function +... +LL | fn foo(file: &str) -> bool { + | -------------------------- this function of the same name is available here, but it's shadowed by the local binding + +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`.