Open utaal opened 4 years ago
From what I can see, Polonius currently computes move errors for points where an uninitialized (moved) path is accessed, but not for points where a path is assigned (like in the example above).
I prototyped a new rule here: https://github.com/rust-lang/polonius/compare/master...utaal:partial-move-errors The branch is an attempt to compute errors for partial assignments to uninitialized variables, which are currently handled by a separate rustc pass.
As an example, with this branch you get a partial_move_error fact for:
struct Lin { v: u64 } fn main() { let mut a: Lin = Lin { v: 3 }; take(a); a.v = 7; // <- this assignment } fn take<V>(_v: V) { }
cc @lqd @albins (also see the conversation on Zulip, https://rust-lang.zulipchat.com/#narrow/stream/186049-t-compiler.2Fwg-polonius/topic/move.20errors.3A.20partial.20assignments.20to.20moved.20variables)
From what I can see, Polonius currently computes move errors for points where an uninitialized (moved) path is accessed, but not for points where a path is assigned (like in the example above).
I prototyped a new rule here: https://github.com/rust-lang/polonius/compare/master...utaal:partial-move-errors The branch is an attempt to compute errors for partial assignments to uninitialized variables, which are currently handled by a separate rustc pass.
As an example, with this branch you get a partial_move_error fact for:
cc @lqd @albins (also see the conversation on Zulip, https://rust-lang.zulipchat.com/#narrow/stream/186049-t-compiler.2Fwg-polonius/topic/move.20errors.3A.20partial.20assignments.20to.20moved.20variables)