about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-07-27 19:52:40 +0900
committerGitHub <noreply@github.com>2021-07-27 19:52:40 +0900
commit99a6474bc45c66823972da3e4e23dc4cf47dd79a (patch)
treed06fe78bdab65bcb4b127f2c75cdb6cdfbfe15e8 /src/doc
parent998cfe5aad7c21eb19a4bca50f05a13354706970 (diff)
parent9792179648abb7bf38a9e54191cfe5a25436b8fb (diff)
downloadrust-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/doc')
-rw-r--r--src/doc/unstable-book/src/compiler-flags/move-size-limit.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/compiler-flags/move-size-limit.md b/src/doc/unstable-book/src/compiler-flags/move-size-limit.md
new file mode 100644
index 00000000000..88f022af2ec
--- /dev/null
+++ b/src/doc/unstable-book/src/compiler-flags/move-size-limit.md
@@ -0,0 +1,10 @@
+# `move_size_limit`
+
+--------------------
+
+The `-Zmove-size-limit=N` compiler flag enables `large_assignments` lints which
+will warn when moving objects whose size exceeds `N` bytes.
+
+Lint warns only about moves in functions that participate in code generation.
+Consequently it will be ineffective for compiler invocatation that emit
+metadata only, i.e., `cargo check` like workflows.