Rollup merge of #108560 - Nilstrieb:infer-cleanup, r=compiler-errors
Some `infer/mod.rs` cleanups
This commit is contained in:
commit
3ff3011afb
@ -156,7 +156,7 @@ pub struct InferCtxtInner<'tcx> {
|
|||||||
undo_log: InferCtxtUndoLogs<'tcx>,
|
undo_log: InferCtxtUndoLogs<'tcx>,
|
||||||
|
|
||||||
/// Caches for opaque type inference.
|
/// Caches for opaque type inference.
|
||||||
pub opaque_type_storage: OpaqueTypeStorage<'tcx>,
|
opaque_type_storage: OpaqueTypeStorage<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> InferCtxtInner<'tcx> {
|
impl<'tcx> InferCtxtInner<'tcx> {
|
||||||
@ -195,41 +195,17 @@ impl<'tcx> InferCtxtInner<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn int_unification_table(
|
fn int_unification_table(&mut self) -> UnificationTable<'_, 'tcx, ty::IntVid> {
|
||||||
&mut self,
|
|
||||||
) -> ut::UnificationTable<
|
|
||||||
ut::InPlace<
|
|
||||||
ty::IntVid,
|
|
||||||
&mut ut::UnificationStorage<ty::IntVid>,
|
|
||||||
&mut InferCtxtUndoLogs<'tcx>,
|
|
||||||
>,
|
|
||||||
> {
|
|
||||||
self.int_unification_storage.with_log(&mut self.undo_log)
|
self.int_unification_storage.with_log(&mut self.undo_log)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn float_unification_table(
|
fn float_unification_table(&mut self) -> UnificationTable<'_, 'tcx, ty::FloatVid> {
|
||||||
&mut self,
|
|
||||||
) -> ut::UnificationTable<
|
|
||||||
ut::InPlace<
|
|
||||||
ty::FloatVid,
|
|
||||||
&mut ut::UnificationStorage<ty::FloatVid>,
|
|
||||||
&mut InferCtxtUndoLogs<'tcx>,
|
|
||||||
>,
|
|
||||||
> {
|
|
||||||
self.float_unification_storage.with_log(&mut self.undo_log)
|
self.float_unification_storage.with_log(&mut self.undo_log)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn const_unification_table(
|
fn const_unification_table(&mut self) -> UnificationTable<'_, 'tcx, ty::ConstVid<'tcx>> {
|
||||||
&mut self,
|
|
||||||
) -> ut::UnificationTable<
|
|
||||||
ut::InPlace<
|
|
||||||
ty::ConstVid<'tcx>,
|
|
||||||
&mut ut::UnificationStorage<ty::ConstVid<'tcx>>,
|
|
||||||
&mut InferCtxtUndoLogs<'tcx>,
|
|
||||||
>,
|
|
||||||
> {
|
|
||||||
self.const_unification_storage.with_log(&mut self.undo_log)
|
self.const_unification_storage.with_log(&mut self.undo_log)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1429,17 +1405,14 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Attempts to resolve all type/region/const variables in
|
||||||
|
/// `value`. Region inference must have been run already (e.g.,
|
||||||
|
/// by calling `resolve_regions_and_report_errors`). If some
|
||||||
|
/// variable was never unified, an `Err` results.
|
||||||
|
///
|
||||||
|
/// This method is idempotent, but it not typically not invoked
|
||||||
|
/// except during the writeback phase.
|
||||||
pub fn fully_resolve<T: TypeFoldable<TyCtxt<'tcx>>>(&self, value: T) -> FixupResult<'tcx, T> {
|
pub fn fully_resolve<T: TypeFoldable<TyCtxt<'tcx>>>(&self, value: T) -> FixupResult<'tcx, T> {
|
||||||
/*!
|
|
||||||
* Attempts to resolve all type/region/const variables in
|
|
||||||
* `value`. Region inference must have been run already (e.g.,
|
|
||||||
* by calling `resolve_regions_and_report_errors`). If some
|
|
||||||
* variable was never unified, an `Err` results.
|
|
||||||
*
|
|
||||||
* This method is idempotent, but it not typically not invoked
|
|
||||||
* except during the writeback phase.
|
|
||||||
*/
|
|
||||||
|
|
||||||
let value = resolve::fully_resolve(self, value);
|
let value = resolve::fully_resolve(self, value);
|
||||||
assert!(
|
assert!(
|
||||||
value.as_ref().map_or(true, |value| !value.needs_infer()),
|
value.as_ref().map_or(true, |value| !value.needs_infer()),
|
||||||
@ -1754,7 +1727,6 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
// in this case. The typechecker should only ever report type errors involving mismatched
|
// in this case. The typechecker should only ever report type errors involving mismatched
|
||||||
// types using one of these methods, and should not call span_err directly for such
|
// types using one of these methods, and should not call span_err directly for such
|
||||||
// errors.
|
// errors.
|
||||||
|
|
||||||
pub fn type_error_struct_with_diag<M>(
|
pub fn type_error_struct_with_diag<M>(
|
||||||
&self,
|
&self,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user