Add new MutatatingUseContexts for deinit and SetDiscriminant

This commit is contained in:
Jakob Degen 2022-04-11 06:04:53 -04:00
parent f7ca97a209
commit 48b01a0d0e
9 changed files with 57 additions and 41 deletions

View file

@ -897,8 +897,10 @@ impl Visitor<'_> for CanConstProp {
// mutations of the same local via `Store`
| MutatingUse(MutatingUseContext::Call)
| MutatingUse(MutatingUseContext::AsmOutput)
| MutatingUse(MutatingUseContext::Deinit)
// Actual store that can possibly even propagate a value
| MutatingUse(MutatingUseContext::Store) => {
| MutatingUse(MutatingUseContext::Store)
| MutatingUse(MutatingUseContext::SetDiscriminant) => {
if !self.found_assignment.insert(local) {
match &mut self.can_const_prop[local] {
// If the local can only get propagated in its own block, then we don't have

View file

@ -778,7 +778,9 @@ impl Visitor<'_> for CanConstProp {
// mutations of the same local via `Store`
| MutatingUse(MutatingUseContext::Call)
| MutatingUse(MutatingUseContext::AsmOutput)
| MutatingUse(MutatingUseContext::Deinit)
// Actual store that can possibly even propagate a value
| MutatingUse(MutatingUseContext::SetDiscriminant)
| MutatingUse(MutatingUseContext::Store) => {
if !self.found_assignment.insert(local) {
match &mut self.can_const_prop[local] {