Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NLL Diagnostic Review 3: Unions not reinitialized after assignment into field #55657

Merged
merged 3 commits into from Nov 11, 2018

Commits on Nov 3, 2018

  1. Unions reinitialized after assignment into field.

    This commit makes two changes:
    
    First, it updates the dataflow builder to add an init for the place
    containing a union if there is an assignment into the field of
    that union.
    
    Second, it stops a "use of uninitialized" error occuring when there is an
    assignment into the field of an uninitialized union that was previously
    initialized. Making this assignment would re-initialize the union, as
    tested in `src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr`.
    The check for previous initialization ensures that we do not start
    supporting partial initialization yet (cc rust-lang#21232, rust-lang#54499, rust-lang#54986).
    davidtwco committed Nov 3, 2018
    Copy the full SHA
    a4e0945 View commit details
    Browse the repository at this point in the history

Commits on Nov 5, 2018

  1. Add run-pass test for reinitialized unions.

    This commit adds a run-pass test for the subset of
    `src/test/ui/borrowck/borrowck-union-move-assign.rs` that is intended to
    pass as the union is reinitialized.
    davidtwco committed Nov 5, 2018
    Copy the full SHA
    8e7786a View commit details
    Browse the repository at this point in the history
  2. Improve predecessor detection.

    It is necessary to detect whether we are making the first
    assignment into a union. This is checked by looking at the moves and
    checking if there are any from locations earlier in the control flow
    graph.
    
    This commit improves the detection of this by switching from a naive
    method that compared only the statement and basic block indices with
    a more robust method that looks at the predecessors of a location.
    davidtwco committed Nov 5, 2018
    Copy the full SHA
    1672c27 View commit details
    Browse the repository at this point in the history