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

rustc/rustc_mir: Implement RFC 2203. #61749

Merged
merged 5 commits into from
Jul 19, 2019

Commits on Jul 7, 2019

  1. rustc/rustc_mir: Implement RFC 2203.

    This commit implements RFC 2203, allowing constants in array repeat
    expressions.
    
    Firstly, the check that the array repeat expression implements `Copy` is
    removed and re-implemented in `rustc_mir::borrow_check::nll::type_check`
    by emitting an error when the MIR contains a `Operand::Move` and the
    type does not implement `Copy`.
    
    Next, the `qualify_consts` pass is modified to construct a
    `Candidate::Repeat` when it would be correct to promote a array repeat
    expression.
    
    Finally, the `promote_consts` pass is modified to promote the candidates
    previously identified.
    davidtwco committed Jul 7, 2019
    Configuration menu
    Copy the full SHA
    485a802 View commit details
    Browse the repository at this point in the history
  2. syntax: Add feature gate.

    This commit adds a `const_in_array_repeat_expressions` feature gate and
    only create `Candidate::Repeat` if it is enabled.
    davidtwco committed Jul 7, 2019
    Configuration menu
    Copy the full SHA
    3cca4ce View commit details
    Browse the repository at this point in the history
  3. rustc_mir: Re-use report_selection_error.

    This commit replaces the new error that was being emitted in NLL type
    check with a call to `report_selection_error` so that the same trait
    error as before this PR is emitted.
    davidtwco committed Jul 7, 2019
    Configuration menu
    Copy the full SHA
    813c994 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a655438 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4b1bc2d View commit details
    Browse the repository at this point in the history