remove inside_canonicalization_ctxt flag
we never reach the code checking for this flag while the flag is enabled, so it does not change the behavior of the code.
This commit is contained in:
@@ -39,7 +39,6 @@ use rustc_span::Span;
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt;
|
||||
use std::ops::Drop;
|
||||
|
||||
use self::combine::CombineFields;
|
||||
use self::error_reporting::TypeErrCtxt;
|
||||
@@ -342,11 +341,6 @@ pub struct InferCtxt<'tcx> {
|
||||
/// there is no type that the user could *actually name* that
|
||||
/// would satisfy it. This avoids crippling inference, basically.
|
||||
pub intercrate: bool,
|
||||
|
||||
/// Flag that is set when we enter canonicalization. Used for debugging to ensure
|
||||
/// that we only collect region information for `BorrowckInferCtxt::reg_var_to_origin`
|
||||
/// inside non-canonicalization contexts.
|
||||
inside_canonicalization_ctxt: Cell<bool>,
|
||||
}
|
||||
|
||||
/// See the `error_reporting` module for more details.
|
||||
@@ -638,7 +632,6 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
|
||||
skip_leak_check: Cell::new(false),
|
||||
universe: Cell::new(ty::UniverseIndex::ROOT),
|
||||
intercrate,
|
||||
inside_canonicalization_ctxt: Cell::new(false),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1636,31 +1629,6 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn inside_canonicalization_ctxt(&self) -> bool {
|
||||
self.inside_canonicalization_ctxt.get()
|
||||
}
|
||||
|
||||
pub fn set_canonicalization_ctxt(&self) -> CanonicalizationCtxtGuard<'_, 'tcx> {
|
||||
let prev_ctxt = self.inside_canonicalization_ctxt();
|
||||
self.inside_canonicalization_ctxt.set(true);
|
||||
CanonicalizationCtxtGuard { prev_ctxt, infcx: self }
|
||||
}
|
||||
|
||||
fn set_canonicalization_ctxt_to(&self, ctxt: bool) {
|
||||
self.inside_canonicalization_ctxt.set(ctxt);
|
||||
}
|
||||
}
|
||||
|
||||
pub struct CanonicalizationCtxtGuard<'cx, 'tcx> {
|
||||
prev_ctxt: bool,
|
||||
infcx: &'cx InferCtxt<'tcx>,
|
||||
}
|
||||
|
||||
impl<'cx, 'tcx> Drop for CanonicalizationCtxtGuard<'cx, 'tcx> {
|
||||
fn drop(&mut self) {
|
||||
self.infcx.set_canonicalization_ctxt_to(self.prev_ctxt)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
|
||||
Reference in New Issue
Block a user