From 7f2e37fc5cdca01d4e140921f59fad398862606d Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Tue, 1 Jul 2025 02:07:53 +0500 Subject: moved & deleted tests opeq.rs was removed as duplicating test logic in other tests --- tests/ui/binop/compound-assign-by-ref.rs | 76 ++++++++++++++++++++++ tests/ui/closures/fnonce-call-twice-error.rs | 17 +++++ tests/ui/closures/fnonce-call-twice-error.stderr | 21 ++++++ tests/ui/occurs-check-2.rs | 9 --- tests/ui/occurs-check-2.stderr | 9 --- tests/ui/occurs-check-3.rs | 11 ---- tests/ui/occurs-check-3.stderr | 9 --- tests/ui/occurs-check.rs | 5 -- tests/ui/occurs-check.stderr | 9 --- tests/ui/once-cant-call-twice-on-heap.rs | 17 ----- tests/ui/once-cant-call-twice-on-heap.stderr | 21 ------ tests/ui/oom_unwind.rs | 21 ------ tests/ui/op-assign-builtins-by-ref.rs | 76 ---------------------- tests/ui/opeq.rs | 17 ----- tests/ui/opt-in-copy.rs | 22 ------- tests/ui/opt-in-copy.stderr | 21 ------ tests/ui/panics/oom-panic-unwind.rs | 21 ++++++ tests/ui/traits/copy-requires-all-fields-copy.rs | 22 +++++++ .../ui/traits/copy-requires-all-fields-copy.stderr | 21 ++++++ .../direct-self-reference-occurs-check.rs | 5 ++ .../direct-self-reference-occurs-check.stderr | 9 +++ .../enum-self-reference-occurs-check.rs | 11 ++++ .../enum-self-reference-occurs-check.stderr | 9 +++ .../type-inference/infinite-type-occurs-check.rs | 9 +++ .../infinite-type-occurs-check.stderr | 9 +++ 25 files changed, 230 insertions(+), 247 deletions(-) create mode 100644 tests/ui/binop/compound-assign-by-ref.rs create mode 100644 tests/ui/closures/fnonce-call-twice-error.rs create mode 100644 tests/ui/closures/fnonce-call-twice-error.stderr delete mode 100644 tests/ui/occurs-check-2.rs delete mode 100644 tests/ui/occurs-check-2.stderr delete mode 100644 tests/ui/occurs-check-3.rs delete mode 100644 tests/ui/occurs-check-3.stderr delete mode 100644 tests/ui/occurs-check.rs delete mode 100644 tests/ui/occurs-check.stderr delete mode 100644 tests/ui/once-cant-call-twice-on-heap.rs delete mode 100644 tests/ui/once-cant-call-twice-on-heap.stderr delete mode 100644 tests/ui/oom_unwind.rs delete mode 100644 tests/ui/op-assign-builtins-by-ref.rs delete mode 100644 tests/ui/opeq.rs delete mode 100644 tests/ui/opt-in-copy.rs delete mode 100644 tests/ui/opt-in-copy.stderr create mode 100644 tests/ui/panics/oom-panic-unwind.rs create mode 100644 tests/ui/traits/copy-requires-all-fields-copy.rs create mode 100644 tests/ui/traits/copy-requires-all-fields-copy.stderr create mode 100644 tests/ui/type-inference/direct-self-reference-occurs-check.rs create mode 100644 tests/ui/type-inference/direct-self-reference-occurs-check.stderr create mode 100644 tests/ui/type-inference/enum-self-reference-occurs-check.rs create mode 100644 tests/ui/type-inference/enum-self-reference-occurs-check.stderr create mode 100644 tests/ui/type-inference/infinite-type-occurs-check.rs create mode 100644 tests/ui/type-inference/infinite-type-occurs-check.stderr diff --git a/tests/ui/binop/compound-assign-by-ref.rs b/tests/ui/binop/compound-assign-by-ref.rs new file mode 100644 index 00000000000..73788da9232 --- /dev/null +++ b/tests/ui/binop/compound-assign-by-ref.rs @@ -0,0 +1,76 @@ +//@ run-pass + +fn main() { + // test compound assignment operators with ref as right-hand side, + // for each operator, with various types as operands. + + // test AddAssign + { + let mut x = 3i8; + x += &2i8; + assert_eq!(x, 5i8); + } + + // test SubAssign + { + let mut x = 7i16; + x -= &4; + assert_eq!(x, 3i16); + } + + // test MulAssign + { + let mut x = 3f32; + x *= &3f32; + assert_eq!(x, 9f32); + } + + // test DivAssign + { + let mut x = 6f64; + x /= &2f64; + assert_eq!(x, 3f64); + } + + // test RemAssign + { + let mut x = 7i64; + x %= &4i64; + assert_eq!(x, 3i64); + } + + // test BitOrAssign + { + let mut x = 0b1010u8; + x |= &0b1100u8; + assert_eq!(x, 0b1110u8); + } + + // test BitAndAssign + { + let mut x = 0b1010u16; + x &= &0b1100u16; + assert_eq!(x, 0b1000u16); + } + + // test BitXorAssign + { + let mut x = 0b1010u32; + x ^= &0b1100u32; + assert_eq!(x, 0b0110u32); + } + + // test ShlAssign + { + let mut x = 0b1010u64; + x <<= &2u32; + assert_eq!(x, 0b101000u64); + } + + // test ShrAssign + { + let mut x = 0b1010u64; + x >>= &2i16; + assert_eq!(x, 0b10u64); + } +} diff --git a/tests/ui/closures/fnonce-call-twice-error.rs b/tests/ui/closures/fnonce-call-twice-error.rs new file mode 100644 index 00000000000..3fd8c5cadca --- /dev/null +++ b/tests/ui/closures/fnonce-call-twice-error.rs @@ -0,0 +1,17 @@ +// Testing guarantees provided by once functions. +// This program would segfault if it were legal. + +use std::sync::Arc; + +fn foo(blk: F) { + blk(); + blk(); //~ ERROR use of moved value +} + +fn main() { + let x = Arc::new(true); + foo(move|| { + assert!(*x); + drop(x); + }); +} diff --git a/tests/ui/closures/fnonce-call-twice-error.stderr b/tests/ui/closures/fnonce-call-twice-error.stderr new file mode 100644 index 00000000000..42697374115 --- /dev/null +++ b/tests/ui/closures/fnonce-call-twice-error.stderr @@ -0,0 +1,21 @@ +error[E0382]: use of moved value: `blk` + --> $DIR/once-cant-call-twice-on-heap.rs:8:5 + | +LL | fn foo(blk: F) { + | --- move occurs because `blk` has type `F`, which does not implement the `Copy` trait +LL | blk(); + | ----- `blk` moved due to this call +LL | blk(); + | ^^^ value used here after move + | +note: `FnOnce` closures can only be called once + --> $DIR/once-cant-call-twice-on-heap.rs:6:10 + | +LL | fn foo(blk: F) { + | ^^^^^^^^ `F` is made to be an `FnOnce` closure here +LL | blk(); + | ----- this value implements `FnOnce`, which causes it to be moved when called + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/occurs-check-2.rs b/tests/ui/occurs-check-2.rs deleted file mode 100644 index 9289a8e870a..00000000000 --- a/tests/ui/occurs-check-2.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn main() { - - let f; - let g; - - g = f; - //~^ ERROR overflow assigning `Box<_>` to `_` - f = Box::new(g); -} diff --git a/tests/ui/occurs-check-2.stderr b/tests/ui/occurs-check-2.stderr deleted file mode 100644 index 5f296967f30..00000000000 --- a/tests/ui/occurs-check-2.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0275]: overflow assigning `Box<_>` to `_` - --> $DIR/occurs-check-2.rs:6:9 - | -LL | g = f; - | ^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/occurs-check-3.rs b/tests/ui/occurs-check-3.rs deleted file mode 100644 index 377a043daf3..00000000000 --- a/tests/ui/occurs-check-3.rs +++ /dev/null @@ -1,11 +0,0 @@ -// From Issue #778 - -enum Clam { A(T) } -fn main() { - let c; - c = Clam::A(c); - //~^ ERROR overflow assigning `Clam<_>` to `_` - match c { - Clam::A::(_) => { } - } -} diff --git a/tests/ui/occurs-check-3.stderr b/tests/ui/occurs-check-3.stderr deleted file mode 100644 index eb05c94957c..00000000000 --- a/tests/ui/occurs-check-3.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0275]: overflow assigning `Clam<_>` to `_` - --> $DIR/occurs-check-3.rs:6:17 - | -LL | c = Clam::A(c); - | ^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/occurs-check.rs b/tests/ui/occurs-check.rs deleted file mode 100644 index 638b9b6d7e4..00000000000 --- a/tests/ui/occurs-check.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let f; - f = Box::new(f); - //~^ ERROR overflow assigning `Box<_>` to `_` -} diff --git a/tests/ui/occurs-check.stderr b/tests/ui/occurs-check.stderr deleted file mode 100644 index ea7c541abc1..00000000000 --- a/tests/ui/occurs-check.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0275]: overflow assigning `Box<_>` to `_` - --> $DIR/occurs-check.rs:3:18 - | -LL | f = Box::new(f); - | ^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/once-cant-call-twice-on-heap.rs b/tests/ui/once-cant-call-twice-on-heap.rs deleted file mode 100644 index 3fd8c5cadca..00000000000 --- a/tests/ui/once-cant-call-twice-on-heap.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Testing guarantees provided by once functions. -// This program would segfault if it were legal. - -use std::sync::Arc; - -fn foo(blk: F) { - blk(); - blk(); //~ ERROR use of moved value -} - -fn main() { - let x = Arc::new(true); - foo(move|| { - assert!(*x); - drop(x); - }); -} diff --git a/tests/ui/once-cant-call-twice-on-heap.stderr b/tests/ui/once-cant-call-twice-on-heap.stderr deleted file mode 100644 index 42697374115..00000000000 --- a/tests/ui/once-cant-call-twice-on-heap.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0382]: use of moved value: `blk` - --> $DIR/once-cant-call-twice-on-heap.rs:8:5 - | -LL | fn foo(blk: F) { - | --- move occurs because `blk` has type `F`, which does not implement the `Copy` trait -LL | blk(); - | ----- `blk` moved due to this call -LL | blk(); - | ^^^ value used here after move - | -note: `FnOnce` closures can only be called once - --> $DIR/once-cant-call-twice-on-heap.rs:6:10 - | -LL | fn foo(blk: F) { - | ^^^^^^^^ `F` is made to be an `FnOnce` closure here -LL | blk(); - | ----- this value implements `FnOnce`, which causes it to be moved when called - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/oom_unwind.rs b/tests/ui/oom_unwind.rs deleted file mode 100644 index be5e63d430b..00000000000 --- a/tests/ui/oom_unwind.rs +++ /dev/null @@ -1,21 +0,0 @@ -//@ compile-flags: -Z oom=panic -//@ run-pass -//@ no-prefer-dynamic -//@ needs-unwind -//@ only-linux - -use std::hint::black_box; -use std::mem::forget; -use std::panic::catch_unwind; - -fn main() { - let panic = catch_unwind(|| { - // This is guaranteed to exceed even the size of the address space - for _ in 0..16 { - // Truncates to a suitable value for both 32-bit and 64-bit targets. - let alloc_size = 0x1000_0000_1000_0000u64 as usize; - forget(black_box(vec![0u8; alloc_size])); - } - }); - assert!(panic.is_err()); -} diff --git a/tests/ui/op-assign-builtins-by-ref.rs b/tests/ui/op-assign-builtins-by-ref.rs deleted file mode 100644 index 73788da9232..00000000000 --- a/tests/ui/op-assign-builtins-by-ref.rs +++ /dev/null @@ -1,76 +0,0 @@ -//@ run-pass - -fn main() { - // test compound assignment operators with ref as right-hand side, - // for each operator, with various types as operands. - - // test AddAssign - { - let mut x = 3i8; - x += &2i8; - assert_eq!(x, 5i8); - } - - // test SubAssign - { - let mut x = 7i16; - x -= &4; - assert_eq!(x, 3i16); - } - - // test MulAssign - { - let mut x = 3f32; - x *= &3f32; - assert_eq!(x, 9f32); - } - - // test DivAssign - { - let mut x = 6f64; - x /= &2f64; - assert_eq!(x, 3f64); - } - - // test RemAssign - { - let mut x = 7i64; - x %= &4i64; - assert_eq!(x, 3i64); - } - - // test BitOrAssign - { - let mut x = 0b1010u8; - x |= &0b1100u8; - assert_eq!(x, 0b1110u8); - } - - // test BitAndAssign - { - let mut x = 0b1010u16; - x &= &0b1100u16; - assert_eq!(x, 0b1000u16); - } - - // test BitXorAssign - { - let mut x = 0b1010u32; - x ^= &0b1100u32; - assert_eq!(x, 0b0110u32); - } - - // test ShlAssign - { - let mut x = 0b1010u64; - x <<= &2u32; - assert_eq!(x, 0b101000u64); - } - - // test ShrAssign - { - let mut x = 0b1010u64; - x >>= &2i16; - assert_eq!(x, 0b10u64); - } -} diff --git a/tests/ui/opeq.rs b/tests/ui/opeq.rs deleted file mode 100644 index 956ea0684fa..00000000000 --- a/tests/ui/opeq.rs +++ /dev/null @@ -1,17 +0,0 @@ -//@ run-pass - -pub fn main() { - let mut x: isize = 1; - x *= 2; - println!("{}", x); - assert_eq!(x, 2); - x += 3; - println!("{}", x); - assert_eq!(x, 5); - x *= x; - println!("{}", x); - assert_eq!(x, 25); - x /= 5; - println!("{}", x); - assert_eq!(x, 5); -} diff --git a/tests/ui/opt-in-copy.rs b/tests/ui/opt-in-copy.rs deleted file mode 100644 index d0257b5745d..00000000000 --- a/tests/ui/opt-in-copy.rs +++ /dev/null @@ -1,22 +0,0 @@ -struct CantCopyThis; - -struct IWantToCopyThis { - but_i_cant: CantCopyThis, -} - -impl Copy for IWantToCopyThis {} -//~^ ERROR the trait `Copy` cannot be implemented for this type - -enum CantCopyThisEither { - A, - B, -} - -enum IWantToCopyThisToo { - ButICant(CantCopyThisEither), -} - -impl Copy for IWantToCopyThisToo {} -//~^ ERROR the trait `Copy` cannot be implemented for this type - -fn main() {} diff --git a/tests/ui/opt-in-copy.stderr b/tests/ui/opt-in-copy.stderr deleted file mode 100644 index 258ff16e6e4..00000000000 --- a/tests/ui/opt-in-copy.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0204]: the trait `Copy` cannot be implemented for this type - --> $DIR/opt-in-copy.rs:7:15 - | -LL | but_i_cant: CantCopyThis, - | ------------------------ this field does not implement `Copy` -... -LL | impl Copy for IWantToCopyThis {} - | ^^^^^^^^^^^^^^^ - -error[E0204]: the trait `Copy` cannot be implemented for this type - --> $DIR/opt-in-copy.rs:19:15 - | -LL | ButICant(CantCopyThisEither), - | ------------------ this field does not implement `Copy` -... -LL | impl Copy for IWantToCopyThisToo {} - | ^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0204`. diff --git a/tests/ui/panics/oom-panic-unwind.rs b/tests/ui/panics/oom-panic-unwind.rs new file mode 100644 index 00000000000..be5e63d430b --- /dev/null +++ b/tests/ui/panics/oom-panic-unwind.rs @@ -0,0 +1,21 @@ +//@ compile-flags: -Z oom=panic +//@ run-pass +//@ no-prefer-dynamic +//@ needs-unwind +//@ only-linux + +use std::hint::black_box; +use std::mem::forget; +use std::panic::catch_unwind; + +fn main() { + let panic = catch_unwind(|| { + // This is guaranteed to exceed even the size of the address space + for _ in 0..16 { + // Truncates to a suitable value for both 32-bit and 64-bit targets. + let alloc_size = 0x1000_0000_1000_0000u64 as usize; + forget(black_box(vec![0u8; alloc_size])); + } + }); + assert!(panic.is_err()); +} diff --git a/tests/ui/traits/copy-requires-all-fields-copy.rs b/tests/ui/traits/copy-requires-all-fields-copy.rs new file mode 100644 index 00000000000..d0257b5745d --- /dev/null +++ b/tests/ui/traits/copy-requires-all-fields-copy.rs @@ -0,0 +1,22 @@ +struct CantCopyThis; + +struct IWantToCopyThis { + but_i_cant: CantCopyThis, +} + +impl Copy for IWantToCopyThis {} +//~^ ERROR the trait `Copy` cannot be implemented for this type + +enum CantCopyThisEither { + A, + B, +} + +enum IWantToCopyThisToo { + ButICant(CantCopyThisEither), +} + +impl Copy for IWantToCopyThisToo {} +//~^ ERROR the trait `Copy` cannot be implemented for this type + +fn main() {} diff --git a/tests/ui/traits/copy-requires-all-fields-copy.stderr b/tests/ui/traits/copy-requires-all-fields-copy.stderr new file mode 100644 index 00000000000..258ff16e6e4 --- /dev/null +++ b/tests/ui/traits/copy-requires-all-fields-copy.stderr @@ -0,0 +1,21 @@ +error[E0204]: the trait `Copy` cannot be implemented for this type + --> $DIR/opt-in-copy.rs:7:15 + | +LL | but_i_cant: CantCopyThis, + | ------------------------ this field does not implement `Copy` +... +LL | impl Copy for IWantToCopyThis {} + | ^^^^^^^^^^^^^^^ + +error[E0204]: the trait `Copy` cannot be implemented for this type + --> $DIR/opt-in-copy.rs:19:15 + | +LL | ButICant(CantCopyThisEither), + | ------------------ this field does not implement `Copy` +... +LL | impl Copy for IWantToCopyThisToo {} + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0204`. diff --git a/tests/ui/type-inference/direct-self-reference-occurs-check.rs b/tests/ui/type-inference/direct-self-reference-occurs-check.rs new file mode 100644 index 00000000000..638b9b6d7e4 --- /dev/null +++ b/tests/ui/type-inference/direct-self-reference-occurs-check.rs @@ -0,0 +1,5 @@ +fn main() { + let f; + f = Box::new(f); + //~^ ERROR overflow assigning `Box<_>` to `_` +} diff --git a/tests/ui/type-inference/direct-self-reference-occurs-check.stderr b/tests/ui/type-inference/direct-self-reference-occurs-check.stderr new file mode 100644 index 00000000000..ea7c541abc1 --- /dev/null +++ b/tests/ui/type-inference/direct-self-reference-occurs-check.stderr @@ -0,0 +1,9 @@ +error[E0275]: overflow assigning `Box<_>` to `_` + --> $DIR/occurs-check.rs:3:18 + | +LL | f = Box::new(f); + | ^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-inference/enum-self-reference-occurs-check.rs b/tests/ui/type-inference/enum-self-reference-occurs-check.rs new file mode 100644 index 00000000000..377a043daf3 --- /dev/null +++ b/tests/ui/type-inference/enum-self-reference-occurs-check.rs @@ -0,0 +1,11 @@ +// From Issue #778 + +enum Clam { A(T) } +fn main() { + let c; + c = Clam::A(c); + //~^ ERROR overflow assigning `Clam<_>` to `_` + match c { + Clam::A::(_) => { } + } +} diff --git a/tests/ui/type-inference/enum-self-reference-occurs-check.stderr b/tests/ui/type-inference/enum-self-reference-occurs-check.stderr new file mode 100644 index 00000000000..eb05c94957c --- /dev/null +++ b/tests/ui/type-inference/enum-self-reference-occurs-check.stderr @@ -0,0 +1,9 @@ +error[E0275]: overflow assigning `Clam<_>` to `_` + --> $DIR/occurs-check-3.rs:6:17 + | +LL | c = Clam::A(c); + | ^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-inference/infinite-type-occurs-check.rs b/tests/ui/type-inference/infinite-type-occurs-check.rs new file mode 100644 index 00000000000..9289a8e870a --- /dev/null +++ b/tests/ui/type-inference/infinite-type-occurs-check.rs @@ -0,0 +1,9 @@ +fn main() { + + let f; + let g; + + g = f; + //~^ ERROR overflow assigning `Box<_>` to `_` + f = Box::new(g); +} diff --git a/tests/ui/type-inference/infinite-type-occurs-check.stderr b/tests/ui/type-inference/infinite-type-occurs-check.stderr new file mode 100644 index 00000000000..5f296967f30 --- /dev/null +++ b/tests/ui/type-inference/infinite-type-occurs-check.stderr @@ -0,0 +1,9 @@ +error[E0275]: overflow assigning `Box<_>` to `_` + --> $DIR/occurs-check-2.rs:6:9 + | +LL | g = f; + | ^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0275`. -- cgit 1.4.1-3-g733a5 From 0f7a86bb2ac5b2ca57e5524127f9cbeb88f89a74 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Tue, 1 Jul 2025 02:09:12 +0500 Subject: cleaned up some tests --- tests/ui/binop/compound-assign-by-ref.rs | 5 ++--- tests/ui/closures/fnonce-call-twice-error.rs | 7 +++---- tests/ui/closures/fnonce-call-twice-error.stderr | 12 ++++++------ tests/ui/panics/oom-panic-unwind.rs | 2 ++ tests/ui/traits/copy-requires-all-fields-copy.rs | 2 ++ tests/ui/traits/copy-requires-all-fields-copy.stderr | 4 ++-- .../ui/type-inference/direct-self-reference-occurs-check.rs | 4 ++++ .../type-inference/direct-self-reference-occurs-check.stderr | 2 +- tests/ui/type-inference/enum-self-reference-occurs-check.rs | 11 ++++++++--- .../type-inference/enum-self-reference-occurs-check.stderr | 2 +- tests/ui/type-inference/infinite-type-occurs-check.rs | 5 ++++- tests/ui/type-inference/infinite-type-occurs-check.stderr | 2 +- 12 files changed, 36 insertions(+), 22 deletions(-) diff --git a/tests/ui/binop/compound-assign-by-ref.rs b/tests/ui/binop/compound-assign-by-ref.rs index 73788da9232..e1f519a137f 100644 --- a/tests/ui/binop/compound-assign-by-ref.rs +++ b/tests/ui/binop/compound-assign-by-ref.rs @@ -1,9 +1,8 @@ +//! Test compound assignment operators with reference right-hand side. + //@ run-pass fn main() { - // test compound assignment operators with ref as right-hand side, - // for each operator, with various types as operands. - // test AddAssign { let mut x = 3i8; diff --git a/tests/ui/closures/fnonce-call-twice-error.rs b/tests/ui/closures/fnonce-call-twice-error.rs index 3fd8c5cadca..1662b7bddaa 100644 --- a/tests/ui/closures/fnonce-call-twice-error.rs +++ b/tests/ui/closures/fnonce-call-twice-error.rs @@ -1,16 +1,15 @@ -// Testing guarantees provided by once functions. -// This program would segfault if it were legal. +//! Test that `FnOnce` closures cannot be called twice. use std::sync::Arc; -fn foo(blk: F) { +fn foo(blk: F) { blk(); blk(); //~ ERROR use of moved value } fn main() { let x = Arc::new(true); - foo(move|| { + foo(move || { assert!(*x); drop(x); }); diff --git a/tests/ui/closures/fnonce-call-twice-error.stderr b/tests/ui/closures/fnonce-call-twice-error.stderr index 42697374115..51d8a33dcd7 100644 --- a/tests/ui/closures/fnonce-call-twice-error.stderr +++ b/tests/ui/closures/fnonce-call-twice-error.stderr @@ -1,18 +1,18 @@ error[E0382]: use of moved value: `blk` - --> $DIR/once-cant-call-twice-on-heap.rs:8:5 + --> $DIR/fnonce-call-twice-error.rs:7:5 | -LL | fn foo(blk: F) { - | --- move occurs because `blk` has type `F`, which does not implement the `Copy` trait +LL | fn foo(blk: F) { + | --- move occurs because `blk` has type `F`, which does not implement the `Copy` trait LL | blk(); | ----- `blk` moved due to this call LL | blk(); | ^^^ value used here after move | note: `FnOnce` closures can only be called once - --> $DIR/once-cant-call-twice-on-heap.rs:6:10 + --> $DIR/fnonce-call-twice-error.rs:5:11 | -LL | fn foo(blk: F) { - | ^^^^^^^^ `F` is made to be an `FnOnce` closure here +LL | fn foo(blk: F) { + | ^^^^^^^^ `F` is made to be an `FnOnce` closure here LL | blk(); | ----- this value implements `FnOnce`, which causes it to be moved when called diff --git a/tests/ui/panics/oom-panic-unwind.rs b/tests/ui/panics/oom-panic-unwind.rs index be5e63d430b..5974ad91406 100644 --- a/tests/ui/panics/oom-panic-unwind.rs +++ b/tests/ui/panics/oom-panic-unwind.rs @@ -1,3 +1,5 @@ +//! Test that out-of-memory conditions trigger catchable panics with `-Z oom=panic`. + //@ compile-flags: -Z oom=panic //@ run-pass //@ no-prefer-dynamic diff --git a/tests/ui/traits/copy-requires-all-fields-copy.rs b/tests/ui/traits/copy-requires-all-fields-copy.rs index d0257b5745d..8c829a7382b 100644 --- a/tests/ui/traits/copy-requires-all-fields-copy.rs +++ b/tests/ui/traits/copy-requires-all-fields-copy.rs @@ -1,3 +1,5 @@ +//! Test that `Copy` cannot be implemented if any field doesn't implement `Copy`. + struct CantCopyThis; struct IWantToCopyThis { diff --git a/tests/ui/traits/copy-requires-all-fields-copy.stderr b/tests/ui/traits/copy-requires-all-fields-copy.stderr index 258ff16e6e4..1a9e1ada366 100644 --- a/tests/ui/traits/copy-requires-all-fields-copy.stderr +++ b/tests/ui/traits/copy-requires-all-fields-copy.stderr @@ -1,5 +1,5 @@ error[E0204]: the trait `Copy` cannot be implemented for this type - --> $DIR/opt-in-copy.rs:7:15 + --> $DIR/copy-requires-all-fields-copy.rs:9:15 | LL | but_i_cant: CantCopyThis, | ------------------------ this field does not implement `Copy` @@ -8,7 +8,7 @@ LL | impl Copy for IWantToCopyThis {} | ^^^^^^^^^^^^^^^ error[E0204]: the trait `Copy` cannot be implemented for this type - --> $DIR/opt-in-copy.rs:19:15 + --> $DIR/copy-requires-all-fields-copy.rs:21:15 | LL | ButICant(CantCopyThisEither), | ------------------ this field does not implement `Copy` diff --git a/tests/ui/type-inference/direct-self-reference-occurs-check.rs b/tests/ui/type-inference/direct-self-reference-occurs-check.rs index 638b9b6d7e4..6e3d8251fc4 100644 --- a/tests/ui/type-inference/direct-self-reference-occurs-check.rs +++ b/tests/ui/type-inference/direct-self-reference-occurs-check.rs @@ -1,3 +1,7 @@ +//! Test that occurs check prevents direct self-reference in variable assignment. +//! +//! Regression test for . + fn main() { let f; f = Box::new(f); diff --git a/tests/ui/type-inference/direct-self-reference-occurs-check.stderr b/tests/ui/type-inference/direct-self-reference-occurs-check.stderr index ea7c541abc1..6c522ffac1f 100644 --- a/tests/ui/type-inference/direct-self-reference-occurs-check.stderr +++ b/tests/ui/type-inference/direct-self-reference-occurs-check.stderr @@ -1,5 +1,5 @@ error[E0275]: overflow assigning `Box<_>` to `_` - --> $DIR/occurs-check.rs:3:18 + --> $DIR/direct-self-reference-occurs-check.rs:7:18 | LL | f = Box::new(f); | ^ diff --git a/tests/ui/type-inference/enum-self-reference-occurs-check.rs b/tests/ui/type-inference/enum-self-reference-occurs-check.rs index 377a043daf3..2905868b8bf 100644 --- a/tests/ui/type-inference/enum-self-reference-occurs-check.rs +++ b/tests/ui/type-inference/enum-self-reference-occurs-check.rs @@ -1,11 +1,16 @@ -// From Issue #778 +//! Test that occurs check prevents infinite types with enum self-references. +//! +//! Regression test for . + +enum Clam { + A(T), +} -enum Clam { A(T) } fn main() { let c; c = Clam::A(c); //~^ ERROR overflow assigning `Clam<_>` to `_` match c { - Clam::A::(_) => { } + Clam::A::(_) => {} } } diff --git a/tests/ui/type-inference/enum-self-reference-occurs-check.stderr b/tests/ui/type-inference/enum-self-reference-occurs-check.stderr index eb05c94957c..3239be51a17 100644 --- a/tests/ui/type-inference/enum-self-reference-occurs-check.stderr +++ b/tests/ui/type-inference/enum-self-reference-occurs-check.stderr @@ -1,5 +1,5 @@ error[E0275]: overflow assigning `Clam<_>` to `_` - --> $DIR/occurs-check-3.rs:6:17 + --> $DIR/enum-self-reference-occurs-check.rs:11:17 | LL | c = Clam::A(c); | ^ diff --git a/tests/ui/type-inference/infinite-type-occurs-check.rs b/tests/ui/type-inference/infinite-type-occurs-check.rs index 9289a8e870a..b353824e931 100644 --- a/tests/ui/type-inference/infinite-type-occurs-check.rs +++ b/tests/ui/type-inference/infinite-type-occurs-check.rs @@ -1,5 +1,8 @@ -fn main() { +//! Test that occurs check prevents infinite types during type inference. +//! +//! Regression test for . +fn main() { let f; let g; diff --git a/tests/ui/type-inference/infinite-type-occurs-check.stderr b/tests/ui/type-inference/infinite-type-occurs-check.stderr index 5f296967f30..9cb8bb91796 100644 --- a/tests/ui/type-inference/infinite-type-occurs-check.stderr +++ b/tests/ui/type-inference/infinite-type-occurs-check.stderr @@ -1,5 +1,5 @@ error[E0275]: overflow assigning `Box<_>` to `_` - --> $DIR/occurs-check-2.rs:6:9 + --> $DIR/infinite-type-occurs-check.rs:9:9 | LL | g = f; | ^ -- cgit 1.4.1-3-g733a5