Remove ObjectCastMap
This commit is contained in:
parent
f4ee40ead2
commit
0ec3183df8
7 changed files with 7 additions and 53 deletions
|
|
@ -146,7 +146,7 @@ enum_from_u32! {
|
|||
tag_table_closure_kinds = 0x65,
|
||||
tag_table_upvar_capture_map = 0x66,
|
||||
tag_table_capture_modes = 0x67,
|
||||
tag_table_object_cast_map = 0x68,
|
||||
// GAP 0x68
|
||||
tag_table_const_qualif = 0x69,
|
||||
tag_table_cast_kinds = 0x6a,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1117,13 +1117,6 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
|
|||
})
|
||||
}
|
||||
|
||||
if let Some(trait_ref) = tcx.object_cast_map.borrow().get(&id) {
|
||||
rbml_w.tag(c::tag_table_object_cast_map, |rbml_w| {
|
||||
rbml_w.id(id);
|
||||
rbml_w.emit_trait_ref(ecx, &trait_ref.0);
|
||||
})
|
||||
}
|
||||
|
||||
if let Some(adjustment) = tcx.adjustments.borrow().get(&id) {
|
||||
match *adjustment {
|
||||
ty::AdjustDerefRef(ref adj) => {
|
||||
|
|
@ -1708,11 +1701,6 @@ fn decode_side_tables(dcx: &DecodeContext,
|
|||
};
|
||||
dcx.tcx.method_map.borrow_mut().insert(method_call, method);
|
||||
}
|
||||
c::tag_table_object_cast_map => {
|
||||
let trait_ref = val_dsr.read_poly_trait_ref(dcx);
|
||||
dcx.tcx.object_cast_map.borrow_mut()
|
||||
.insert(id, trait_ref);
|
||||
}
|
||||
c::tag_table_adjustments => {
|
||||
let adj: ty::AutoAdjustment = val_dsr.read_auto_adjustment(dcx);
|
||||
dcx.tcx.adjustments.borrow_mut().insert(id, adj);
|
||||
|
|
|
|||
|
|
@ -503,10 +503,6 @@ impl MethodCall {
|
|||
// of the method to be invoked
|
||||
pub type MethodMap<'tcx> = RefCell<FnvHashMap<MethodCall, MethodCallee<'tcx>>>;
|
||||
|
||||
// For every explicit cast into an object type, maps from the cast
|
||||
// expr to the associated trait ref.
|
||||
pub type ObjectCastMap<'tcx> = RefCell<NodeMap<ty::PolyTraitRef<'tcx>>>;
|
||||
|
||||
// Contains information needed to resolve types and (in the future) look up
|
||||
// the types of AST nodes.
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||
|
|
@ -557,8 +553,7 @@ pub struct CtxtArenas<'tcx> {
|
|||
stability: TypedArena<attr::Stability>,
|
||||
|
||||
// references
|
||||
trait_defs: TypedArena<TraitDef<'tcx>>
|
||||
|
||||
trait_defs: TypedArena<TraitDef<'tcx>>,
|
||||
}
|
||||
|
||||
impl<'tcx> CtxtArenas<'tcx> {
|
||||
|
|
@ -612,7 +607,6 @@ pub struct ctxt<'tcx> {
|
|||
region_interner: RefCell<FnvHashMap<&'tcx Region, &'tcx Region>>,
|
||||
stability_interner: RefCell<FnvHashMap<&'tcx attr::Stability, &'tcx attr::Stability>>,
|
||||
|
||||
|
||||
/// Common types, pre-interned for your convenience.
|
||||
pub types: CommonTypes<'tcx>,
|
||||
|
||||
|
|
@ -665,10 +659,6 @@ pub struct ctxt<'tcx> {
|
|||
/// additional acyclicity requirements).
|
||||
pub super_predicates: RefCell<DefIdMap<GenericPredicates<'tcx>>>,
|
||||
|
||||
/// Maps from node-id of a trait object cast (like `foo as
|
||||
/// Box<Trait>`) to the trait reference.
|
||||
pub object_cast_map: ObjectCastMap<'tcx>,
|
||||
|
||||
pub map: ast_map::Map<'tcx>,
|
||||
pub freevars: RefCell<FreevarMap>,
|
||||
pub tcache: RefCell<DefIdMap<TypeScheme<'tcx>>>,
|
||||
|
|
@ -2742,7 +2732,6 @@ pub fn mk_ctxt<'tcx>(s: Session,
|
|||
trait_defs: RefCell::new(DefIdMap()),
|
||||
predicates: RefCell::new(DefIdMap()),
|
||||
super_predicates: RefCell::new(DefIdMap()),
|
||||
object_cast_map: RefCell::new(NodeMap()),
|
||||
map: map,
|
||||
freevars: freevars,
|
||||
tcache: RefCell::new(DefIdMap()),
|
||||
|
|
|
|||
|
|
@ -1796,7 +1796,8 @@ declare_lint! {
|
|||
pub struct Stability;
|
||||
|
||||
impl Stability {
|
||||
fn lint(&self, cx: &Context, _id: ast::DefId, span: Span, stability: &Option<&attr::Stability>) {
|
||||
fn lint(&self, cx: &Context, _id: ast::DefId,
|
||||
span: Span, stability: &Option<&attr::Stability>) {
|
||||
// Deprecated attributes apply in-crate and cross-crate.
|
||||
let (lint, label) = match *stability {
|
||||
Some(&attr::Stability { deprecated_since: Some(_), .. }) =>
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ use middle::ty::{FnSig, GenericPredicates, TypeScheme};
|
|||
use middle::ty::{Disr, ParamTy, ParameterEnvironment};
|
||||
use middle::ty::{self, HasProjectionTypes, RegionEscape, ToPolyTraitRef, Ty};
|
||||
use middle::ty::liberate_late_bound_regions;
|
||||
use middle::ty::{MethodCall, MethodCallee, MethodMap, ObjectCastMap};
|
||||
use middle::ty::{MethodCall, MethodCallee, MethodMap};
|
||||
use middle::ty_fold::{TypeFolder, TypeFoldable};
|
||||
use rscope::RegionScope;
|
||||
use session::Session;
|
||||
|
|
@ -164,7 +164,6 @@ pub struct Inherited<'a, 'tcx: 'a> {
|
|||
upvar_capture_map: RefCell<ty::UpvarCaptureMap>,
|
||||
closure_tys: RefCell<DefIdMap<ty::ClosureTy<'tcx>>>,
|
||||
closure_kinds: RefCell<DefIdMap<ty::ClosureKind>>,
|
||||
object_cast_map: ObjectCastMap<'tcx>,
|
||||
|
||||
// A mapping from each fn's id to its signature, with all bound
|
||||
// regions replaced with free ones. Unlike the other tables, this
|
||||
|
|
@ -383,7 +382,6 @@ impl<'a, 'tcx> Inherited<'a, 'tcx> {
|
|||
item_substs: RefCell::new(NodeMap()),
|
||||
adjustments: RefCell::new(NodeMap()),
|
||||
method_map: RefCell::new(FnvHashMap()),
|
||||
object_cast_map: RefCell::new(NodeMap()),
|
||||
upvar_capture_map: RefCell::new(FnvHashMap()),
|
||||
closure_tys: RefCell::new(DefIdMap()),
|
||||
closure_kinds: RefCell::new(DefIdMap()),
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ pub fn resolve_type_vars_in_expr(fcx: &FnCtxt, e: &ast::Expr) {
|
|||
wbcx.visit_expr(e);
|
||||
wbcx.visit_upvar_borrow_map();
|
||||
wbcx.visit_closures();
|
||||
wbcx.visit_object_cast_map();
|
||||
}
|
||||
|
||||
pub fn resolve_type_vars_in_fn(fcx: &FnCtxt,
|
||||
|
|
@ -62,7 +61,6 @@ pub fn resolve_type_vars_in_fn(fcx: &FnCtxt,
|
|||
}
|
||||
wbcx.visit_upvar_borrow_map();
|
||||
wbcx.visit_closures();
|
||||
wbcx.visit_object_cast_map();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -239,27 +237,6 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn visit_object_cast_map(&self) {
|
||||
if self.fcx.writeback_errors.get() {
|
||||
return
|
||||
}
|
||||
|
||||
for (&node_id, trait_ref) in self.fcx
|
||||
.inh
|
||||
.object_cast_map
|
||||
.borrow()
|
||||
.iter()
|
||||
{
|
||||
let span = ty::expr_span(self.tcx(), node_id);
|
||||
let reason = ResolvingExpr(span);
|
||||
let closure_ty = self.resolve(trait_ref, reason);
|
||||
self.tcx()
|
||||
.object_cast_map
|
||||
.borrow_mut()
|
||||
.insert(node_id, closure_ty);
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_node_id(&self, reason: ResolveReason, id: ast::NodeId) {
|
||||
// Resolve any borrowings for the node with id `id`
|
||||
self.visit_adjustments(reason, id);
|
||||
|
|
|
|||
|
|
@ -286,7 +286,8 @@ impl<'a, 'tcx> CoherenceChecker<'a, 'tcx> {
|
|||
}
|
||||
_ => {
|
||||
self.crate_context.tcx.sess.span_bug(item.span,
|
||||
"can't convert a non-impl to an impl");
|
||||
"can't convert a non-impl \
|
||||
to an impl");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue