Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Created November 3, 2017 21:46
Show Gist options
  • Save nikomatsakis/4f15f08035608c7660c3c23418040c97 to your computer and use it in GitHub Desktop.
Save nikomatsakis/4f15f08035608c7660c3c23418040c97 to your computer and use it in GitHub Desktop.
let mut current_predicates = map();
for each struct/enum S {
current_predicates[S] = explicit_predicates(S);
}
let mut changed = true;
while changed {
changed = false;
for each struct/enum S {
for each field F in S {
// Key point is that `requirements(F.type)` will wind up reading
// from `current_predicates`.
let r = requirements(F.type);
let old_len = current_predicates[S];
current_predicates[S].extend(r);
changed = changed | currrent_predicates[S].len() != old_len; // something new was added
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment