Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types_escaping_snapshot is unused #77740

Closed
est31 opened this issue Oct 9, 2020 · 1 comment
Closed

types_escaping_snapshot is unused #77740

est31 opened this issue Oct 9, 2020 · 1 comment
Labels
A-inference Area: Type inference C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@est31
Copy link
Member

est31 commented Oct 9, 2020

I'm not familiar enough with the code to know what the purpose of types_escaping_snapshot is, but it seems unused.

/// Finds the set of type variables that existed *before* `s`
/// but which have only been unified since `s` started, and
/// return the types with which they were unified. So if we had
/// a type variable `V0`, then we started the snapshot, then we
/// created a type variable `V1`, unified `V0` with `T0`, and
/// unified `V1` with `T1`, this function would return `{T0}`.
pub fn types_escaping_snapshot(&mut self, s: &super::Snapshot<'tcx>) -> Vec<Ty<'tcx>> {
let mut new_elem_threshold = u32::MAX;
let mut escaping_types = Vec::new();
let actions_since_snapshot = self.undo_log.actions_since_snapshot(s);
debug!("actions_since_snapshot.len() = {}", actions_since_snapshot.len());
for i in 0..actions_since_snapshot.len() {
let actions_since_snapshot = self.undo_log.actions_since_snapshot(s);
match actions_since_snapshot[i] {
super::UndoLog::TypeVariables(UndoLog::Values(sv::UndoLog::NewElem(index))) => {
// if any new variables were created during the
// snapshot, remember the lower index (which will
// always be the first one we see). Note that this
// action must precede those variables being
// specified.
new_elem_threshold = cmp::min(new_elem_threshold, index as u32);
debug!("NewElem({}) new_elem_threshold={}", index, new_elem_threshold);
}
super::UndoLog::TypeVariables(UndoLog::Values(sv::UndoLog::Other(
Instantiate { vid, .. },
))) => {
if vid.index < new_elem_threshold {
// quick check to see if this variable was
// created since the snapshot started or not.
let mut eq_relations = ut::UnificationTable::with_log(
&mut self.storage.eq_relations,
&mut *self.undo_log,
);
let escaping_type = match eq_relations.probe_value(vid) {
TypeVariableValue::Unknown { .. } => bug!(),
TypeVariableValue::Known { value } => value,
};
escaping_types.push(escaping_type);
}
debug!("SpecifyVar({:?}) new_elem_threshold={}", vid, new_elem_threshold);
}
_ => {}
}
}
escaping_types
}

I'd just have removed it in #77739 but there are two comments mentioning it in the file and I'm not sure what to do about those.

@jonas-schievink jonas-schievink added A-inference Area: Type inference C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 9, 2020
@JohnTitor
Copy link
Member

#83185 removed it and #84570 tracks remaining tasks, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inference Area: Type inference C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants