Skip to content

Commit d016e9a

Browse files
committed
tests/ui: Split large_moves.rs and move to lint/large_assignments
To make failing tests easier to debug with --emit=mir, etc.
1 parent afdd468 commit d016e9a

7 files changed

+98
-96
lines changed

tests/ui/async-await/large_moves.attribute.stderr

-39
This file was deleted.

tests/ui/async-await/large_moves.option.stderr

-39
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#![deny(large_assignments)]
2+
#![feature(large_assignments)]
3+
#![move_size_limit = "1000"]
4+
// build-fail
5+
// only-x86_64
6+
7+
// edition:2018
8+
// compile-flags: -Zmir-opt-level=0
9+
10+
use std::{sync::Arc, rc::Rc};
11+
12+
fn main() {
13+
let _ = Arc::new([0; 9999]); // OK!
14+
let _ = Box::new([0; 9999]); // OK!
15+
let _ = Rc::new([0; 9999]); // OK!
16+
let _ = NotBox::new([0; 9999]); //~ ERROR large_assignments
17+
}
18+
19+
struct NotBox {
20+
data: [u8; 9999],
21+
}
22+
23+
impl NotBox {
24+
fn new(data: [u8; 9999]) -> Self {
25+
Self {
26+
data, //~ ERROR large_assignments
27+
}
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error: moving 9999 bytes
2+
--> $DIR/box_rc_arc_allowed.rs:16:13
3+
|
4+
LL | let _ = NotBox::new([0; 9999]);
5+
| ^^^^^^^^^^^^^^^^^^^^^^ value moved from here
6+
|
7+
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
8+
note: the lint level is defined here
9+
--> $DIR/box_rc_arc_allowed.rs:1:9
10+
|
11+
LL | #![deny(large_assignments)]
12+
| ^^^^^^^^^^^^^^^^^
13+
14+
error: moving 9999 bytes
15+
--> $DIR/box_rc_arc_allowed.rs:26:13
16+
|
17+
LL | data,
18+
| ^^^^ value moved from here
19+
|
20+
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
21+
22+
error: aborting due to 2 previous errors
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error: moving 10024 bytes
2+
--> $DIR/large_future.rs:19:14
3+
|
4+
LL | let z = (x, 42);
5+
| ^ value moved from here
6+
|
7+
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
8+
note: the lint level is defined here
9+
--> $DIR/large_future.rs:1:9
10+
|
11+
LL | #![deny(large_assignments)]
12+
| ^^^^^^^^^^^^^^^^^
13+
14+
error: moving 10024 bytes
15+
--> $DIR/large_future.rs:20:13
16+
|
17+
LL | let a = z.0;
18+
| ^^^ value moved from here
19+
|
20+
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
21+
22+
error: aborting due to 2 previous errors
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error: moving 10024 bytes
2+
--> $DIR/large_future.rs:19:14
3+
|
4+
LL | let z = (x, 42);
5+
| ^ value moved from here
6+
|
7+
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
8+
note: the lint level is defined here
9+
--> $DIR/large_future.rs:1:9
10+
|
11+
LL | #![deny(large_assignments)]
12+
| ^^^^^^^^^^^^^^^^^
13+
14+
error: moving 10024 bytes
15+
--> $DIR/large_future.rs:20:13
16+
|
17+
LL | let a = z.0;
18+
| ^^^ value moved from here
19+
|
20+
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
21+
22+
error: aborting due to 2 previous errors
23+

tests/ui/async-await/large_moves.rs renamed to tests/ui/lint/large_assignments/large_future.rs

-18
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
// edition:2018
1010
// compile-flags: -Zmir-opt-level=0
1111

12-
use std::{sync::Arc, rc::Rc};
13-
1412
fn main() {
1513
let x = async {
1614
let y = [0; 9999];
@@ -21,24 +19,8 @@ fn main() {
2119
let z = (x, 42); //~ ERROR large_assignments
2220
let a = z.0; //~ ERROR large_assignments
2321
let b = z.1;
24-
let _ = Arc::new([0; 9999]); // OK!
25-
let _ = Box::new([0; 9999]); // OK!
26-
let _ = Rc::new([0; 9999]); // OK!
27-
let _ = NotBox::new([0; 9999]); //~ ERROR large_assignments
2822
}
2923

3024
async fn thing(y: &[u8]) {
3125
dbg!(y);
3226
}
33-
34-
struct NotBox {
35-
data: [u8; 9999],
36-
}
37-
38-
impl NotBox {
39-
fn new(data: [u8; 9999]) -> Self {
40-
Self {
41-
data, //~ ERROR large_assignments
42-
}
43-
}
44-
}

0 commit comments

Comments
 (0)