remove ast_ty_to_ty_cache
entirely
This commit is contained in:
parent
3039398c68
commit
3f2dd4d24a
@ -556,9 +556,6 @@ pub struct GlobalCtxt<'tcx> {
|
||||
/// error reporting, and so is lazily initialised and generally
|
||||
/// shouldn't taint the common path (hence the RefCell).
|
||||
pub all_traits: RefCell<Option<Vec<DefId>>>,
|
||||
|
||||
/// HIR Ty -> Ty lowering cache.
|
||||
pub ast_ty_to_ty_cache: RefCell<NodeMap<Ty<'tcx>>>,
|
||||
}
|
||||
|
||||
impl<'tcx> GlobalCtxt<'tcx> {
|
||||
@ -770,7 +767,6 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
|
||||
derive_macros: RefCell::new(NodeMap()),
|
||||
stability_interner: RefCell::new(FxHashSet()),
|
||||
all_traits: RefCell::new(None),
|
||||
ast_ty_to_ty_cache: RefCell::new(NodeMap()),
|
||||
}, f)
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,8 @@
|
||||
use rustc_back::slice;
|
||||
use require_c_abi_if_variadic;
|
||||
use util::common::{ErrorReported, FN_OUTPUT_NAME};
|
||||
use util::nodemap::{NodeMap, FxHashSet};
|
||||
use util::nodemap::FxHashSet;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::iter;
|
||||
use syntax::{abi, ast};
|
||||
use syntax::feature_gate::{GateIssue, emit_feature_err};
|
||||
@ -37,9 +36,6 @@
|
||||
pub trait AstConv<'gcx, 'tcx> {
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'a, 'gcx, 'tcx>;
|
||||
|
||||
/// A cache used for the result of `ast_ty_to_ty_cache`
|
||||
fn ast_ty_to_ty_cache(&self) -> &RefCell<NodeMap<Ty<'tcx>>>;
|
||||
|
||||
/// Returns the set of bounds in scope for the type parameter with
|
||||
/// the given id.
|
||||
fn get_type_parameter_bounds(&self, span: Span, def_id: DefId)
|
||||
@ -1074,11 +1070,6 @@ pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> {
|
||||
|
||||
let tcx = self.tcx();
|
||||
|
||||
let cache = self.ast_ty_to_ty_cache();
|
||||
if let Some(ty) = cache.borrow().get(&ast_ty.id) {
|
||||
return ty;
|
||||
}
|
||||
|
||||
let result_ty = match ast_ty.node {
|
||||
hir::TySlice(ref ty) => {
|
||||
tcx.mk_slice(self.ast_ty_to_ty(&ty))
|
||||
@ -1240,8 +1231,6 @@ pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> {
|
||||
}
|
||||
};
|
||||
|
||||
cache.borrow_mut().insert(ast_ty.id, result_ty);
|
||||
|
||||
result_ty
|
||||
}
|
||||
|
||||
|
@ -451,8 +451,6 @@ fn find_breakable(&mut self, target_id: ast::NodeId) -> &mut BreakableCtxt<'gcx,
|
||||
}
|
||||
|
||||
pub struct FnCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
|
||||
ast_ty_to_ty_cache: RefCell<NodeMap<Ty<'tcx>>>,
|
||||
|
||||
body_id: ast::NodeId,
|
||||
|
||||
// Number of errors that had been reported when we started
|
||||
@ -1516,10 +1514,6 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
impl<'a, 'gcx, 'tcx> AstConv<'gcx, 'tcx> for FnCtxt<'a, 'gcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.tcx }
|
||||
|
||||
fn ast_ty_to_ty_cache(&self) -> &RefCell<NodeMap<Ty<'tcx>>> {
|
||||
&self.ast_ty_to_ty_cache
|
||||
}
|
||||
|
||||
fn get_free_substs(&self) -> Option<&Substs<'tcx>> {
|
||||
Some(&self.parameter_environment.free_substs)
|
||||
}
|
||||
@ -1621,7 +1615,6 @@ pub fn new(inh: &'a Inherited<'a, 'gcx, 'tcx>,
|
||||
body_id: ast::NodeId)
|
||||
-> FnCtxt<'a, 'gcx, 'tcx> {
|
||||
FnCtxt {
|
||||
ast_ty_to_ty_cache: RefCell::new(NodeMap()),
|
||||
body_id: body_id,
|
||||
err_count_on_creation: inh.tcx.sess.err_count(),
|
||||
ret_coercion: None,
|
||||
|
@ -43,7 +43,6 @@ pub fn resolve_type_vars_in_body(&self, body: &'gcx hir::Body)
|
||||
wbcx.visit_liberated_fn_sigs();
|
||||
wbcx.visit_fru_field_types();
|
||||
wbcx.visit_anon_types();
|
||||
wbcx.visit_type_nodes();
|
||||
wbcx.visit_cast_types();
|
||||
wbcx.visit_lints();
|
||||
wbcx.visit_free_region_map();
|
||||
@ -442,13 +441,6 @@ fn visit_fru_field_types(&mut self) {
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_type_nodes(&self) {
|
||||
for (&id, ty) in self.fcx.ast_ty_to_ty_cache.borrow().iter() {
|
||||
let ty = self.resolve(ty, &id);
|
||||
self.fcx.tcx.ast_ty_to_ty_cache.borrow_mut().insert(id, ty);
|
||||
}
|
||||
}
|
||||
|
||||
fn resolve<T>(&self, x: &T, span: &Locatable) -> T::Lifted
|
||||
where T: TypeFoldable<'tcx> + ty::Lift<'gcx>
|
||||
{
|
||||
|
@ -64,11 +64,10 @@
|
||||
use rustc::ty::{self, AdtKind, ToPolyTraitRef, Ty, TyCtxt};
|
||||
use rustc::ty::maps::Providers;
|
||||
use rustc::ty::util::IntTypeExt;
|
||||
use util::nodemap::{NodeMap, FxHashMap};
|
||||
use util::nodemap::FxHashMap;
|
||||
|
||||
use rustc_const_math::ConstInt;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use syntax::{abi, ast};
|
||||
@ -198,10 +197,6 @@ pub fn to_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> {
|
||||
impl<'a, 'tcx> AstConv<'tcx, 'tcx> for ItemCtxt<'a, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'tcx, 'tcx> { self.tcx }
|
||||
|
||||
fn ast_ty_to_ty_cache(&self) -> &RefCell<NodeMap<Ty<'tcx>>> {
|
||||
&self.tcx.ast_ty_to_ty_cache
|
||||
}
|
||||
|
||||
fn get_type_parameter_bounds(&self,
|
||||
span: Span,
|
||||
def_id: DefId)
|
||||
|
Loading…
Reference in New Issue
Block a user