rust/tests/ui/lint/large_assignments/box_rc_arc_allowed.rs
Martin Nordholts d016e9a686 tests/ui: Split large_moves.rs and move to lint/large_assignments
To make failing tests easier to debug with --emit=mir, etc.
2023-09-21 21:00:11 +02:00

30 lines
573 B
Rust

#![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
}
}
}