From 9792179648abb7bf38a9e54191cfe5a25436b8fb Mon Sep 17 00:00:00 2001 From: Tomasz Miąsko Date: Sat, 19 Jun 2021 00:00:00 +0000 Subject: 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 ``` --- compiler/rustc_session/src/options.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'compiler/rustc_session/src') diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 4c40d0c367e..4232d604816 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1147,6 +1147,8 @@ options! { (default: no)"), mir_opt_level: Option = (None, parse_opt_number, [TRACKED], "MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)"), + move_size_limit: Option = (None, parse_opt_number, [TRACKED], + "the size at which the `large_assignments` lint starts to be emitted"), mutable_noalias: Option = (None, parse_opt_bool, [TRACKED], "emit noalias metadata for mutable references (default: yes for LLVM >= 12, otherwise no)"), new_llvm_pass_manager: Option = (None, parse_opt_bool, [TRACKED], -- cgit 1.4.1-3-g733a5