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: cast causes failure to promote to static #55385

Merged
merged 3 commits into from
Oct 27, 2018

Commits on Oct 27, 2018

  1. Add helpful logging statements.

    This commit adds logging statements to `promote_consts` and
    `qualify_consts` to make it easier to understand what it is doing.
    davidtwco committed Oct 27, 2018
    Configuration menu
    Copy the full SHA
    9169f81 View commit details
    Browse the repository at this point in the history
  2. Test for cast causing static promotion failure.

    This commit adds a test that ensures that a cast in a static doesn't
    stop const promotion within the static.
    davidtwco committed Oct 27, 2018
    Configuration menu
    Copy the full SHA
    8a0d8c5 View commit details
    Browse the repository at this point in the history
  3. Refactor and add PlaceContext::AscribeUserTy.

    This commit refactors `PlaceContext` to split it into four different
    smaller enums based on if the context represents a mutating use,
    non-mutating use, maybe-mutating use or a non-use (this is based on the
    recommendation from @oli-obk on Zulip[1]).
    
    This commit then introduces a `PlaceContext::AscribeUserTy` variant.
    `StatementKind::AscribeUserTy` is now correctly mapped to
    `PlaceContext::AscribeUserTy` instead of `PlaceContext::Validate`.
    `PlaceContext::AscribeUserTy` can also now be correctly categorized as a
    non-use which fixes an issue with constant promotion in statics after a
    cast introduces a `AscribeUserTy` statement.
    
    [1]: https://rust-lang.zulipchat.com/#narrow/stream/122657-wg-nll/subject/.2355288.20cast.20fails.20to.20promote.20to.20'static/near/136536949
    davidtwco committed Oct 27, 2018
    Configuration menu
    Copy the full SHA
    6208bd8 View commit details
    Browse the repository at this point in the history