Add an attribute to be able to configure the limit

This commit is contained in:
Oli Scherer 2021-03-26 16:28:52 +00:00 committed by Felix S. Klock II
parent e9696c8b62
commit a2f2179026
11 changed files with 65 additions and 11 deletions

View file

@ -1,4 +1,6 @@
#![deny(large_assignments)]
#![feature(large_assignments)]
#![move_size_limit = "1000"]
// build-fail
// edition:2018

View file

@ -1,5 +1,5 @@
error: moving 10024 bytes
--> $DIR/large_moves.rs:7:13
--> $DIR/large_moves.rs:9:13
|
LL | let x = async {
| _____________^
@ -17,19 +17,19 @@ LL | #![deny(large_assignments)]
| ^^^^^^^^^^^^^^^^^
error: moving 10024 bytes
--> $DIR/large_moves.rs:13:14
--> $DIR/large_moves.rs:15:14
|
LL | let z = (x, 42);
| ^ value moved from here
error: moving 10024 bytes
--> $DIR/large_moves.rs:13:13
--> $DIR/large_moves.rs:15:13
|
LL | let z = (x, 42);
| ^^^^^^^ value moved from here
error: moving 10024 bytes
--> $DIR/large_moves.rs:15:13
--> $DIR/large_moves.rs:17:13
|
LL | let a = z.0;
| ^^^ value moved from here

View file

@ -0,0 +1,5 @@
// check that `move_size_limit is feature-gated
#![move_size_limit = "42"] //~ ERROR the `#[move_size_limit]` attribute is an experimental feature
fn main() {}

View file

@ -0,0 +1,12 @@
error[E0658]: the `#[move_size_limit]` attribute is an experimental feature
--> $DIR/feature-gate-large-assignments.rs:3:1
|
LL | #![move_size_limit = "42"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #83518 <https://github.com/rust-lang/rust/issues/83518> for more information
= help: add `#![feature(large_assignments)]` to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.