]> git.lizzy.rs Git - rust.git/commit
Refactor and add `PlaceContext::AscribeUserTy`.
authorDavid Wood <david@davidtw.co>
Fri, 26 Oct 2018 11:22:45 +0000 (13:22 +0200)
committerDavid Wood <david@davidtw.co>
Sat, 27 Oct 2018 10:11:37 +0000 (12:11 +0200)
commit6208bd8e03996e700950451e7614a6feb0163acb
tree52cd9420ac7d57cf5fb46a7fab5ef59d0a7f8738
parent8a0d8c5ab5541c28a64073d8af2592965941564c
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
13 files changed:
src/librustc/mir/visit.rs
src/librustc_codegen_llvm/mir/analyze.rs
src/librustc_mir/borrow_check/borrow_set.rs
src/librustc_mir/borrow_check/nll/type_check/mod.rs
src/librustc_mir/borrow_check/used_muts.rs
src/librustc_mir/transform/check_unsafety.rs
src/librustc_mir/transform/const_prop.rs
src/librustc_mir/transform/promote_consts.rs
src/librustc_mir/transform/qualify_consts.rs
src/librustc_mir/transform/simplify.rs
src/librustc_mir/transform/uniform_array_move_out.rs
src/librustc_mir/util/collect_writes.rs
src/librustc_mir/util/liveness.rs