forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/ui: Split large_moves.rs and move to lint/large_assignments
To make failing tests easier to debug with --emit=mir, etc.
- Loading branch information
Showing
7 changed files
with
98 additions
and
96 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#![deny(large_assignments)] | ||
#![feature(large_assignments)] | ||
#![move_size_limit = "1000"] | ||
// build-fail | ||
// only-x86_64 | ||
|
||
// edition:2018 | ||
// compile-flags: -Zmir-opt-level=0 | ||
|
||
use std::{sync::Arc, rc::Rc}; | ||
|
||
fn main() { | ||
let _ = Arc::new([0; 9999]); // OK! | ||
let _ = Box::new([0; 9999]); // OK! | ||
let _ = Rc::new([0; 9999]); // OK! | ||
let _ = NotBox::new([0; 9999]); //~ ERROR large_assignments | ||
} | ||
|
||
struct NotBox { | ||
data: [u8; 9999], | ||
} | ||
|
||
impl NotBox { | ||
fn new(data: [u8; 9999]) -> Self { | ||
Self { | ||
data, //~ ERROR large_assignments | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
error: moving 9999 bytes | ||
--> $DIR/box_rc_arc_allowed.rs:16:13 | ||
| | ||
LL | let _ = NotBox::new([0; 9999]); | ||
| ^^^^^^^^^^^^^^^^^^^^^^ value moved from here | ||
| | ||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` | ||
note: the lint level is defined here | ||
--> $DIR/box_rc_arc_allowed.rs:1:9 | ||
| | ||
LL | #![deny(large_assignments)] | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error: moving 9999 bytes | ||
--> $DIR/box_rc_arc_allowed.rs:26:13 | ||
| | ||
LL | data, | ||
| ^^^^ value moved from here | ||
| | ||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` | ||
|
||
error: aborting due to 2 previous errors | ||
|
23 changes: 23 additions & 0 deletions
23
tests/ui/lint/large_assignments/large_future.attribute.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
error: moving 10024 bytes | ||
--> $DIR/large_future.rs:19:14 | ||
| | ||
LL | let z = (x, 42); | ||
| ^ value moved from here | ||
| | ||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` | ||
note: the lint level is defined here | ||
--> $DIR/large_future.rs:1:9 | ||
| | ||
LL | #![deny(large_assignments)] | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error: moving 10024 bytes | ||
--> $DIR/large_future.rs:20:13 | ||
| | ||
LL | let a = z.0; | ||
| ^^^ value moved from here | ||
| | ||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` | ||
|
||
error: aborting due to 2 previous errors | ||
|
23 changes: 23 additions & 0 deletions
23
tests/ui/lint/large_assignments/large_future.option.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
error: moving 10024 bytes | ||
--> $DIR/large_future.rs:19:14 | ||
| | ||
LL | let z = (x, 42); | ||
| ^ value moved from here | ||
| | ||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` | ||
note: the lint level is defined here | ||
--> $DIR/large_future.rs:1:9 | ||
| | ||
LL | #![deny(large_assignments)] | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error: moving 10024 bytes | ||
--> $DIR/large_future.rs:20:13 | ||
| | ||
LL | let a = z.0; | ||
| ^^^ value moved from here | ||
| | ||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` | ||
|
||
error: aborting due to 2 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters