3 // Test that we restrict precision of a capture when we access a raw ptr,
4 // i.e. the capture doesn't deref the raw ptr.
7 #![feature(rustc_attrs)]
20 let my_speed: Box<S> = Box::new(S { s, t });
22 let p : *const S = Box::into_raw(my_speed);
25 let c = #[rustc_capture_analysis]
26 //~^ ERROR: attributes on expressions are experimental
27 //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
29 //~^ ERROR: First Pass analysis includes:
30 //~| ERROR: Min Capture analysis includes:
31 println!("{:?}", (*t.0).s);
32 //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow
33 //~| NOTE: Min Capture t[(0, 0)] -> ImmBorrow
42 let mut my_speed: Box<S> = Box::new(S { s, t });
43 let p : *mut S = &mut *my_speed;
45 let c = #[rustc_capture_analysis]
46 //~^ ERROR: attributes on expressions are experimental
47 //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
49 //~^ ERROR: First Pass analysis includes:
50 //~| ERROR: Min Capture analysis includes:
51 let x = unsafe { &mut (*p).s };
52 //~^ NOTE: Capturing p[Deref,(0, 0)] -> ImmBorrow
53 //~| NOTE: Min Capture p[] -> ImmBorrow