1 // Test that we restrict precision of a capture when we access a raw ptr,
2 // i.e. the capture doesn't deref the raw ptr.
4 #![feature(capture_disjoint_fields)]
5 //~^ WARNING: the feature `capture_disjoint_fields` is incomplete
6 //~| `#[warn(incomplete_features)]` on by default
7 //~| see issue #53488 <https://github.com/rust-lang/rust/issues/53488>
8 #![feature(rustc_attrs)]
21 let my_speed: Box<S> = Box::new(S { s, t });
23 let p : *const S = Box::into_raw(my_speed);
26 let c = #[rustc_capture_analysis]
27 //~^ ERROR: attributes on expressions are experimental
28 //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
30 //~^ ERROR: First Pass analysis includes:
31 //~| ERROR: Min Capture analysis includes:
32 println!("{:?}", (*t.0).s);
33 //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow
34 //~| NOTE: Min Capture t[(0, 0)] -> ImmBorrow
43 let mut my_speed: Box<S> = Box::new(S { s, t });
44 let p : *mut S = &mut *my_speed;
46 let c = #[rustc_capture_analysis]
47 //~^ ERROR: attributes on expressions are experimental
48 //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
50 //~^ ERROR: First Pass analysis includes:
51 //~| ERROR: Min Capture analysis includes:
52 let x = unsafe { &mut (*p).s };
53 //~^ NOTE: Capturing p[Deref,(0, 0)] -> ImmBorrow
54 //~| NOTE: Min Capture p[] -> ImmBorrow