about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-09-22 12:15:26 +0200
committerGitHub <noreply@github.com>2023-09-22 12:15:26 +0200
commit06608c7860358eb995da112cbbf66f751feddc18 (patch)
tree7e5b31e250172728cab38a0b0bbdc43bb7395ecb
parentd5e7df3dbf61f5ecfa55b6f2d505c028a443b525 (diff)
parentd016e9a68602199bc4bb7c6e4f00a31c7284b3d4 (diff)
downloadrust-06608c7860358eb995da112cbbf66f751feddc18.tar.gz
rust-06608c7860358eb995da112cbbf66f751feddc18.zip
Rollup merge of #116036 - Enselic:split-large_moves, r=oli-obk
tests/ui: Split large_moves.rs and move to lint/large_assignments

To make failing tests easier to debug with `--emit=mir`, etc.

Don't bother with `revisions: attribute option` for both tests though. Seems sufficient to just have that on one of the tests.

`git show -M --find-renames=40%` makes the diff easier to review. Or note that before this change we had one test with 4 errors, now we have 2 tests with 2 errors each.

r? `@oli-obk`

Part of https://github.com/rust-lang/rust/issues/83518
-rw-r--r--tests/ui/async-await/large_moves.attribute.stderr39
-rw-r--r--tests/ui/async-await/large_moves.option.stderr39
-rw-r--r--tests/ui/lint/large_assignments/box_rc_arc_allowed.rs (renamed from tests/ui/async-await/large_moves.rs)17
-rw-r--r--tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr23
-rw-r--r--tests/ui/lint/large_assignments/large_future.attribute.stderr23
-rw-r--r--tests/ui/lint/large_assignments/large_future.option.stderr23
-rw-r--r--tests/ui/lint/large_assignments/large_future.rs26
7 files changed, 96 insertions, 94 deletions
diff --git a/tests/ui/async-await/large_moves.attribute.stderr b/tests/ui/async-await/large_moves.attribute.stderr
deleted file mode 100644
index 1d1999462ce..00000000000
--- a/tests/ui/async-await/large_moves.attribute.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error: moving 10024 bytes
-  --> $DIR/large_moves.rs:21: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_moves.rs:1:9
-   |
-LL | #![deny(large_assignments)]
-   |         ^^^^^^^^^^^^^^^^^
-
-error: moving 10024 bytes
-  --> $DIR/large_moves.rs:22: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: moving 9999 bytes
-  --> $DIR/large_moves.rs:27: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 = "..."]`
-
-error: moving 9999 bytes
-  --> $DIR/large_moves.rs:41: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 4 previous errors
-
diff --git a/tests/ui/async-await/large_moves.option.stderr b/tests/ui/async-await/large_moves.option.stderr
deleted file mode 100644
index 1d1999462ce..00000000000
--- a/tests/ui/async-await/large_moves.option.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error: moving 10024 bytes
-  --> $DIR/large_moves.rs:21: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_moves.rs:1:9
-   |
-LL | #![deny(large_assignments)]
-   |         ^^^^^^^^^^^^^^^^^
-
-error: moving 10024 bytes
-  --> $DIR/large_moves.rs:22: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: moving 9999 bytes
-  --> $DIR/large_moves.rs:27: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 = "..."]`
-
-error: moving 9999 bytes
-  --> $DIR/large_moves.rs:41: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 4 previous errors
-
diff --git a/tests/ui/async-await/large_moves.rs b/tests/ui/lint/large_assignments/box_rc_arc_allowed.rs
index 62b12104694..33113642023 100644
--- a/tests/ui/async-await/large_moves.rs
+++ b/tests/ui/lint/large_assignments/box_rc_arc_allowed.rs
@@ -1,10 +1,8 @@
 #![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
@@ -12,25 +10,12 @@
 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],
 }
diff --git a/tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr b/tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr
new file mode 100644
index 00000000000..b45cbe5da4d
--- /dev/null
+++ b/tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr
@@ -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
+
diff --git a/tests/ui/lint/large_assignments/large_future.attribute.stderr b/tests/ui/lint/large_assignments/large_future.attribute.stderr
new file mode 100644
index 00000000000..734b7ff7ba2
--- /dev/null
+++ b/tests/ui/lint/large_assignments/large_future.attribute.stderr
@@ -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
+
diff --git a/tests/ui/lint/large_assignments/large_future.option.stderr b/tests/ui/lint/large_assignments/large_future.option.stderr
new file mode 100644
index 00000000000..734b7ff7ba2
--- /dev/null
+++ b/tests/ui/lint/large_assignments/large_future.option.stderr
@@ -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
+
diff --git a/tests/ui/lint/large_assignments/large_future.rs b/tests/ui/lint/large_assignments/large_future.rs
new file mode 100644
index 00000000000..834746fa97e
--- /dev/null
+++ b/tests/ui/lint/large_assignments/large_future.rs
@@ -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);
+}