leak_check: remove unused codepath
This commit is contained in:
parent
578bcbc2b4
commit
200ed9f8cd
@ -824,7 +824,7 @@ fn coerce_from_safe_fn<F, G>(
|
||||
// want the coerced type to be the actual supertype of these two,
|
||||
// but for now, we want to just error to ensure we don't lock
|
||||
// ourselves into a specific behavior with NLL.
|
||||
self.leak_check(false, snapshot)?;
|
||||
self.leak_check(snapshot)?;
|
||||
|
||||
result
|
||||
})
|
||||
|
@ -108,11 +108,7 @@ pub fn instantiate_binder_with_placeholders<T>(&self, binder: ty::Binder<'tcx, T
|
||||
/// See [RegionConstraintCollector::leak_check][1].
|
||||
///
|
||||
/// [1]: crate::infer::region_constraints::RegionConstraintCollector::leak_check
|
||||
pub fn leak_check(
|
||||
&self,
|
||||
overly_polymorphic: bool,
|
||||
snapshot: &CombinedSnapshot<'tcx>,
|
||||
) -> RelateResult<'tcx, ()> {
|
||||
pub fn leak_check(&self, snapshot: &CombinedSnapshot<'tcx>) -> RelateResult<'tcx, ()> {
|
||||
// If the user gave `-Zno-leak-check`, or we have been
|
||||
// configured to skip the leak check, then skip the leak check
|
||||
// completely. The leak check is deprecated. Any legitimate
|
||||
@ -125,7 +121,6 @@ pub fn leak_check(
|
||||
|
||||
self.inner.borrow_mut().unwrap_region_constraints().leak_check(
|
||||
self.tcx,
|
||||
overly_polymorphic,
|
||||
self.universe(),
|
||||
snapshot,
|
||||
)
|
||||
|
@ -65,13 +65,12 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
|
||||
pub fn leak_check(
|
||||
&mut self,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
overly_polymorphic: bool,
|
||||
max_universe: ty::UniverseIndex,
|
||||
snapshot: &CombinedSnapshot<'tcx>,
|
||||
) -> RelateResult<'tcx, ()> {
|
||||
debug!(
|
||||
"leak_check(max_universe={:?}, snapshot.universe={:?}, overly_polymorphic={:?})",
|
||||
max_universe, snapshot.universe, overly_polymorphic
|
||||
"leak_check(max_universe={:?}, snapshot.universe={:?})",
|
||||
max_universe, snapshot.universe
|
||||
);
|
||||
|
||||
assert!(UndoLogs::<super::UndoLog<'_>>::in_snapshot(&self.undo_log));
|
||||
@ -84,14 +83,8 @@ pub fn leak_check(
|
||||
let mini_graph =
|
||||
&MiniGraph::new(tcx, self.undo_log.region_constraints(), &self.storage.data.verifys);
|
||||
|
||||
let mut leak_check = LeakCheck::new(
|
||||
tcx,
|
||||
universe_at_start_of_snapshot,
|
||||
max_universe,
|
||||
overly_polymorphic,
|
||||
mini_graph,
|
||||
self,
|
||||
);
|
||||
let mut leak_check =
|
||||
LeakCheck::new(tcx, universe_at_start_of_snapshot, max_universe, mini_graph, self);
|
||||
leak_check.assign_placeholder_values()?;
|
||||
leak_check.propagate_scc_value()?;
|
||||
Ok(())
|
||||
@ -101,8 +94,6 @@ pub fn leak_check(
|
||||
struct LeakCheck<'me, 'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
universe_at_start_of_snapshot: ty::UniverseIndex,
|
||||
/// Only used when reporting region errors.
|
||||
overly_polymorphic: bool,
|
||||
mini_graph: &'me MiniGraph<'tcx>,
|
||||
rcc: &'me RegionConstraintCollector<'me, 'tcx>,
|
||||
|
||||
@ -132,7 +123,6 @@ fn new(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
universe_at_start_of_snapshot: ty::UniverseIndex,
|
||||
max_universe: ty::UniverseIndex,
|
||||
overly_polymorphic: bool,
|
||||
mini_graph: &'me MiniGraph<'tcx>,
|
||||
rcc: &'me RegionConstraintCollector<'me, 'tcx>,
|
||||
) -> Self {
|
||||
@ -140,7 +130,6 @@ fn new(
|
||||
Self {
|
||||
tcx,
|
||||
universe_at_start_of_snapshot,
|
||||
overly_polymorphic,
|
||||
mini_graph,
|
||||
rcc,
|
||||
scc_placeholders: IndexVec::from_elem_n(None, mini_graph.sccs.num_sccs()),
|
||||
@ -289,11 +278,7 @@ fn error(
|
||||
other_region: ty::Region<'tcx>,
|
||||
) -> TypeError<'tcx> {
|
||||
debug!("error: placeholder={:?}, other_region={:?}", placeholder, other_region);
|
||||
if self.overly_polymorphic {
|
||||
TypeError::RegionsOverlyPolymorphic(placeholder.bound.kind, other_region)
|
||||
} else {
|
||||
TypeError::RegionsInsufficientlyPolymorphic(placeholder.bound.kind, other_region)
|
||||
}
|
||||
TypeError::RegionsInsufficientlyPolymorphic(placeholder.bound.kind, other_region)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,6 @@ pub enum TypeError<'tcx> {
|
||||
|
||||
RegionsDoesNotOutlive(Region<'tcx>, Region<'tcx>),
|
||||
RegionsInsufficientlyPolymorphic(BoundRegionKind, Region<'tcx>),
|
||||
RegionsOverlyPolymorphic(BoundRegionKind, Region<'tcx>),
|
||||
RegionsPlaceholderMismatch,
|
||||
|
||||
Sorts(ExpectedFound<Ty<'tcx>>),
|
||||
@ -74,7 +73,6 @@ pub fn involves_regions(self) -> bool {
|
||||
match self {
|
||||
TypeError::RegionsDoesNotOutlive(_, _)
|
||||
| TypeError::RegionsInsufficientlyPolymorphic(_, _)
|
||||
| TypeError::RegionsOverlyPolymorphic(_, _)
|
||||
| TypeError::RegionsPlaceholderMismatch => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -98,11 +96,6 @@ fn report_maybe_different(expected: &str, found: &str) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
let br_string = |br: ty::BoundRegionKind| match br {
|
||||
ty::BrNamed(_, name) => format!(" {}", name),
|
||||
_ => String::new(),
|
||||
};
|
||||
|
||||
match self {
|
||||
CyclicTy(_) => "cyclic type of infinite size".into(),
|
||||
CyclicConst(_) => "encountered a self-referencing constant".into(),
|
||||
@ -144,11 +137,6 @@ fn report_maybe_different(expected: &str, found: &str) -> String {
|
||||
RegionsInsufficientlyPolymorphic(..) => {
|
||||
"one type is more general than the other".into()
|
||||
}
|
||||
RegionsOverlyPolymorphic(br, _) => format!(
|
||||
"expected concrete lifetime, found bound lifetime parameter{}",
|
||||
br_string(br)
|
||||
)
|
||||
.into(),
|
||||
RegionsPlaceholderMismatch => "one type is more general than the other".into(),
|
||||
ArgumentSorts(values, _) | Sorts(values) => {
|
||||
let expected = values.expected.sort_string(tcx);
|
||||
@ -228,7 +216,6 @@ pub fn must_include_note(self) -> bool {
|
||||
| FieldMisMatch(..)
|
||||
| RegionsDoesNotOutlive(..)
|
||||
| RegionsInsufficientlyPolymorphic(..)
|
||||
| RegionsOverlyPolymorphic(..)
|
||||
| RegionsPlaceholderMismatch
|
||||
| Traits(_)
|
||||
| ProjectionMismatched(_)
|
||||
|
@ -200,7 +200,7 @@ fn overlap_within_probe<'cx, 'tcx>(
|
||||
|
||||
// We disable the leak when creating the `snapshot` by using
|
||||
// `infcx.probe_maybe_disable_leak_check`.
|
||||
if infcx.leak_check(true, snapshot).is_err() {
|
||||
if infcx.leak_check(snapshot).is_err() {
|
||||
debug!("overlap: leak check failed");
|
||||
return None;
|
||||
}
|
||||
|
@ -563,7 +563,7 @@ fn evaluation_probe(
|
||||
self.infcx.probe(|snapshot| -> Result<EvaluationResult, OverflowError> {
|
||||
let result = op(self)?;
|
||||
|
||||
match self.infcx.leak_check(true, snapshot) {
|
||||
match self.infcx.leak_check(snapshot) {
|
||||
Ok(()) => {}
|
||||
Err(_) => return Ok(EvaluatedToErr),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user