diff --git a/tests/ui/issues/issue-26614.rs b/tests/ui/associated-types/associated-type-const-nomalization.rs similarity index 71% rename from tests/ui/issues/issue-26614.rs rename to tests/ui/associated-types/associated-type-const-nomalization.rs index 576c7545924b3..b7951ba9a435c 100644 --- a/tests/ui/issues/issue-26614.rs +++ b/tests/ui/associated-types/associated-type-const-nomalization.rs @@ -1,3 +1,4 @@ +//! regression test for //@ check-pass trait Mirror { diff --git a/tests/ui/cast/cast-enum-const.rs b/tests/ui/cast/cast-enum-const.rs new file mode 100644 index 0000000000000..cfad40c07b0e5 --- /dev/null +++ b/tests/ui/cast/cast-enum-const.rs @@ -0,0 +1,12 @@ +//! regression test for +//@ run-pass + +fn main() { + const QUUX: isize = 5; + + enum Stuff { + Bar = QUUX, + } + + assert_eq!(Stuff::Bar as isize, QUUX); +} diff --git a/tests/ui/issues/issue-22403.rs b/tests/ui/cast/cast-to-box-arr.rs similarity index 61% rename from tests/ui/issues/issue-22403.rs rename to tests/ui/cast/cast-to-box-arr.rs index 89c956913f932..1a9004cd074ef 100644 --- a/tests/ui/issues/issue-22403.rs +++ b/tests/ui/cast/cast-to-box-arr.rs @@ -1,3 +1,4 @@ +//! regression test for //@ run-pass fn main() { let x = Box::new([1, 2, 3]); diff --git a/tests/ui/issues/issue-41998.rs b/tests/ui/cast/cast-to-char-compare.rs similarity index 64% rename from tests/ui/issues/issue-41998.rs rename to tests/ui/cast/cast-to-char-compare.rs index 303bf7a575138..159b8ee04e028 100644 --- a/tests/ui/issues/issue-41998.rs +++ b/tests/ui/cast/cast-to-char-compare.rs @@ -1,6 +1,6 @@ +//! regression test for //@ check-pass - fn main() { if ('x' as char) < ('y' as char) { print!("x"); diff --git a/tests/ui/consts/const-static-ref-to-closure.rs b/tests/ui/consts/const-static-ref-to-closure.rs new file mode 100644 index 0000000000000..06b5ca5a935ca --- /dev/null +++ b/tests/ui/consts/const-static-ref-to-closure.rs @@ -0,0 +1,7 @@ +//! regression test for +//@ check-pass +#![allow(dead_code)] + +const X: &'static dyn Fn() = &|| println!("ICE here"); + +fn main() {} diff --git a/tests/ui/issues/issue-29030.rs b/tests/ui/derives/derive-debug-generic-with-lifetime.rs similarity index 66% rename from tests/ui/issues/issue-29030.rs rename to tests/ui/derives/derive-debug-generic-with-lifetime.rs index c92853fb5dc2f..430ade071795d 100644 --- a/tests/ui/issues/issue-29030.rs +++ b/tests/ui/derives/derive-debug-generic-with-lifetime.rs @@ -1,3 +1,4 @@ +//! regression test for //@ check-pass #![allow(dead_code)] #[derive(Debug)] diff --git a/tests/ui/issues/issue-25394.rs b/tests/ui/derives/derive-debug-newtype-unsized-slice.rs similarity index 54% rename from tests/ui/issues/issue-25394.rs rename to tests/ui/derives/derive-debug-newtype-unsized-slice.rs index 689c9f33af029..c735d9f039d2d 100644 --- a/tests/ui/issues/issue-25394.rs +++ b/tests/ui/derives/derive-debug-newtype-unsized-slice.rs @@ -1,3 +1,4 @@ +//! regression test for //@ check-pass #![allow(dead_code)] #[derive(Debug)] diff --git a/tests/ui/issues/issue-33687.rs b/tests/ui/fn_traits/call-unit-struct-impl-fn-once.rs similarity index 79% rename from tests/ui/issues/issue-33687.rs rename to tests/ui/fn_traits/call-unit-struct-impl-fn-once.rs index a5693b3aca8e4..15554482931b7 100644 --- a/tests/ui/issues/issue-33687.rs +++ b/tests/ui/fn_traits/call-unit-struct-impl-fn-once.rs @@ -1,3 +1,4 @@ +//! regression test for //@ run-pass #![feature(unboxed_closures)] #![feature(fn_traits)] diff --git a/tests/ui/issues/issue-20847.rs b/tests/ui/fn_traits/fn-trait-explicit-call.rs similarity index 65% rename from tests/ui/issues/issue-20847.rs rename to tests/ui/fn_traits/fn-trait-explicit-call.rs index 364b07bf6922f..f37e0a558baa6 100644 --- a/tests/ui/issues/issue-20847.rs +++ b/tests/ui/fn_traits/fn-trait-explicit-call.rs @@ -1,3 +1,4 @@ +//! regression test for //@ run-pass #![feature(fn_traits)] diff --git a/tests/ui/issues/issue-11384.rs b/tests/ui/issues/issue-11384.rs deleted file mode 100644 index ad0affa4b0d25..0000000000000 --- a/tests/ui/issues/issue-11384.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ check-pass - -trait Common { fn dummy(&self) { } } - -impl<'t, T> Common for (T, &'t T) {} - -impl<'t, T> Common for (&'t T, T) {} - -fn main() {} diff --git a/tests/ui/issues/issue-19601.rs b/tests/ui/issues/issue-19601.rs deleted file mode 100644 index e97819e4122da..0000000000000 --- a/tests/ui/issues/issue-19601.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ check-pass - -trait A {} -struct B where B: A> { t: T } - -fn main() {} diff --git a/tests/ui/issues/issue-20676.rs b/tests/ui/issues/issue-20676.rs deleted file mode 100644 index 2059365c7d628..0000000000000 --- a/tests/ui/issues/issue-20676.rs +++ /dev/null @@ -1,12 +0,0 @@ -//@ run-pass -// Regression test for #20676. Error was that we didn't support -// UFCS-style calls to a method in `Trait` where `Self` was bound to a -// trait object of type `Trait`. See also `ufcs-trait-object.rs`. - - -use std::fmt; - -fn main() { - let a: &dyn fmt::Debug = &1; - let _ = format!("{:?}", a); -} diff --git a/tests/ui/issues/issue-22426.rs b/tests/ui/issues/issue-22426.rs deleted file mode 100644 index 0857ac9dfb4d1..0000000000000 --- a/tests/ui/issues/issue-22426.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ run-pass - -fn main() { - match 42 { - x if x < 7 => (), - _ => () - } -} diff --git a/tests/ui/issues/issue-2428.rs b/tests/ui/issues/issue-2428.rs deleted file mode 100644 index 9cb02460f35b7..0000000000000 --- a/tests/ui/issues/issue-2428.rs +++ /dev/null @@ -1,14 +0,0 @@ -//@ run-pass -#![allow(non_upper_case_globals)] - - -pub fn main() { - let _foo = 100; - const quux: isize = 5; - - enum Stuff { - Bar = quux - } - - assert_eq!(Stuff::Bar as isize, quux); -} diff --git a/tests/ui/issues/issue-24389.rs b/tests/ui/issues/issue-24389.rs deleted file mode 100644 index 95bb2af9b25c5..0000000000000 --- a/tests/ui/issues/issue-24389.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ check-pass -#![allow(dead_code)] - -struct Foo; - -impl Foo { - fn new() -> Self { Foo } - fn bar() { Self::new(); } -} - -fn main() {} diff --git a/tests/ui/issues/issue-25180.rs b/tests/ui/issues/issue-25180.rs deleted file mode 100644 index 339aca0375465..0000000000000 --- a/tests/ui/issues/issue-25180.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ check-pass -#![allow(dead_code)] -#![allow(non_upper_case_globals)] - -const x: &'static dyn Fn() = &|| println!("ICE here"); - -fn main() {} diff --git a/tests/ui/issues/issue-27639.rs b/tests/ui/issues/issue-27639.rs deleted file mode 100644 index 95edcb8695e21..0000000000000 --- a/tests/ui/issues/issue-27639.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ run-pass -#![allow(dead_code)] -#![allow(non_upper_case_globals)] - -fn main() { - const iter: i32 = 0; - - for i in 1..10 { - println!("{}", i); - } -} diff --git a/tests/ui/issues/auxiliary/i8.rs b/tests/ui/resolve/auxiliary/i8.rs similarity index 100% rename from tests/ui/issues/auxiliary/i8.rs rename to tests/ui/resolve/auxiliary/i8.rs diff --git a/tests/ui/resolve/const-iter-no-conflict-for-loop.rs b/tests/ui/resolve/const-iter-no-conflict-for-loop.rs new file mode 100644 index 0000000000000..ddbba64e5a31f --- /dev/null +++ b/tests/ui/resolve/const-iter-no-conflict-for-loop.rs @@ -0,0 +1,15 @@ +//! regression test for +//! Ensure that a constant named `iter` does not +//! interfere with the name resolution of the `iter` methods used internally +//! by `for` loops +//@ run-pass +#![allow(dead_code)] +#![allow(non_upper_case_globals)] + +fn main() { + const iter: i32 = 0; + + for i in 1..10 { + println!("{}", i); + } +} diff --git a/tests/ui/issues/issue-20427.rs b/tests/ui/resolve/shadow-primitives.rs similarity index 69% rename from tests/ui/issues/issue-20427.rs rename to tests/ui/resolve/shadow-primitives.rs index 4018043c371ee..17da0cd0530c2 100644 --- a/tests/ui/issues/issue-20427.rs +++ b/tests/ui/resolve/shadow-primitives.rs @@ -1,3 +1,4 @@ +//! regression test for //@ run-pass #![allow(dead_code)] #![allow(unused_variables)] @@ -31,17 +32,10 @@ mod char { mod char_ {} mod str { - use super::i8 as i8; - use super::i32_ as i32; - use super::i64_ as i64; - use super::u8_ as u8; - use super::f_ as f64; - use super::u16_ as u16; - use super::u32_ as u32; - use super::u64_ as u64; - use super::bool_ as bool; - use super::{bool_ as str}; - use super::char_ as char; + use super::{ + bool_ as bool, bool_ as str, char_ as char, f_ as f64, i8, i32_ as i32, i64_ as i64, + u8_ as u8, u16_ as u16, u32_ as u32, u64_ as u64, + }; } } @@ -49,7 +43,9 @@ trait isize_ { type isize; } -fn usize<'usize>(usize: &'usize usize) -> &'usize usize { usize } +fn usize<'usize>(usize: &'usize usize) -> &'usize usize { + usize +} mod reuse { use std::mem::size_of; @@ -68,9 +64,10 @@ mod reuse { mod guard { pub fn check() { use std::u8; // bring module u8 in scope - fn f() -> u8 { // OK, resolves to primitive u8, not to std::u8 + fn f() -> u8 { + // OK, resolves to primitive u8, not to std::u8 u8::max_value() // OK, resolves to associated function ::max_value, - // not to non-existent std::u8::max_value + // not to non-existent std::u8::max_value } assert_eq!(f(), u8::MAX); // OK, resolves to std::u8::MAX } @@ -79,7 +76,13 @@ mod guard { fn main() { let bool = true; let _ = match bool { - str @ true => if str { i32 as i64 } else { i64 }, + str @ true => { + if str { + i32 as i64 + } else { + i64 + } + } false => i64, }; diff --git a/tests/ui/self/self-in-method-body-resolves.rs b/tests/ui/self/self-in-method-body-resolves.rs new file mode 100644 index 0000000000000..636922cd87ce6 --- /dev/null +++ b/tests/ui/self/self-in-method-body-resolves.rs @@ -0,0 +1,16 @@ +//! regression test for +//@ check-pass +#![allow(dead_code)] + +struct Foo; + +impl Foo { + fn new() -> Self { + Foo + } + fn bar() { + Self::new(); + } +} + +fn main() {} diff --git a/tests/ui/traits/bound/recursive-trait-bound-on-type-param.rs b/tests/ui/traits/bound/recursive-trait-bound-on-type-param.rs new file mode 100644 index 0000000000000..41ae91afad49a --- /dev/null +++ b/tests/ui/traits/bound/recursive-trait-bound-on-type-param.rs @@ -0,0 +1,12 @@ +//! regression test for +//@ check-pass + +trait A {} +struct B +where + B: A>, +{ + t: T, +} + +fn main() {} diff --git a/tests/ui/typeck/tuple-ref-order-distinct-impls.rs b/tests/ui/typeck/tuple-ref-order-distinct-impls.rs new file mode 100644 index 0000000000000..fdede8a1d9c44 --- /dev/null +++ b/tests/ui/typeck/tuple-ref-order-distinct-impls.rs @@ -0,0 +1,12 @@ +//! regression test for +//@ check-pass + +trait Common { + fn dummy(&self) {} +} + +impl<'t, T> Common for (T, &'t T) {} + +impl<'t, T> Common for (&'t T, T) {} + +fn main() {} diff --git a/tests/ui/ufcs/ufcs-trait-object-format.rs b/tests/ui/ufcs/ufcs-trait-object-format.rs new file mode 100644 index 0000000000000..7d50a24448069 --- /dev/null +++ b/tests/ui/ufcs/ufcs-trait-object-format.rs @@ -0,0 +1,13 @@ +//@ run-pass +//! Regression test for . +//! Error was that we didn't support +//! UFCS-style calls to a method in `Trait` where `Self` was bound to a +//! trait object of type `Trait`. +//! See also . + +use std::fmt; + +fn main() { + let a: &dyn fmt::Debug = &1; + let _ = format!("{:?}", a); +}