]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-borrow-from-expr-block.rs
Merge commit '27afd6ade4bb1123a8bf82001629b69d23d62aff' into clippyup
[rust.git] / src / test / ui / borrowck / borrowck-borrow-from-expr-block.rs
1 // run-pass
2 #![feature(box_syntax)]
3
4 fn borrow<F>(x: &isize, f: F) where F: FnOnce(&isize) {
5     f(x)
6 }
7
8 fn test1(x: &Box<isize>) {
9     borrow(&*(*x).clone(), |p| {
10         let x_a = &**x as *const isize;
11         assert!((x_a as usize) != (p as *const isize as usize));
12         assert_eq!(unsafe{*x_a}, *p);
13     })
14 }
15
16 pub fn main() {
17     test1(&box 22);
18 }