From 25e395653df2a91fc9a76dfd3ef050f1c7ba9fca Mon Sep 17 00:00:00 2001 From: Caio Date: Sun, 14 May 2023 09:49:20 -0300 Subject: Move tests --- tests/ui/async-await/issue-78115.rs | 19 ++++++++++++++++++ tests/ui/coercion/issue-3794.rs | 32 +++++++++++++++++++++++++++++++ tests/ui/consts/issue-16538.mir.stderr | 29 ++++++++++++++++++++++++++++ tests/ui/consts/issue-16538.rs | 19 ++++++++++++++++++ tests/ui/consts/issue-16538.thir.stderr | 29 ++++++++++++++++++++++++++++ tests/ui/consts/issue-28822.rs | 7 +++++++ tests/ui/enum-discriminant/issue-50689.rs | 9 +++++++++ tests/ui/extern/issue-1251.rs | 16 ++++++++++++++++ tests/ui/for-loop-while/issue-1257.rs | 11 +++++++++++ tests/ui/issue-94866.rs | 14 -------------- tests/ui/issue-94866.stderr | 21 -------------------- tests/ui/issues/issue-1251.rs | 16 ---------------- tests/ui/issues/issue-1257.rs | 11 ----------- tests/ui/issues/issue-16538.mir.stderr | 29 ---------------------------- tests/ui/issues/issue-16538.rs | 19 ------------------ tests/ui/issues/issue-16538.thir.stderr | 29 ---------------------------- tests/ui/issues/issue-1871.rs | 12 ------------ tests/ui/issues/issue-1871.stderr | 9 --------- tests/ui/issues/issue-2063-resource.rs | 14 -------------- tests/ui/issues/issue-2063.rs | 22 --------------------- tests/ui/issues/issue-28822.rs | 7 ------- tests/ui/issues/issue-29798.rs | 11 ----------- tests/ui/issues/issue-3008-1.rs | 12 ------------ tests/ui/issues/issue-3008-1.stderr | 17 ---------------- tests/ui/issues/issue-3008-2.rs | 6 ------ tests/ui/issues/issue-3008-2.stderr | 14 -------------- tests/ui/issues/issue-3008-3.rs | 10 ---------- tests/ui/issues/issue-3008-3.stderr | 14 -------------- tests/ui/issues/issue-3794.rs | 32 ------------------------------- tests/ui/issues/issue-50689.rs | 9 --------- tests/ui/issues/issue-50825-1.rs | 22 --------------------- tests/ui/issues/issue-50825.rs | 15 --------------- tests/ui/issues/issue-78115.rs | 19 ------------------ tests/ui/mir/issue-29798.rs | 11 +++++++++++ tests/ui/pattern/issue-94866.rs | 14 ++++++++++++++ tests/ui/pattern/issue-94866.stderr | 21 ++++++++++++++++++++ tests/ui/recursion/issue-3008-1.rs | 12 ++++++++++++ tests/ui/recursion/issue-3008-1.stderr | 17 ++++++++++++++++ tests/ui/recursion/issue-3008-2.rs | 6 ++++++ tests/ui/recursion/issue-3008-2.stderr | 14 ++++++++++++++ tests/ui/recursion/issue-3008-3.rs | 10 ++++++++++ tests/ui/recursion/issue-3008-3.stderr | 14 ++++++++++++++ tests/ui/typeck/issue-1871.rs | 12 ++++++++++++ tests/ui/typeck/issue-1871.stderr | 9 +++++++++ tests/ui/typeck/issue-2063-resource.rs | 14 ++++++++++++++ tests/ui/typeck/issue-2063.rs | 22 +++++++++++++++++++++ tests/ui/where-clauses/issue-50825-1.rs | 22 +++++++++++++++++++++ tests/ui/where-clauses/issue-50825.rs | 15 +++++++++++++++ 48 files changed, 384 insertions(+), 384 deletions(-) create mode 100644 tests/ui/async-await/issue-78115.rs create mode 100644 tests/ui/coercion/issue-3794.rs create mode 100644 tests/ui/consts/issue-16538.mir.stderr create mode 100644 tests/ui/consts/issue-16538.rs create mode 100644 tests/ui/consts/issue-16538.thir.stderr create mode 100644 tests/ui/consts/issue-28822.rs create mode 100644 tests/ui/enum-discriminant/issue-50689.rs create mode 100644 tests/ui/extern/issue-1251.rs create mode 100644 tests/ui/for-loop-while/issue-1257.rs delete mode 100644 tests/ui/issue-94866.rs delete mode 100644 tests/ui/issue-94866.stderr delete mode 100644 tests/ui/issues/issue-1251.rs delete mode 100644 tests/ui/issues/issue-1257.rs delete mode 100644 tests/ui/issues/issue-16538.mir.stderr delete mode 100644 tests/ui/issues/issue-16538.rs delete mode 100644 tests/ui/issues/issue-16538.thir.stderr delete mode 100644 tests/ui/issues/issue-1871.rs delete mode 100644 tests/ui/issues/issue-1871.stderr delete mode 100644 tests/ui/issues/issue-2063-resource.rs delete mode 100644 tests/ui/issues/issue-2063.rs delete mode 100644 tests/ui/issues/issue-28822.rs delete mode 100644 tests/ui/issues/issue-29798.rs delete mode 100644 tests/ui/issues/issue-3008-1.rs delete mode 100644 tests/ui/issues/issue-3008-1.stderr delete mode 100644 tests/ui/issues/issue-3008-2.rs delete mode 100644 tests/ui/issues/issue-3008-2.stderr delete mode 100644 tests/ui/issues/issue-3008-3.rs delete mode 100644 tests/ui/issues/issue-3008-3.stderr delete mode 100644 tests/ui/issues/issue-3794.rs delete mode 100644 tests/ui/issues/issue-50689.rs delete mode 100644 tests/ui/issues/issue-50825-1.rs delete mode 100644 tests/ui/issues/issue-50825.rs delete mode 100644 tests/ui/issues/issue-78115.rs create mode 100644 tests/ui/mir/issue-29798.rs create mode 100644 tests/ui/pattern/issue-94866.rs create mode 100644 tests/ui/pattern/issue-94866.stderr create mode 100644 tests/ui/recursion/issue-3008-1.rs create mode 100644 tests/ui/recursion/issue-3008-1.stderr create mode 100644 tests/ui/recursion/issue-3008-2.rs create mode 100644 tests/ui/recursion/issue-3008-2.stderr create mode 100644 tests/ui/recursion/issue-3008-3.rs create mode 100644 tests/ui/recursion/issue-3008-3.stderr create mode 100644 tests/ui/typeck/issue-1871.rs create mode 100644 tests/ui/typeck/issue-1871.stderr create mode 100644 tests/ui/typeck/issue-2063-resource.rs create mode 100644 tests/ui/typeck/issue-2063.rs create mode 100644 tests/ui/where-clauses/issue-50825-1.rs create mode 100644 tests/ui/where-clauses/issue-50825.rs (limited to 'tests') diff --git a/tests/ui/async-await/issue-78115.rs b/tests/ui/async-await/issue-78115.rs new file mode 100644 index 00000000000..ac18470c621 --- /dev/null +++ b/tests/ui/async-await/issue-78115.rs @@ -0,0 +1,19 @@ +// Regression test for issue #78115: "ICE: variable should be placed in scope earlier" + +// check-pass +// edition:2018 + +#[allow(dead_code)] +struct Foo { + a: () +} + +async fn _bar() { + let foo = Foo { a: () }; + match foo { + Foo { a: _a } | Foo { a: _a } if true => {} + _ => {} + } +} + +fn main() {} diff --git a/tests/ui/coercion/issue-3794.rs b/tests/ui/coercion/issue-3794.rs new file mode 100644 index 00000000000..b1f028fbccb --- /dev/null +++ b/tests/ui/coercion/issue-3794.rs @@ -0,0 +1,32 @@ +// run-pass +#![allow(dead_code)] + +trait T { + fn print(&self); +} + +#[derive(Debug)] +struct S { + s: isize, +} + +impl T for S { + fn print(&self) { + println!("{:?}", self); + } +} + +fn print_t(t: &dyn T) { + t.print(); +} + +fn print_s(s: &S) { + s.print(); +} + +pub fn main() { + let s: Box = Box::new(S { s: 5 }); + print_s(&*s); + let t: Box = s as Box; + print_t(&*t); +} diff --git a/tests/ui/consts/issue-16538.mir.stderr b/tests/ui/consts/issue-16538.mir.stderr new file mode 100644 index 00000000000..e320df4b7ad --- /dev/null +++ b/tests/ui/consts/issue-16538.mir.stderr @@ -0,0 +1,29 @@ +error[E0015]: cannot call non-const fn `Y::foo` in statics + --> $DIR/issue-16538.rs:14:23 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell + +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/issue-16538.rs:14:30 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); + | ^^^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior + +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/issue-16538.rs:14:21 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer + | + = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0015, E0133. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/issue-16538.rs b/tests/ui/consts/issue-16538.rs new file mode 100644 index 00000000000..270fa301414 --- /dev/null +++ b/tests/ui/consts/issue-16538.rs @@ -0,0 +1,19 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + +mod Y { + pub type X = usize; + extern "C" { + pub static x: *const usize; + } + pub fn foo(value: *const X) -> *const X { + value + } +} + +static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); +//~^ ERROR dereference of raw pointer +//~| ERROR E0015 +//~| ERROR use of extern static is unsafe and requires + +fn main() {} diff --git a/tests/ui/consts/issue-16538.thir.stderr b/tests/ui/consts/issue-16538.thir.stderr new file mode 100644 index 00000000000..4a862869274 --- /dev/null +++ b/tests/ui/consts/issue-16538.thir.stderr @@ -0,0 +1,29 @@ +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/issue-16538.rs:14:22 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer + | + = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior + +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/issue-16538.rs:14:30 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); + | ^^^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior + +error[E0015]: cannot call non-const fn `Y::foo` in statics + --> $DIR/issue-16538.rs:14:23 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0015, E0133. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/issue-28822.rs b/tests/ui/consts/issue-28822.rs new file mode 100644 index 00000000000..10e5d1dd0ac --- /dev/null +++ b/tests/ui/consts/issue-28822.rs @@ -0,0 +1,7 @@ +// check-pass +#![allow(dead_code)] + +fn main() {} + +const fn size_ofs(_: usize) {} +const fn size_ofs2(_foo: usize) {} diff --git a/tests/ui/enum-discriminant/issue-50689.rs b/tests/ui/enum-discriminant/issue-50689.rs new file mode 100644 index 00000000000..b49f2950020 --- /dev/null +++ b/tests/ui/enum-discriminant/issue-50689.rs @@ -0,0 +1,9 @@ +// run-pass +#![allow(unused_variables)] +enum Foo { + Bar = (|x: i32| { }, 42).1, +} + +fn main() { + assert_eq!(Foo::Bar as usize, 42); +} diff --git a/tests/ui/extern/issue-1251.rs b/tests/ui/extern/issue-1251.rs new file mode 100644 index 00000000000..c2c047c7961 --- /dev/null +++ b/tests/ui/extern/issue-1251.rs @@ -0,0 +1,16 @@ +// build-pass +#![allow(unused_attributes)] +#![allow(dead_code)] +// pretty-expanded FIXME #23616 +// ignore-wasm32-bare no libc to test ffi with +#![feature(rustc_private)] + +mod rustrt { + extern crate libc; + + extern "C" { + pub fn rust_get_test_int() -> libc::intptr_t; + } +} + +pub fn main() {} diff --git a/tests/ui/for-loop-while/issue-1257.rs b/tests/ui/for-loop-while/issue-1257.rs new file mode 100644 index 00000000000..de5a6d35925 --- /dev/null +++ b/tests/ui/for-loop-while/issue-1257.rs @@ -0,0 +1,11 @@ +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main () { + let mut line = "".to_string(); + let mut i = 0; + while line != "exit".to_string() { + line = if i == 9 { "exit".to_string() } else { "notexit".to_string() }; + i += 1; + } +} diff --git a/tests/ui/issue-94866.rs b/tests/ui/issue-94866.rs deleted file mode 100644 index c4203487936..00000000000 --- a/tests/ui/issue-94866.rs +++ /dev/null @@ -1,14 +0,0 @@ -macro_rules! m { - () => { - {} - }; -} - -enum Enum { A, B } - -fn main() { - match Enum::A { - //~^ ERROR non-exhaustive patterns - Enum::A => m!() - } -} diff --git a/tests/ui/issue-94866.stderr b/tests/ui/issue-94866.stderr deleted file mode 100644 index b3c17ce8974..00000000000 --- a/tests/ui/issue-94866.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0004]: non-exhaustive patterns: `Enum::B` not covered - --> $DIR/issue-94866.rs:10:11 - | -LL | match Enum::A { - | ^^^^^^^ pattern `Enum::B` not covered - | -note: `Enum` defined here - --> $DIR/issue-94866.rs:7:16 - | -LL | enum Enum { A, B } - | ---- ^ not covered - = note: the matched value is of type `Enum` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown - | -LL ~ Enum::A => m!(), -LL + Enum::B => todo!() - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0004`. diff --git a/tests/ui/issues/issue-1251.rs b/tests/ui/issues/issue-1251.rs deleted file mode 100644 index c2c047c7961..00000000000 --- a/tests/ui/issues/issue-1251.rs +++ /dev/null @@ -1,16 +0,0 @@ -// build-pass -#![allow(unused_attributes)] -#![allow(dead_code)] -// pretty-expanded FIXME #23616 -// ignore-wasm32-bare no libc to test ffi with -#![feature(rustc_private)] - -mod rustrt { - extern crate libc; - - extern "C" { - pub fn rust_get_test_int() -> libc::intptr_t; - } -} - -pub fn main() {} diff --git a/tests/ui/issues/issue-1257.rs b/tests/ui/issues/issue-1257.rs deleted file mode 100644 index de5a6d35925..00000000000 --- a/tests/ui/issues/issue-1257.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main () { - let mut line = "".to_string(); - let mut i = 0; - while line != "exit".to_string() { - line = if i == 9 { "exit".to_string() } else { "notexit".to_string() }; - i += 1; - } -} diff --git a/tests/ui/issues/issue-16538.mir.stderr b/tests/ui/issues/issue-16538.mir.stderr deleted file mode 100644 index e320df4b7ad..00000000000 --- a/tests/ui/issues/issue-16538.mir.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error[E0015]: cannot call non-const fn `Y::foo` in statics - --> $DIR/issue-16538.rs:14:23 - | -LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: calls in statics are limited to constant functions, tuple structs and tuple variants - = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-16538.rs:14:30 - | -LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); - | ^^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-16538.rs:14:21 - | -LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0015, E0133. -For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/issues/issue-16538.rs b/tests/ui/issues/issue-16538.rs deleted file mode 100644 index 270fa301414..00000000000 --- a/tests/ui/issues/issue-16538.rs +++ /dev/null @@ -1,19 +0,0 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - -mod Y { - pub type X = usize; - extern "C" { - pub static x: *const usize; - } - pub fn foo(value: *const X) -> *const X { - value - } -} - -static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); -//~^ ERROR dereference of raw pointer -//~| ERROR E0015 -//~| ERROR use of extern static is unsafe and requires - -fn main() {} diff --git a/tests/ui/issues/issue-16538.thir.stderr b/tests/ui/issues/issue-16538.thir.stderr deleted file mode 100644 index 4a862869274..00000000000 --- a/tests/ui/issues/issue-16538.thir.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-16538.rs:14:22 - | -LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-16538.rs:14:30 - | -LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); - | ^^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0015]: cannot call non-const fn `Y::foo` in statics - --> $DIR/issue-16538.rs:14:23 - | -LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: calls in statics are limited to constant functions, tuple structs and tuple variants - = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0015, E0133. -For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/issues/issue-1871.rs b/tests/ui/issues/issue-1871.rs deleted file mode 100644 index f7a2bdd5659..00000000000 --- a/tests/ui/issues/issue-1871.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Tests that we don't generate a spurious error about f.honk's type -// being undeterminable -fn main() { - let f = 42; - - let _g = if f < 5 { - f.honk() //~ ERROR no method named `honk` found - } - else { - () - }; -} diff --git a/tests/ui/issues/issue-1871.stderr b/tests/ui/issues/issue-1871.stderr deleted file mode 100644 index b774ca22dd7..00000000000 --- a/tests/ui/issues/issue-1871.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0599]: no method named `honk` found for type `{integer}` in the current scope - --> $DIR/issue-1871.rs:7:9 - | -LL | f.honk() - | ^^^^ method not found in `{integer}` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-2063-resource.rs b/tests/ui/issues/issue-2063-resource.rs deleted file mode 100644 index 1d0527447ba..00000000000 --- a/tests/ui/issues/issue-2063-resource.rs +++ /dev/null @@ -1,14 +0,0 @@ -// check-pass -#![allow(dead_code)] -// test that autoderef of a type like this does not -// cause compiler to loop. Note that no instances -// of such a type could ever be constructed. - -struct S { - x: X, - to_str: (), -} - -struct X(Box); - -fn main() {} diff --git a/tests/ui/issues/issue-2063.rs b/tests/ui/issues/issue-2063.rs deleted file mode 100644 index f08f9d4cfe4..00000000000 --- a/tests/ui/issues/issue-2063.rs +++ /dev/null @@ -1,22 +0,0 @@ -// run-pass -// test that autoderef of a type like this does not -// cause compiler to loop. Note that no instances -// of such a type could ever be constructed. - -struct T(#[allow(unused_tuple_struct_fields)] Box); - -trait ToStr2 { - fn my_to_string(&self) -> String; -} - -impl ToStr2 for T { - fn my_to_string(&self) -> String { "t".to_string() } -} - -#[allow(dead_code)] -fn new_t(x: T) { - x.my_to_string(); -} - -fn main() { -} diff --git a/tests/ui/issues/issue-28822.rs b/tests/ui/issues/issue-28822.rs deleted file mode 100644 index 10e5d1dd0ac..00000000000 --- a/tests/ui/issues/issue-28822.rs +++ /dev/null @@ -1,7 +0,0 @@ -// check-pass -#![allow(dead_code)] - -fn main() {} - -const fn size_ofs(_: usize) {} -const fn size_ofs2(_foo: usize) {} diff --git a/tests/ui/issues/issue-29798.rs b/tests/ui/issues/issue-29798.rs deleted file mode 100644 index 5eff5d1915b..00000000000 --- a/tests/ui/issues/issue-29798.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-fail -// error-pattern:index out of bounds: the len is 5 but the index is 5 -// ignore-emscripten no processes - -const fn test(x: usize) -> i32 { - [42;5][x] -} - -fn main () { - let _ = test(5); -} diff --git a/tests/ui/issues/issue-3008-1.rs b/tests/ui/issues/issue-3008-1.rs deleted file mode 100644 index 1124969e6d0..00000000000 --- a/tests/ui/issues/issue-3008-1.rs +++ /dev/null @@ -1,12 +0,0 @@ -enum Foo { - Foo_(Bar) -} - -enum Bar { - //~^ ERROR recursive type `Bar` has infinite size - BarNone, - BarSome(Bar) -} - -fn main() { -} diff --git a/tests/ui/issues/issue-3008-1.stderr b/tests/ui/issues/issue-3008-1.stderr deleted file mode 100644 index be25b9091d5..00000000000 --- a/tests/ui/issues/issue-3008-1.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0072]: recursive type `Bar` has infinite size - --> $DIR/issue-3008-1.rs:5:1 - | -LL | enum Bar { - | ^^^^^^^^ -... -LL | BarSome(Bar) - | --- recursive without indirection - | -help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle - | -LL | BarSome(Box) - | ++++ + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-3008-2.rs b/tests/ui/issues/issue-3008-2.rs deleted file mode 100644 index 5846c69da41..00000000000 --- a/tests/ui/issues/issue-3008-2.rs +++ /dev/null @@ -1,6 +0,0 @@ -enum Foo { Foo_(Bar) } -struct Bar { x: Bar } -//~^ ERROR E0072 - -fn main() { -} diff --git a/tests/ui/issues/issue-3008-2.stderr b/tests/ui/issues/issue-3008-2.stderr deleted file mode 100644 index 858a8fd6af8..00000000000 --- a/tests/ui/issues/issue-3008-2.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0072]: recursive type `Bar` has infinite size - --> $DIR/issue-3008-2.rs:2:1 - | -LL | struct Bar { x: Bar } - | ^^^^^^^^^^ --- recursive without indirection - | -help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle - | -LL | struct Bar { x: Box } - | ++++ + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-3008-3.rs b/tests/ui/issues/issue-3008-3.rs deleted file mode 100644 index 212eb2eb8e0..00000000000 --- a/tests/ui/issues/issue-3008-3.rs +++ /dev/null @@ -1,10 +0,0 @@ -use std::marker; - -enum E1 { V1(E2), } -enum E2 { V2(E2, marker::PhantomData), } -//~^ ERROR recursive type `E2` has infinite size - -impl E1 { fn foo(&self) {} } - -fn main() { -} diff --git a/tests/ui/issues/issue-3008-3.stderr b/tests/ui/issues/issue-3008-3.stderr deleted file mode 100644 index a1a81e29367..00000000000 --- a/tests/ui/issues/issue-3008-3.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0072]: recursive type `E2` has infinite size - --> $DIR/issue-3008-3.rs:4:1 - | -LL | enum E2 { V2(E2, marker::PhantomData), } - | ^^^^^^^^^^ ------ recursive without indirection - | -help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle - | -LL | enum E2 { V2(Box>, marker::PhantomData), } - | ++++ + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-3794.rs b/tests/ui/issues/issue-3794.rs deleted file mode 100644 index b1f028fbccb..00000000000 --- a/tests/ui/issues/issue-3794.rs +++ /dev/null @@ -1,32 +0,0 @@ -// run-pass -#![allow(dead_code)] - -trait T { - fn print(&self); -} - -#[derive(Debug)] -struct S { - s: isize, -} - -impl T for S { - fn print(&self) { - println!("{:?}", self); - } -} - -fn print_t(t: &dyn T) { - t.print(); -} - -fn print_s(s: &S) { - s.print(); -} - -pub fn main() { - let s: Box = Box::new(S { s: 5 }); - print_s(&*s); - let t: Box = s as Box; - print_t(&*t); -} diff --git a/tests/ui/issues/issue-50689.rs b/tests/ui/issues/issue-50689.rs deleted file mode 100644 index b49f2950020..00000000000 --- a/tests/ui/issues/issue-50689.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass -#![allow(unused_variables)] -enum Foo { - Bar = (|x: i32| { }, 42).1, -} - -fn main() { - assert_eq!(Foo::Bar as usize, 42); -} diff --git a/tests/ui/issues/issue-50825-1.rs b/tests/ui/issues/issue-50825-1.rs deleted file mode 100644 index ee4316029a8..00000000000 --- a/tests/ui/issues/issue-50825-1.rs +++ /dev/null @@ -1,22 +0,0 @@ -// run-pass -// regression test for issue #50825 -// Make sure that the `impl` bound (): X is preferred over -// the (): X bound in the where clause. - -trait X { - type T; -} - -trait Y: X { - fn foo(x: &Self::T); -} - -impl X for () { - type T = (); -} - -impl Y> for () where (): Y { - fn foo(_x: &()) {} -} - -fn main () {} diff --git a/tests/ui/issues/issue-50825.rs b/tests/ui/issues/issue-50825.rs deleted file mode 100644 index 1ece2e9fc84..00000000000 --- a/tests/ui/issues/issue-50825.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-pass -// regression test for issue #50825 -// Make sure that the built-in bound {integer}: Sized is preferred over -// the u64: Sized bound in the where clause. - -fn foo(y: &[()]) -where - u64: Sized, -{ - y[0] -} - -fn main () { - foo(&[()]); -} diff --git a/tests/ui/issues/issue-78115.rs b/tests/ui/issues/issue-78115.rs deleted file mode 100644 index ac18470c621..00000000000 --- a/tests/ui/issues/issue-78115.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Regression test for issue #78115: "ICE: variable should be placed in scope earlier" - -// check-pass -// edition:2018 - -#[allow(dead_code)] -struct Foo { - a: () -} - -async fn _bar() { - let foo = Foo { a: () }; - match foo { - Foo { a: _a } | Foo { a: _a } if true => {} - _ => {} - } -} - -fn main() {} diff --git a/tests/ui/mir/issue-29798.rs b/tests/ui/mir/issue-29798.rs new file mode 100644 index 00000000000..5eff5d1915b --- /dev/null +++ b/tests/ui/mir/issue-29798.rs @@ -0,0 +1,11 @@ +// run-fail +// error-pattern:index out of bounds: the len is 5 but the index is 5 +// ignore-emscripten no processes + +const fn test(x: usize) -> i32 { + [42;5][x] +} + +fn main () { + let _ = test(5); +} diff --git a/tests/ui/pattern/issue-94866.rs b/tests/ui/pattern/issue-94866.rs new file mode 100644 index 00000000000..c4203487936 --- /dev/null +++ b/tests/ui/pattern/issue-94866.rs @@ -0,0 +1,14 @@ +macro_rules! m { + () => { + {} + }; +} + +enum Enum { A, B } + +fn main() { + match Enum::A { + //~^ ERROR non-exhaustive patterns + Enum::A => m!() + } +} diff --git a/tests/ui/pattern/issue-94866.stderr b/tests/ui/pattern/issue-94866.stderr new file mode 100644 index 00000000000..b3c17ce8974 --- /dev/null +++ b/tests/ui/pattern/issue-94866.stderr @@ -0,0 +1,21 @@ +error[E0004]: non-exhaustive patterns: `Enum::B` not covered + --> $DIR/issue-94866.rs:10:11 + | +LL | match Enum::A { + | ^^^^^^^ pattern `Enum::B` not covered + | +note: `Enum` defined here + --> $DIR/issue-94866.rs:7:16 + | +LL | enum Enum { A, B } + | ---- ^ not covered + = note: the matched value is of type `Enum` +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown + | +LL ~ Enum::A => m!(), +LL + Enum::B => todo!() + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0004`. diff --git a/tests/ui/recursion/issue-3008-1.rs b/tests/ui/recursion/issue-3008-1.rs new file mode 100644 index 00000000000..1124969e6d0 --- /dev/null +++ b/tests/ui/recursion/issue-3008-1.rs @@ -0,0 +1,12 @@ +enum Foo { + Foo_(Bar) +} + +enum Bar { + //~^ ERROR recursive type `Bar` has infinite size + BarNone, + BarSome(Bar) +} + +fn main() { +} diff --git a/tests/ui/recursion/issue-3008-1.stderr b/tests/ui/recursion/issue-3008-1.stderr new file mode 100644 index 00000000000..be25b9091d5 --- /dev/null +++ b/tests/ui/recursion/issue-3008-1.stderr @@ -0,0 +1,17 @@ +error[E0072]: recursive type `Bar` has infinite size + --> $DIR/issue-3008-1.rs:5:1 + | +LL | enum Bar { + | ^^^^^^^^ +... +LL | BarSome(Bar) + | --- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | BarSome(Box) + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/recursion/issue-3008-2.rs b/tests/ui/recursion/issue-3008-2.rs new file mode 100644 index 00000000000..5846c69da41 --- /dev/null +++ b/tests/ui/recursion/issue-3008-2.rs @@ -0,0 +1,6 @@ +enum Foo { Foo_(Bar) } +struct Bar { x: Bar } +//~^ ERROR E0072 + +fn main() { +} diff --git a/tests/ui/recursion/issue-3008-2.stderr b/tests/ui/recursion/issue-3008-2.stderr new file mode 100644 index 00000000000..858a8fd6af8 --- /dev/null +++ b/tests/ui/recursion/issue-3008-2.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `Bar` has infinite size + --> $DIR/issue-3008-2.rs:2:1 + | +LL | struct Bar { x: Bar } + | ^^^^^^^^^^ --- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | struct Bar { x: Box } + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/recursion/issue-3008-3.rs b/tests/ui/recursion/issue-3008-3.rs new file mode 100644 index 00000000000..212eb2eb8e0 --- /dev/null +++ b/tests/ui/recursion/issue-3008-3.rs @@ -0,0 +1,10 @@ +use std::marker; + +enum E1 { V1(E2), } +enum E2 { V2(E2, marker::PhantomData), } +//~^ ERROR recursive type `E2` has infinite size + +impl E1 { fn foo(&self) {} } + +fn main() { +} diff --git a/tests/ui/recursion/issue-3008-3.stderr b/tests/ui/recursion/issue-3008-3.stderr new file mode 100644 index 00000000000..a1a81e29367 --- /dev/null +++ b/tests/ui/recursion/issue-3008-3.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `E2` has infinite size + --> $DIR/issue-3008-3.rs:4:1 + | +LL | enum E2 { V2(E2, marker::PhantomData), } + | ^^^^^^^^^^ ------ recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | enum E2 { V2(Box>, marker::PhantomData), } + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/typeck/issue-1871.rs b/tests/ui/typeck/issue-1871.rs new file mode 100644 index 00000000000..f7a2bdd5659 --- /dev/null +++ b/tests/ui/typeck/issue-1871.rs @@ -0,0 +1,12 @@ +// Tests that we don't generate a spurious error about f.honk's type +// being undeterminable +fn main() { + let f = 42; + + let _g = if f < 5 { + f.honk() //~ ERROR no method named `honk` found + } + else { + () + }; +} diff --git a/tests/ui/typeck/issue-1871.stderr b/tests/ui/typeck/issue-1871.stderr new file mode 100644 index 00000000000..b774ca22dd7 --- /dev/null +++ b/tests/ui/typeck/issue-1871.stderr @@ -0,0 +1,9 @@ +error[E0599]: no method named `honk` found for type `{integer}` in the current scope + --> $DIR/issue-1871.rs:7:9 + | +LL | f.honk() + | ^^^^ method not found in `{integer}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/typeck/issue-2063-resource.rs b/tests/ui/typeck/issue-2063-resource.rs new file mode 100644 index 00000000000..1d0527447ba --- /dev/null +++ b/tests/ui/typeck/issue-2063-resource.rs @@ -0,0 +1,14 @@ +// check-pass +#![allow(dead_code)] +// test that autoderef of a type like this does not +// cause compiler to loop. Note that no instances +// of such a type could ever be constructed. + +struct S { + x: X, + to_str: (), +} + +struct X(Box); + +fn main() {} diff --git a/tests/ui/typeck/issue-2063.rs b/tests/ui/typeck/issue-2063.rs new file mode 100644 index 00000000000..f08f9d4cfe4 --- /dev/null +++ b/tests/ui/typeck/issue-2063.rs @@ -0,0 +1,22 @@ +// run-pass +// test that autoderef of a type like this does not +// cause compiler to loop. Note that no instances +// of such a type could ever be constructed. + +struct T(#[allow(unused_tuple_struct_fields)] Box); + +trait ToStr2 { + fn my_to_string(&self) -> String; +} + +impl ToStr2 for T { + fn my_to_string(&self) -> String { "t".to_string() } +} + +#[allow(dead_code)] +fn new_t(x: T) { + x.my_to_string(); +} + +fn main() { +} diff --git a/tests/ui/where-clauses/issue-50825-1.rs b/tests/ui/where-clauses/issue-50825-1.rs new file mode 100644 index 00000000000..ee4316029a8 --- /dev/null +++ b/tests/ui/where-clauses/issue-50825-1.rs @@ -0,0 +1,22 @@ +// run-pass +// regression test for issue #50825 +// Make sure that the `impl` bound (): X is preferred over +// the (): X bound in the where clause. + +trait X { + type T; +} + +trait Y: X { + fn foo(x: &Self::T); +} + +impl X for () { + type T = (); +} + +impl Y> for () where (): Y { + fn foo(_x: &()) {} +} + +fn main () {} diff --git a/tests/ui/where-clauses/issue-50825.rs b/tests/ui/where-clauses/issue-50825.rs new file mode 100644 index 00000000000..1ece2e9fc84 --- /dev/null +++ b/tests/ui/where-clauses/issue-50825.rs @@ -0,0 +1,15 @@ +// run-pass +// regression test for issue #50825 +// Make sure that the built-in bound {integer}: Sized is preferred over +// the u64: Sized bound in the where clause. + +fn foo(y: &[()]) +where + u64: Sized, +{ + y[0] +} + +fn main () { + foo(&[()]); +} -- cgit 1.4.1-3-g733a5