about summary refs log tree commit diff
path: root/src/test/ui/refutable-pattern-errors.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-10-26 00:11:36 +0000
committerbors <bors@rust-lang.org>2019-10-26 00:11:36 +0000
commit084edc426f2e7e4bbedb5c6afa7fc422a52ee379 (patch)
tree75bc17685ea3dfdba8b1660405e3d2a9bb516a34 /src/test/ui/refutable-pattern-errors.rs
parent246be7e1a557b8ac8287c6842379a0db67770be6 (diff)
parentf2c8628920b73f546b6d1a64babd7e8a481a9b9f (diff)
downloadrust-084edc426f2e7e4bbedb5c6afa7fc422a52ee379.tar.gz
rust-084edc426f2e7e4bbedb5c6afa7fc422a52ee379.zip
Auto merge of #63812 - eddyb:promo-sanity, r=oli-obk
rustc_mir: double-check const-promotion candidates for sanity.

Previously, const promotion involved tracking information about the value in a MIR local (or any part of the computation leading up to that value), aka "qualifs", in a quite stateful manner, which is hard to extend to arbitrary CFGs without a dataflow pass.

However, the nature of the promotion we do is that it's effectively an SSA-like "tree" (or DAG, really), of assigned-once locals - which is how we can take them from the original MIR in the first place.
This structure means that the subset of the MIR responsible for computing any given part of a const-promoted value is readily analyzable by walking that tree/DAG.

This PR implements such an analysis in `promote_consts`, reusing the `HasMutInterior` / `NeedsDrop` computation from `qualify_consts`, but reimplementing the equivalent of `IsNotPromotable` / `IsNotImplicitlyPromotable`.

Eventually we should be able to remove `IsNotPromotable` / `IsNotImplicitlyPromotable` from `qualify_consts`, which will simplify @ecstatic-morse's dataflow-based const-checking efforts.

But currently this is mainly for a crater check-only run - it will compare the results from the old promotion collection and the new promotion validation and ICE if they don't match.

r? @oli-obk
Diffstat (limited to 'src/test/ui/refutable-pattern-errors.rs')
0 files changed, 0 insertions, 0 deletions