Skip to content

Commit e58805b

Browse files
committed
---
yaml --- r: 196217 b: refs/heads/tmp c: 2f7658a h: refs/heads/master i: 196215: 11ee5bf v: v3
1 parent 0039eb6 commit e58805b

File tree

6 files changed

+17
-10
lines changed

6 files changed

+17
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: 9854143cba679834bc4ef932858cd5303f015a0e
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: 60289ac7e704853049a441893f69a8eec5a00fa4
35+
refs/heads/tmp: 2f7658a52829b8208330401735c1b88638ed44c0
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: 53a183f0274316596bf9405944d4f0468d8c93e4
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/src/librustc/middle/astencode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
11971197
})
11981198
}
11991199

1200-
if let Some(ty) = tcx.node_types.borrow().get(&id) {
1200+
if let Some(ty) = tcx.node_types().get(&id) {
12011201
rbml_w.tag(c::tag_table_node_type, |rbml_w| {
12021202
rbml_w.id(id);
12031203
rbml_w.emit_ty(ecx, *ty);
@@ -1884,7 +1884,7 @@ fn decode_side_tables(dcx: &DecodeContext,
18841884
let ty = val_dsr.read_ty(dcx);
18851885
debug!("inserting ty for node {}: {}",
18861886
id, ty_to_string(dcx.tcx, ty));
1887-
dcx.tcx.node_types.borrow_mut().insert(id, ty);
1887+
dcx.tcx.node_type_insert(id, ty);
18881888
}
18891889
c::tag_table_item_subst => {
18901890
let item_substs = ty::ItemSubsts {

branches/tmp/src/librustc/middle/ty.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ use util::nodemap::FnvHashMap;
6868

6969
use arena::TypedArena;
7070
use std::borrow::{Borrow, Cow};
71-
use std::cell::{Cell, RefCell};
71+
use std::cell::{Cell, RefCell, Ref};
7272
use std::cmp;
7373
use std::fmt;
7474
use std::hash::{Hash, SipHasher, Hasher};
@@ -689,7 +689,7 @@ pub struct ctxt<'tcx> {
689689
/// Stores the types for various nodes in the AST. Note that this table
690690
/// is not guaranteed to be populated until after typeck. See
691691
/// typeck::check::fn_ctxt for details.
692-
pub node_types: RefCell<NodeMap<Ty<'tcx>>>,
692+
node_types: RefCell<NodeMap<Ty<'tcx>>>,
693693

694694
/// Stores the type parameters which were substituted to obtain the type
695695
/// of this node. This only applies to nodes that refer to entities
@@ -854,6 +854,13 @@ pub struct ctxt<'tcx> {
854854
pub const_qualif_map: RefCell<NodeMap<check_const::ConstQualif>>,
855855
}
856856

857+
impl<'tcx> ctxt<'tcx> {
858+
pub fn node_types(&self) -> Ref<NodeMap<Ty<'tcx>>> { self.node_types.borrow() }
859+
pub fn node_type_insert(&self, id: NodeId, ty: Ty<'tcx>) {
860+
self.node_types.borrow_mut().insert(id, ty);
861+
}
862+
}
863+
857864
// Flags that we track on types. These flags are propagated upwards
858865
// through the type during type construction, so that we can quickly
859866
// check whether the type has various kinds of types in it without

branches/tmp/src/librustc_trans/save/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
272272
let typ =
273273
ppaux::ty_to_string(
274274
&self.analysis.ty_cx,
275-
*self.analysis.ty_cx.node_types.borrow().get(&id).unwrap());
275+
*self.analysis.ty_cx.node_types().get(&id).unwrap());
276276
// get the span only for the name of the variable (I hope the path is only ever a
277277
// variable name, but who knows?)
278278
self.fmt.formal_str(p.span,
@@ -436,7 +436,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
436436
let typ =
437437
ppaux::ty_to_string(
438438
&self.analysis.ty_cx,
439-
*self.analysis.ty_cx.node_types.borrow().get(&field.node.id).unwrap());
439+
*self.analysis.ty_cx.node_types().get(&field.node.id).unwrap());
440440
match self.span.sub_span_before_token(field.span, token::Colon) {
441441
Some(sub_span) => self.fmt.field_str(field.span,
442442
Some(sub_span),
@@ -1471,7 +1471,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
14711471

14721472
for &(id, ref p, ref immut, _) in &self.collected_paths {
14731473
let value = if *immut { value.to_string() } else { "<mutable>".to_string() };
1474-
let types = self.analysis.ty_cx.node_types.borrow();
1474+
let types = self.analysis.ty_cx.node_types();
14751475
let typ = ppaux::ty_to_string(&self.analysis.ty_cx, *types.get(&id).unwrap());
14761476
// Get the span only for the name of the variable (I hope the path
14771477
// is only ever a variable name, but who knows?).

branches/tmp/src/librustc_trans/trans/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3207,7 +3207,7 @@ fn fn_should_be_ignored(fcx: &FunctionContext) -> bool {
32073207
fn assert_type_for_node_id(cx: &CrateContext,
32083208
node_id: ast::NodeId,
32093209
error_reporting_span: Span) {
3210-
if !cx.tcx().node_types.borrow().contains_key(&node_id) {
3210+
if !cx.tcx().node_types().contains_key(&node_id) {
32113211
cx.sess().span_bug(error_reporting_span,
32123212
"debuginfo: Could not find type for node id!");
32133213
}

branches/tmp/src/librustc_typeck/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ pub struct CrateCtxt<'a, 'tcx: 'a> {
146146
fn write_ty_to_tcx<'tcx>(tcx: &ty::ctxt<'tcx>, node_id: ast::NodeId, ty: Ty<'tcx>) {
147147
debug!("write_ty_to_tcx({}, {})", node_id, ppaux::ty_to_string(tcx, ty));
148148
assert!(!ty::type_needs_infer(ty));
149-
tcx.node_types.borrow_mut().insert(node_id, ty);
149+
tcx.node_type_insert(node_id, ty);
150150
}
151151

152152
fn write_substs_to_tcx<'tcx>(tcx: &ty::ctxt<'tcx>,

0 commit comments

Comments
 (0)