Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/ui: Split large_moves.rs and move to lint/large_assignments #116036

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions tests/ui/async-await/large_moves.attribute.stderr

This file was deleted.

39 changes: 0 additions & 39 deletions tests/ui/async-await/large_moves.option.stderr

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
#![deny(large_assignments)]
#![feature(large_assignments)]
#![cfg_attr(attribute, move_size_limit = "1000")]
#![move_size_limit = "1000"]
// build-fail
// only-x86_64
// revisions: attribute option
// [option]compile-flags: -Zmove-size-limit=1000

// edition:2018
// compile-flags: -Zmir-opt-level=0

use std::{sync::Arc, rc::Rc};

fn main() {
let x = async {
let y = [0; 9999];
dbg!(y);
thing(&y).await;
dbg!(y);
};
let z = (x, 42); //~ ERROR large_assignments
let a = z.0; //~ ERROR large_assignments
let b = z.1;
let _ = Arc::new([0; 9999]); // OK!
let _ = Box::new([0; 9999]); // OK!
let _ = Rc::new([0; 9999]); // OK!
let _ = NotBox::new([0; 9999]); //~ ERROR large_assignments
}

async fn thing(y: &[u8]) {
dbg!(y);
}

struct NotBox {
data: [u8; 9999],
}
Expand Down
23 changes: 23 additions & 0 deletions tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
error: moving 9999 bytes
--> $DIR/box_rc_arc_allowed.rs:16:13
|
LL | let _ = NotBox::new([0; 9999]);
| ^^^^^^^^^^^^^^^^^^^^^^ value moved from here
|
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
note: the lint level is defined here
--> $DIR/box_rc_arc_allowed.rs:1:9
|
LL | #![deny(large_assignments)]
| ^^^^^^^^^^^^^^^^^

error: moving 9999 bytes
--> $DIR/box_rc_arc_allowed.rs:26:13
|
LL | data,
| ^^^^ value moved from here
|
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`

error: aborting due to 2 previous errors

23 changes: 23 additions & 0 deletions tests/ui/lint/large_assignments/large_future.attribute.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
error: moving 10024 bytes
--> $DIR/large_future.rs:19:14
|
LL | let z = (x, 42);
| ^ value moved from here
|
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
note: the lint level is defined here
--> $DIR/large_future.rs:1:9
|
LL | #![deny(large_assignments)]
| ^^^^^^^^^^^^^^^^^

error: moving 10024 bytes
--> $DIR/large_future.rs:20:13
|
LL | let a = z.0;
| ^^^ value moved from here
|
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`

error: aborting due to 2 previous errors

23 changes: 23 additions & 0 deletions tests/ui/lint/large_assignments/large_future.option.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
error: moving 10024 bytes
--> $DIR/large_future.rs:19:14
|
LL | let z = (x, 42);
| ^ value moved from here
|
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
note: the lint level is defined here
--> $DIR/large_future.rs:1:9
|
LL | #![deny(large_assignments)]
| ^^^^^^^^^^^^^^^^^

error: moving 10024 bytes
--> $DIR/large_future.rs:20:13
|
LL | let a = z.0;
| ^^^ value moved from here
|
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`

error: aborting due to 2 previous errors

26 changes: 26 additions & 0 deletions tests/ui/lint/large_assignments/large_future.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#![deny(large_assignments)]
#![cfg_attr(attribute, feature(large_assignments))]
#![cfg_attr(attribute, move_size_limit = "1000")]
// build-fail
// only-x86_64
// revisions: attribute option
// [option]compile-flags: -Zmove-size-limit=1000

// edition:2018
// compile-flags: -Zmir-opt-level=0

fn main() {
let x = async {
let y = [0; 9999];
dbg!(y);
thing(&y).await;
dbg!(y);
};
let z = (x, 42); //~ ERROR large_assignments
let a = z.0; //~ ERROR large_assignments
let b = z.1;
}

async fn thing(y: &[u8]) {
dbg!(y);
}