Move deref-lval test

This commit is contained in:
Alexis Bourget 2020-09-08 23:38:23 +02:00
parent 949c96660c
commit ed52c7bb75
2 changed files with 9 additions and 11 deletions

View File

@ -49,3 +49,12 @@ fn box_clone_from_ptr_stability() {
assert_eq!(copy.as_ptr() as usize, copy_raw);
}
}
#[test]
fn box_deref_lval() {
use std::cell::Cell;
let x = Box::new(Cell::new(5));
x.set(1000);
assert_eq!(x.get(), 1000);
}

View File

@ -1,11 +0,0 @@
// run-pass
#![feature(box_syntax)]
use std::cell::Cell;
pub fn main() {
let x: Box<_> = box Cell::new(5);
x.set(1000);
println!("{}", x.get());
}