Skip to content

Commit fde4de4

Browse files
Rollup merge of #143297 - Kivooeo:tf22, r=tgross35
`tests/ui`: A New Order [22/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of #133895. r? `@tgross35`
2 parents 19a7f0f + 0f7a86b commit fde4de4

16 files changed

+57
-60
lines changed

tests/ui/op-assign-builtins-by-ref.rs renamed to tests/ui/binop/compound-assign-by-ref.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
//! Test compound assignment operators with reference right-hand side.
2+
13
//@ run-pass
24

35
fn main() {
4-
// test compound assignment operators with ref as right-hand side,
5-
// for each operator, with various types as operands.
6-
76
// test AddAssign
87
{
98
let mut x = 3i8;

tests/ui/once-cant-call-twice-on-heap.rs renamed to tests/ui/closures/fnonce-call-twice-error.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
// Testing guarantees provided by once functions.
2-
// This program would segfault if it were legal.
1+
//! Test that `FnOnce` closures cannot be called twice.
32
43
use std::sync::Arc;
54

6-
fn foo<F:FnOnce()>(blk: F) {
5+
fn foo<F: FnOnce()>(blk: F) {
76
blk();
87
blk(); //~ ERROR use of moved value
98
}
109

1110
fn main() {
1211
let x = Arc::new(true);
13-
foo(move|| {
12+
foo(move || {
1413
assert!(*x);
1514
drop(x);
1615
});

tests/ui/once-cant-call-twice-on-heap.stderr renamed to tests/ui/closures/fnonce-call-twice-error.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
error[E0382]: use of moved value: `blk`
2-
--> $DIR/once-cant-call-twice-on-heap.rs:8:5
2+
--> $DIR/fnonce-call-twice-error.rs:7:5
33
|
4-
LL | fn foo<F:FnOnce()>(blk: F) {
5-
| --- move occurs because `blk` has type `F`, which does not implement the `Copy` trait
4+
LL | fn foo<F: FnOnce()>(blk: F) {
5+
| --- move occurs because `blk` has type `F`, which does not implement the `Copy` trait
66
LL | blk();
77
| ----- `blk` moved due to this call
88
LL | blk();
99
| ^^^ value used here after move
1010
|
1111
note: `FnOnce` closures can only be called once
12-
--> $DIR/once-cant-call-twice-on-heap.rs:6:10
12+
--> $DIR/fnonce-call-twice-error.rs:5:11
1313
|
14-
LL | fn foo<F:FnOnce()>(blk: F) {
15-
| ^^^^^^^^ `F` is made to be an `FnOnce` closure here
14+
LL | fn foo<F: FnOnce()>(blk: F) {
15+
| ^^^^^^^^ `F` is made to be an `FnOnce` closure here
1616
LL | blk();
1717
| ----- this value implements `FnOnce`, which causes it to be moved when called
1818

tests/ui/occurs-check-2.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/ui/occurs-check-3.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/ui/occurs-check.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/ui/opeq.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/ui/oom_unwind.rs renamed to tests/ui/panics/oom-panic-unwind.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Test that out-of-memory conditions trigger catchable panics with `-Z oom=panic`.
2+
13
//@ compile-flags: -Z oom=panic
24
//@ run-pass
35
//@ no-prefer-dynamic

tests/ui/opt-in-copy.rs renamed to tests/ui/traits/copy-requires-all-fields-copy.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Test that `Copy` cannot be implemented if any field doesn't implement `Copy`.
2+
13
struct CantCopyThis;
24

35
struct IWantToCopyThis {

tests/ui/opt-in-copy.stderr renamed to tests/ui/traits/copy-requires-all-fields-copy.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0204]: the trait `Copy` cannot be implemented for this type
2-
--> $DIR/opt-in-copy.rs:7:15
2+
--> $DIR/copy-requires-all-fields-copy.rs:9:15
33
|
44
LL | but_i_cant: CantCopyThis,
55
| ------------------------ this field does not implement `Copy`
@@ -8,7 +8,7 @@ LL | impl Copy for IWantToCopyThis {}
88
| ^^^^^^^^^^^^^^^
99

1010
error[E0204]: the trait `Copy` cannot be implemented for this type
11-
--> $DIR/opt-in-copy.rs:19:15
11+
--> $DIR/copy-requires-all-fields-copy.rs:21:15
1212
|
1313
LL | ButICant(CantCopyThisEither),
1414
| ------------------ this field does not implement `Copy`
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//! Test that occurs check prevents direct self-reference in variable assignment.
2+
//!
3+
//! Regression test for <https://github.com/rust-lang/rust/issues/768>.
4+
5+
fn main() {
6+
let f;
7+
f = Box::new(f);
8+
//~^ ERROR overflow assigning `Box<_>` to `_`
9+
}

tests/ui/occurs-check.stderr renamed to tests/ui/type-inference/direct-self-reference-occurs-check.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0275]: overflow assigning `Box<_>` to `_`
2-
--> $DIR/occurs-check.rs:3:18
2+
--> $DIR/direct-self-reference-occurs-check.rs:7:18
33
|
44
LL | f = Box::new(f);
55
| ^
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//! Test that occurs check prevents infinite types with enum self-references.
2+
//!
3+
//! Regression test for <https://github.com/rust-lang/rust/issues/778>.
4+
5+
enum Clam<T> {
6+
A(T),
7+
}
8+
9+
fn main() {
10+
let c;
11+
c = Clam::A(c);
12+
//~^ ERROR overflow assigning `Clam<_>` to `_`
13+
match c {
14+
Clam::A::<isize>(_) => {}
15+
}
16+
}

tests/ui/occurs-check-3.stderr renamed to tests/ui/type-inference/enum-self-reference-occurs-check.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0275]: overflow assigning `Clam<_>` to `_`
2-
--> $DIR/occurs-check-3.rs:6:17
2+
--> $DIR/enum-self-reference-occurs-check.rs:11:17
33
|
44
LL | c = Clam::A(c);
55
| ^
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//! Test that occurs check prevents infinite types during type inference.
2+
//!
3+
//! Regression test for <https://github.com/rust-lang/rust/issues/768>.
4+
5+
fn main() {
6+
let f;
7+
let g;
8+
9+
g = f;
10+
//~^ ERROR overflow assigning `Box<_>` to `_`
11+
f = Box::new(g);
12+
}

tests/ui/occurs-check-2.stderr renamed to tests/ui/type-inference/infinite-type-occurs-check.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0275]: overflow assigning `Box<_>` to `_`
2-
--> $DIR/occurs-check-2.rs:6:9
2+
--> $DIR/infinite-type-occurs-check.rs:9:9
33
|
44
LL | g = f;
55
| ^

0 commit comments

Comments
 (0)