use rustc_data_structures::undo_log::UndoLogs;
use rustc_hir::OpaqueTyOrigin;
-use rustc_middle::ty::{self, OpaqueTypeKey, Ty};
+use rustc_middle::ty::{self, OpaqueHiddenType, OpaqueTypeKey, Ty};
use rustc_span::DUMMY_SP;
use crate::infer::{InferCtxtUndoLogs, UndoLog};
-use super::{OpaqueHiddenType, OpaqueTypeDecl, OpaqueTypeMap};
+use super::{OpaqueTypeDecl, OpaqueTypeMap};
-#[derive(Default, Debug)]
+#[derive(Default, Debug, Clone)]
pub struct OpaqueTypeStorage<'tcx> {
// Opaque types found in explicit return types and their
// associated fresh inference variable. Writeback resolves these
}
}
- pub fn get_decl(&self, key: &OpaqueTypeKey<'tcx>) -> Option<&OpaqueTypeDecl<'tcx>> {
- self.opaque_types.get(key)
- }
-
- pub fn opaque_types(&self) -> OpaqueTypeMap<'tcx> {
- self.opaque_types.clone()
- }
-
#[instrument(level = "debug")]
pub fn take_opaque_types(&mut self) -> OpaqueTypeMap<'tcx> {
std::mem::take(&mut self.opaque_types)
impl<'a, 'tcx> OpaqueTypeTable<'a, 'tcx> {
#[instrument(skip(self), level = "debug")]
- pub fn register(
+ pub(crate) fn register(
&mut self,
key: OpaqueTypeKey<'tcx>,
hidden_type: OpaqueHiddenType<'tcx>,