Static rustc_lint::builtin::DISJOINT_CAPTURE_DROP_REORDER [−][src]
pub static DISJOINT_CAPTURE_DROP_REORDER: &'static Lint
The disjoint_capture_drop_reorder lint detects variables that aren’t completely
captured when the feature capture_disjoint_fields is enabled and it affects the Drop
order of at least one path starting at this variable.
Example
ⓘ
struct FancyInteger(i32); impl Drop for FancyInteger { fn drop(&mut self) { println!("Just dropped {}", self.0); } } struct Point { x: FancyInteger, y: FancyInteger } fn main() { let p = Point { x: FancyInteger(10), y: FancyInteger(20) }; let c = || { let x = p.x; }; c(); // ... More code ... }
{{produces}}
Explanation
In the above example p.y will be dropped at the end of f instead of with c if
the feature capture_disjoint_fields is enabled.