You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I reckon it should be possible to make a unit test in die.rs which demonstrates what we are trying to achieve, something like this:
let src = "
brillig(inline) fn main f0 {
b0(v0: &mut [Field; 3]):
v1 = load v0 -> [Field; 3]
inc_rc v1
jmp b1()
b1():
v1 = load v0 -> [Field; 3]
v2 = array_set v1, index u32 0, value u32 0
store v2 at v0
return
}
";
So there is one block that contains a mutation of the array, and another block that contains the inc_rc, and what we want to know is that the inc_rc is preserved, whereas perviously it would have been removed because the array is not removed.
There are two cases:
The mutated array is returned, but not from the block where the inc_rc was, and therefore the inc_rc gets eliminated. In this case the "mark arrays in terminator as mutable" would have flagged it up if the inc_rc was in the same block, but not in the other block which doesn't contain the return. The fix is that we pass the array of mutable types between blocks.
The mutated array is not, just reached through a reference like in this example, so the "mark terminator" doesn't do anything. In this case we need the mark_function_parameter_arrays_as_used as well.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem*
Resolves #7246
Summary*
RcTracker is now part of the DIE context
Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.