Skip to content

Commit a9cb350

Browse files
committed
Set default move_size_limit to 4kB for large_assignments lint on nightly
Only enable it by default in the nightly compiler. The limit can be changed on a per-crate basis with: #![feature(large_assignments)] #![move_size_limit = "8192"] or with -Zmove-size-limit=8192
1 parent 39a42c3 commit a9cb350

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

compiler/rustc_middle/src/middle/limits.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@ pub fn provide(providers: &mut Providers) {
2525
tcx.hir().krate_attrs(),
2626
tcx.sess,
2727
sym::move_size_limit,
28-
tcx.sess.opts.unstable_opts.move_size_limit.unwrap_or(0),
28+
// The check is enabled by default in nightly compilers without
29+
// needing `#![feature(large_assignments)]` with a limit of 4096
30+
// bytes. But if the user wants to use adjust `#![move_size_limit]`,
31+
// then `#![feature(large_assignments)]` is needed.
32+
tcx.sess.opts.unstable_opts.move_size_limit.unwrap_or(if tcx.sess.is_nightly_build() {
33+
4096
34+
} else {
35+
0
36+
}),
2937
),
3038
type_length_limit: get_limit(
3139
tcx.hir().krate_attrs(),

0 commit comments

Comments
 (0)