diff --git a/tests/ui/issues/issue-21763.rs b/tests/ui/auto-traits/hashmap-send-requires-send-contents.rs similarity index 68% rename from tests/ui/issues/issue-21763.rs rename to tests/ui/auto-traits/hashmap-send-requires-send-contents.rs index 5f236a25e9944..b543929642f3f 100644 --- a/tests/ui/issues/issue-21763.rs +++ b/tests/ui/auto-traits/hashmap-send-requires-send-contents.rs @@ -1,4 +1,5 @@ -// Regression test for HashMap only impl'ing Send/Sync if its contents do +//! Regression test for . +//! Test HashMap only impl Send/Sync if its contents do //@ normalize-stderr: "(?:[A-Za-z]:[/\\]|/).*[\\/]hashbrown\S+" -> "$$HASHBROWN_SRC_LOCATION" diff --git a/tests/ui/issues/issue-21763.stderr b/tests/ui/auto-traits/hashmap-send-requires-send-contents.stderr similarity index 89% rename from tests/ui/issues/issue-21763.stderr rename to tests/ui/auto-traits/hashmap-send-requires-send-contents.stderr index 135b705eeeff2..db37db925b00a 100644 --- a/tests/ui/issues/issue-21763.stderr +++ b/tests/ui/auto-traits/hashmap-send-requires-send-contents.stderr @@ -1,5 +1,5 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely - --> $DIR/issue-21763.rs:11:11 + --> $DIR/hashmap-send-requires-send-contents.rs:12:11 | LL | foo::, Rc<()>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely @@ -12,7 +12,7 @@ note: required because it appears within the type `hashbrown::map::HashMap, Rc<()>>` --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL note: required by a bound in `foo` - --> $DIR/issue-21763.rs:8:11 + --> $DIR/hashmap-send-requires-send-contents.rs:9:11 | LL | fn foo() {} | ^^^^ required by this bound in `foo` diff --git a/tests/ui/issues/issue-21922.rs b/tests/ui/binop/add-ref-operand-method-lookup.rs similarity index 56% rename from tests/ui/issues/issue-21922.rs rename to tests/ui/binop/add-ref-operand-method-lookup.rs index 6404ab8b7aa0f..b4573fc7658b6 100644 --- a/tests/ui/issues/issue-21922.rs +++ b/tests/ui/binop/add-ref-operand-method-lookup.rs @@ -1,3 +1,10 @@ +//! Regression test for . +//! +//! Ensure Add works with all value/reference operand combinations, +//! both via the + operator and ufcs. +//! +//! Originally method lookup failed only for x + &y. + //@ run-pass use std::ops::Add; fn show(z: i32) { diff --git a/tests/ui/issues/issue-21634.rs b/tests/ui/binop/infer-rhs-type.rs similarity index 85% rename from tests/ui/issues/issue-21634.rs rename to tests/ui/binop/infer-rhs-type.rs index 475a33eca58ec..41ad829141c63 100644 --- a/tests/ui/issues/issue-21634.rs +++ b/tests/ui/binop/infer-rhs-type.rs @@ -1,3 +1,4 @@ +//! Regression test for . //@ run-pass #[cfg(any(not(target_arch = "x86"), target_feature = "sse2"))] diff --git a/tests/ui/issues/issue-22034.rs b/tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.rs similarity index 72% rename from tests/ui/issues/issue-22034.rs rename to tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.rs index 3631c2368fe82..6572140786d2e 100644 --- a/tests/ui/issues/issue-22034.rs +++ b/tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.rs @@ -1,3 +1,5 @@ +//! Regression test for . + fn main() { let ptr: *mut () = core::ptr::null_mut(); let _: &mut dyn Fn() = unsafe { diff --git a/tests/ui/issues/issue-22034.stderr b/tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.stderr similarity index 91% rename from tests/ui/issues/issue-22034.stderr rename to tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.stderr index 68202085e77db..d0f0bcb201425 100644 --- a/tests/ui/issues/issue-22034.stderr +++ b/tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.stderr @@ -1,5 +1,5 @@ error[E0277]: expected a `Fn()` closure, found `()` - --> $DIR/issue-22034.rs:4:16 + --> $DIR/raw-ptr-to-dyn-fn-raw-ptr.rs:6:16 | LL | &mut *(ptr as *mut dyn Fn()) | ^^^ expected an `Fn()` closure, found `()` diff --git a/tests/ui/issues/issue-21974.rs b/tests/ui/issues/issue-21974.rs deleted file mode 100644 index 24e92ce7b9177..0000000000000 --- a/tests/ui/issues/issue-21974.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Test that (for now) we report an ambiguity error here, because -// specific trait relationships are ignored for the purposes of trait -// matching. This behavior should likely be improved such that this -// test passes. See #21974 for more details. - -trait Foo { - fn foo(self); -} - -fn foo<'a,'b,T>(x: &'a T, y: &'b T) - where &'a T : Foo, //~ ERROR type annotations needed - &'b T : Foo -{ - x.foo(); //~ ERROR type annotations needed - y.foo(); -} - -fn main() { } diff --git a/tests/ui/issues/issue-22008.rs b/tests/ui/issues/issue-22008.rs deleted file mode 100644 index b537ce8c2721c..0000000000000 --- a/tests/ui/issues/issue-22008.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ run-pass -pub fn main() { - let command = "a"; - - match command { - "foo" => println!("foo"), - _ => println!("{}", command), - } -} diff --git a/tests/ui/match/match-str-proper-optimization.rs b/tests/ui/match/match-str-proper-optimization.rs new file mode 100644 index 0000000000000..79c56b22d0569 --- /dev/null +++ b/tests/ui/match/match-str-proper-optimization.rs @@ -0,0 +1,14 @@ +//! Regression test for . +//! Ensure matching against `str` doesn't cause segfault when compiled +//! with `opt-level` >= 2. +// +//@ compile-flags: -C opt-level=2 +//@ run-pass +pub fn main() { + let command = "a"; + + match command { + "foo" => println!("foo"), + _ => println!("{}", command), + } +} diff --git a/tests/ui/issues/issue-21622.rs b/tests/ui/methods/nested-fn-call-shadowed-assoc-fn-variable.rs similarity index 77% rename from tests/ui/issues/issue-21622.rs rename to tests/ui/methods/nested-fn-call-shadowed-assoc-fn-variable.rs index 8dbc2c21ba951..65059cf38cd3c 100644 --- a/tests/ui/issues/issue-21622.rs +++ b/tests/ui/methods/nested-fn-call-shadowed-assoc-fn-variable.rs @@ -1,3 +1,5 @@ +//! Regression test for . + //@ check-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/tests/ui/issues/issue-2150.rs b/tests/ui/reachable/unreachable-ret-after-panic.rs similarity index 76% rename from tests/ui/issues/issue-2150.rs rename to tests/ui/reachable/unreachable-ret-after-panic.rs index baa1dde0fc2e8..db8673e5fd59b 100644 --- a/tests/ui/issues/issue-2150.rs +++ b/tests/ui/reachable/unreachable-ret-after-panic.rs @@ -1,3 +1,5 @@ +//! Regression test for . + #![deny(unreachable_code)] #![allow(unused_variables)] #![allow(dead_code)] diff --git a/tests/ui/issues/issue-2150.stderr b/tests/ui/reachable/unreachable-ret-after-panic.stderr similarity index 79% rename from tests/ui/issues/issue-2150.stderr rename to tests/ui/reachable/unreachable-ret-after-panic.stderr index a9268646edfcb..7b73ddc723042 100644 --- a/tests/ui/issues/issue-2150.stderr +++ b/tests/ui/reachable/unreachable-ret-after-panic.stderr @@ -1,5 +1,5 @@ error: unreachable statement - --> $DIR/issue-2150.rs:8:5 + --> $DIR/unreachable-ret-after-panic.rs:10:5 | LL | panic!(); | -------- any code following this expression is unreachable @@ -7,7 +7,7 @@ LL | for x in &v { i += 1; } | ^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement | note: the lint level is defined here - --> $DIR/issue-2150.rs:1:9 + --> $DIR/unreachable-ret-after-panic.rs:3:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-21546.rs b/tests/ui/resolve/module-type-name-conflict.rs similarity index 77% rename from tests/ui/issues/issue-21546.rs rename to tests/ui/resolve/module-type-name-conflict.rs index 9f3974b431470..b054fead6bc1f 100644 --- a/tests/ui/issues/issue-21546.rs +++ b/tests/ui/resolve/module-type-name-conflict.rs @@ -1,4 +1,7 @@ -// Also works as a test for #14564 +//! Regression test for . +//! Ensure structs, enums and modules cannot share name in namespace. +//! +//! Also works as a test for . #[allow(non_snake_case)] mod Foo { } diff --git a/tests/ui/issues/issue-21546.stderr b/tests/ui/resolve/module-type-name-conflict.stderr similarity index 87% rename from tests/ui/issues/issue-21546.stderr rename to tests/ui/resolve/module-type-name-conflict.stderr index 5fd06fc673361..fd5649cfc4512 100644 --- a/tests/ui/issues/issue-21546.stderr +++ b/tests/ui/resolve/module-type-name-conflict.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `Foo` is defined multiple times - --> $DIR/issue-21546.rs:7:1 + --> $DIR/module-type-name-conflict.rs:10:1 | LL | mod Foo { } | ------- previous definition of the module `Foo` here @@ -10,7 +10,7 @@ LL | struct Foo; = note: `Foo` must be defined only once in the type namespace of this module error[E0428]: the name `Bar` is defined multiple times - --> $DIR/issue-21546.rs:14:1 + --> $DIR/module-type-name-conflict.rs:17:1 | LL | mod Bar { } | ------- previous definition of the module `Bar` here @@ -21,7 +21,7 @@ LL | struct Bar(i32); = note: `Bar` must be defined only once in the type namespace of this module error[E0428]: the name `Baz` is defined multiple times - --> $DIR/issue-21546.rs:22:1 + --> $DIR/module-type-name-conflict.rs:25:1 | LL | struct Baz(i32); | ---------------- previous definition of the type `Baz` here @@ -32,7 +32,7 @@ LL | mod Baz { } = note: `Baz` must be defined only once in the type namespace of this module error[E0428]: the name `Qux` is defined multiple times - --> $DIR/issue-21546.rs:30:1 + --> $DIR/module-type-name-conflict.rs:33:1 | LL | struct Qux { x: bool } | ---------- previous definition of the type `Qux` here @@ -43,7 +43,7 @@ LL | mod Qux { } = note: `Qux` must be defined only once in the type namespace of this module error[E0428]: the name `Quux` is defined multiple times - --> $DIR/issue-21546.rs:38:1 + --> $DIR/module-type-name-conflict.rs:41:1 | LL | struct Quux; | ------------ previous definition of the type `Quux` here @@ -54,7 +54,7 @@ LL | mod Quux { } = note: `Quux` must be defined only once in the type namespace of this module error[E0428]: the name `Corge` is defined multiple times - --> $DIR/issue-21546.rs:46:1 + --> $DIR/module-type-name-conflict.rs:49:1 | LL | enum Corge { A, B } | ---------- previous definition of the type `Corge` here diff --git a/tests/ui/traits/ambiguous-trait-matching-distinct-lifetimes.rs b/tests/ui/traits/ambiguous-trait-matching-distinct-lifetimes.rs new file mode 100644 index 0000000000000..d5cf73b42f561 --- /dev/null +++ b/tests/ui/traits/ambiguous-trait-matching-distinct-lifetimes.rs @@ -0,0 +1,20 @@ +//! . +//! +//! Test that (for now) we report an ambiguity error here, because +//! specific trait relationships are ignored for the purposes of trait +//! matching. This behavior should likely be improved such that this +//! test passes. + +trait Foo { + fn foo(self); +} + +fn foo<'a,'b,T>(x: &'a T, y: &'b T) + where &'a T : Foo, //~ ERROR type annotations needed + &'b T : Foo +{ + x.foo(); //~ ERROR type annotations needed + y.foo(); +} + +fn main() { } diff --git a/tests/ui/issues/issue-21974.stderr b/tests/ui/traits/ambiguous-trait-matching-distinct-lifetimes.stderr similarity index 73% rename from tests/ui/issues/issue-21974.stderr rename to tests/ui/traits/ambiguous-trait-matching-distinct-lifetimes.stderr index cc9164e5621b8..d2d7df466512d 100644 --- a/tests/ui/issues/issue-21974.stderr +++ b/tests/ui/traits/ambiguous-trait-matching-distinct-lifetimes.stderr @@ -1,11 +1,11 @@ error[E0283]: type annotations needed: cannot satisfy `&'a T: Foo` - --> $DIR/issue-21974.rs:11:19 + --> $DIR/ambiguous-trait-matching-distinct-lifetimes.rs:13:19 | LL | where &'a T : Foo, | ^^^ | note: multiple `impl`s or `where` clauses satisfying `&'a T: Foo` found - --> $DIR/issue-21974.rs:11:19 + --> $DIR/ambiguous-trait-matching-distinct-lifetimes.rs:13:19 | LL | where &'a T : Foo, | ^^^ @@ -13,13 +13,13 @@ LL | &'b T : Foo | ^^^ error[E0283]: type annotations needed: cannot satisfy `&T: Foo` - --> $DIR/issue-21974.rs:14:7 + --> $DIR/ambiguous-trait-matching-distinct-lifetimes.rs:16:7 | LL | x.foo(); | ^^^ | note: multiple `impl`s or `where` clauses satisfying `&T: Foo` found - --> $DIR/issue-21974.rs:11:19 + --> $DIR/ambiguous-trait-matching-distinct-lifetimes.rs:13:19 | LL | where &'a T : Foo, | ^^^ diff --git a/tests/ui/issues/issue-21701.rs b/tests/ui/typeck/call-non-fn-type-param.rs similarity index 74% rename from tests/ui/issues/issue-21701.rs rename to tests/ui/typeck/call-non-fn-type-param.rs index bfa03c5e42f8d..993d585bd2185 100644 --- a/tests/ui/issues/issue-21701.rs +++ b/tests/ui/typeck/call-non-fn-type-param.rs @@ -1,3 +1,5 @@ +//! Regression test for . + fn foo(t: U) { let y = t(); //~^ ERROR: expected function, found `U` diff --git a/tests/ui/issues/issue-21701.stderr b/tests/ui/typeck/call-non-fn-type-param.stderr similarity index 89% rename from tests/ui/issues/issue-21701.stderr rename to tests/ui/typeck/call-non-fn-type-param.stderr index 9f1fe7dde735a..f62b571a5d9ad 100644 --- a/tests/ui/issues/issue-21701.stderr +++ b/tests/ui/typeck/call-non-fn-type-param.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found `U` - --> $DIR/issue-21701.rs:2:13 + --> $DIR/call-non-fn-type-param.rs:4:13 | LL | fn foo(t: U) { | - `t` has type `U` @@ -9,7 +9,7 @@ LL | let y = t(); | call expression requires function error[E0618]: expected function, found struct `Bar` - --> $DIR/issue-21701.rs:9:13 + --> $DIR/call-non-fn-type-param.rs:11:13 | LL | struct Bar; | ---------- struct `Bar` defined here