diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-07-27 19:52:40 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-27 19:52:40 +0900 |
| commit | 99a6474bc45c66823972da3e4e23dc4cf47dd79a (patch) | |
| tree | d06fe78bdab65bcb4b127f2c75cdb6cdfbfe15e8 /src/test | |
| parent | 998cfe5aad7c21eb19a4bca50f05a13354706970 (diff) | |
| parent | 9792179648abb7bf38a9e54191cfe5a25436b8fb (diff) | |
| download | rust-99a6474bc45c66823972da3e4e23dc4cf47dd79a.tar.gz rust-99a6474bc45c66823972da3e4e23dc4cf47dd79a.zip | |
Rollup merge of #86450 - tmiasko:move-size-limit, r=pnkfelix
Add flag to configure `large_assignments` lint The `large_assignments` lints detects moves over specified limit. The limit is configured through `move_size_limit = "N"` attribute placed at the root of a crate. When attribute is absent, the lint is disabled. Make it possible to enable the lint without making any changes to the source code, through a new flag `-Zmove-size-limit=N`. For example, to detect moves exceeding 1023 bytes in a cargo crate, including all dependencies one could use: ``` $ env RUSTFLAGS=-Zmove-size-limit=1024 cargo build -vv ``` Lint tracking issue #83518.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/async-await/large_moves.attribute.stderr (renamed from src/test/ui/async-await/large_moves.stderr) | 8 | ||||
| -rw-r--r-- | src/test/ui/async-await/large_moves.option.stderr | 38 | ||||
| -rw-r--r-- | src/test/ui/async-await/large_moves.rs | 4 |
3 files changed, 45 insertions, 5 deletions
diff --git a/src/test/ui/async-await/large_moves.stderr b/src/test/ui/async-await/large_moves.attribute.stderr index 8c47ec0ed9d..39b7e7cb345 100644 --- a/src/test/ui/async-await/large_moves.stderr +++ b/src/test/ui/async-await/large_moves.attribute.stderr @@ -1,5 +1,5 @@ error: moving 10024 bytes - --> $DIR/large_moves.rs:10:13 + --> $DIR/large_moves.rs:12:13 | LL | let x = async { | _____________^ @@ -17,19 +17,19 @@ LL | #![deny(large_assignments)] | ^^^^^^^^^^^^^^^^^ error: moving 10024 bytes - --> $DIR/large_moves.rs:16:14 + --> $DIR/large_moves.rs:18:14 | LL | let z = (x, 42); | ^ value moved from here error: moving 10024 bytes - --> $DIR/large_moves.rs:16:13 + --> $DIR/large_moves.rs:18:13 | LL | let z = (x, 42); | ^^^^^^^ value moved from here error: moving 10024 bytes - --> $DIR/large_moves.rs:18:13 + --> $DIR/large_moves.rs:20:13 | LL | let a = z.0; | ^^^ value moved from here diff --git a/src/test/ui/async-await/large_moves.option.stderr b/src/test/ui/async-await/large_moves.option.stderr new file mode 100644 index 00000000000..39b7e7cb345 --- /dev/null +++ b/src/test/ui/async-await/large_moves.option.stderr @@ -0,0 +1,38 @@ +error: moving 10024 bytes + --> $DIR/large_moves.rs:12:13 + | +LL | let x = async { + | _____________^ +LL | | let y = [0; 9999]; +LL | | dbg!(y); +LL | | thing(&y).await; +LL | | dbg!(y); +LL | | }; + | |_____^ value moved from here + | +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:18:14 + | +LL | let z = (x, 42); + | ^ value moved from here + +error: moving 10024 bytes + --> $DIR/large_moves.rs:18:13 + | +LL | let z = (x, 42); + | ^^^^^^^ value moved from here + +error: moving 10024 bytes + --> $DIR/large_moves.rs:20:13 + | +LL | let a = z.0; + | ^^^ value moved from here + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/async-await/large_moves.rs b/src/test/ui/async-await/large_moves.rs index 4fac046beef..18bb538a81e 100644 --- a/src/test/ui/async-await/large_moves.rs +++ b/src/test/ui/async-await/large_moves.rs @@ -1,8 +1,10 @@ #![deny(large_assignments)] #![feature(large_assignments)] -#![move_size_limit = "1000"] +#![cfg_attr(attribute, move_size_limit = "1000")] // build-fail // only-x86_64 +// revisions: attribute option +// [option]compile-flags: -Zmove-size-limit=1000 // edition:2018 |
