Skip to content

Commit 061ff7e

Browse files
committed
---
yaml --- r: 149922 b: refs/heads/try2 c: 20b4e15 h: refs/heads/master v: v3
1 parent a26d1fb commit 061ff7e

34 files changed

+872
-922
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: cdc18b96d6aa38c22b4fa9715c974ef986ad250d
8+
refs/heads/try2: 20b4e159edb54cecb8abdedb187ba05a869b3bf0
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libnum/complex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<T: Clone + Float> Cmplx<T> {
101101
/// Convert a polar representation into a complex number.
102102
#[inline]
103103
pub fn from_polar(r: &T, theta: &T) -> Cmplx<T> {
104-
Cmplx::new(r * theta.cos(), r * theta.sin())
104+
Cmplx::new(*r * theta.cos(), *r * theta.sin())
105105
}
106106
}
107107

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use metadata::tydecode;
2121
use metadata::tydecode::{DefIdSource, NominalType, TypeWithId, TypeParameter,
2222
RegionParameter};
2323
use metadata::tyencode;
24-
use middle::typeck::{MethodCallee, MethodOrigin};
24+
use middle::typeck::{MethodCall, MethodCallee, MethodOrigin};
2525
use middle::{ty, typeck, moves};
2626
use middle;
2727
use util::ppaux::ty_to_str;
@@ -1039,7 +1039,8 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
10391039
}
10401040
}
10411041

1042-
for &method in maps.method_map.borrow().get().find(&id).iter() {
1042+
let method_call = MethodCall::expr(id);
1043+
for &method in maps.method_map.borrow().get().find(&method_call).iter() {
10431044
ebml_w.tag(c::tag_table_method_map, |ebml_w| {
10441045
ebml_w.id(id);
10451046
ebml_w.tag(c::tag_table_val, |ebml_w| {
@@ -1385,7 +1386,8 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
13851386
}
13861387
c::tag_table_method_map => {
13871388
let method = val_dsr.read_method_callee(xcx);
1388-
dcx.maps.method_map.borrow_mut().get().insert(id, method);
1389+
let method_call = MethodCall::expr(id);
1390+
dcx.maps.method_map.borrow_mut().get().insert(method_call, method);
13891391
}
13901392
c::tag_table_vtable_map => {
13911393
let vtable_res =

branches/try2/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use mc = middle::mem_categorization;
2222
use middle::borrowck::*;
2323
use middle::moves;
2424
use middle::ty;
25+
use middle::typeck::MethodCall;
2526
use std::vec_ng::Vec;
2627
use syntax::ast;
2728
use syntax::ast_util;
@@ -838,11 +839,11 @@ fn check_loans_in_expr<'a>(this: &mut CheckLoanCtxt<'a>,
838839
this.check_call(expr, None, expr.span, args.as_slice());
839840
}
840841
ast::ExprIndex(_, rval) | ast::ExprBinary(_, _, rval)
841-
if method_map.get().contains_key(&expr.id) => {
842+
if method_map.get().contains_key(&MethodCall::expr(expr.id)) => {
842843
this.check_call(expr, None, expr.span, [rval]);
843844
}
844845
ast::ExprUnary(_, _) | ast::ExprIndex(_, _)
845-
if method_map.get().contains_key(&expr.id) => {
846+
if method_map.get().contains_key(&MethodCall::expr(expr.id)) => {
846847
this.check_call(expr, None, expr.span, []);
847848
}
848849
ast::ExprInlineAsm(ref ia) => {

branches/try2/src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use middle::moves;
2323
use middle::pat_util;
2424
use middle::ty::{ty_region};
2525
use middle::ty;
26+
use middle::typeck::MethodCall;
2627
use util::common::indenter;
2728
use util::ppaux::{Repr};
2829

@@ -242,7 +243,7 @@ fn gather_loans_in_expr(this: &mut GatherLoanCtxt,
242243

243244
ast::ExprIndex(_, arg) |
244245
ast::ExprBinary(_, _, arg)
245-
if method_map.get().contains_key(&ex.id) => {
246+
if method_map.get().contains_key(&MethodCall::expr(ex.id)) => {
246247
// Arguments in method calls are always passed by ref.
247248
//
248249
// Currently these do not use adjustments, so we have to

branches/try2/src/librustc/middle/borrowck/mod.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,8 @@ impl BorrowckCtxt {
556556
move_data::MoveExpr => {
557557
let (expr_ty, expr_span) = match self.tcx.map.find(move.id) {
558558
Some(ast_map::NodeExpr(expr)) => {
559-
(ty::expr_ty_adjusted(self.tcx, expr), expr.span)
559+
(ty::expr_ty_adjusted(self.tcx, expr,
560+
self.method_map.borrow().get()), expr.span)
560561
}
561562
r => self.tcx.sess.bug(format!("MoveExpr({:?}) maps to {:?}, not Expr",
562563
move.id, r))
@@ -582,7 +583,8 @@ impl BorrowckCtxt {
582583
move_data::Captured => {
583584
let (expr_ty, expr_span) = match self.tcx.map.find(move.id) {
584585
Some(ast_map::NodeExpr(expr)) => {
585-
(ty::expr_ty_adjusted(self.tcx, expr), expr.span)
586+
(ty::expr_ty_adjusted(self.tcx, expr,
587+
self.method_map.borrow().get()), expr.span)
586588
}
587589
r => self.tcx.sess.bug(format!("Captured({:?}) maps to {:?}, not Expr",
588590
move.id, r))
@@ -922,8 +924,8 @@ impl mc::Typer for TcxTyper {
922924
Ok(ty::node_id_to_type(self.tcx, id))
923925
}
924926

925-
fn node_method_ty(&mut self, id: ast::NodeId) -> Option<ty::t> {
926-
self.method_map.borrow().get().find(&id).map(|method| method.ty)
927+
fn node_method_ty(&mut self, method_call: typeck::MethodCall) -> Option<ty::t> {
928+
self.method_map.borrow().get().find(&method_call).map(|method| method.ty)
927929
}
928930

929931
fn adjustment(&mut self, id: ast::NodeId) -> Option<@ty::AutoAdjustment> {
@@ -932,7 +934,7 @@ impl mc::Typer for TcxTyper {
932934
}
933935

934936
fn is_method_call(&mut self, id: ast::NodeId) -> bool {
935-
self.method_map.borrow().get().contains_key(&id)
937+
self.method_map.borrow().get().contains_key(&typeck::MethodCall::expr(id))
936938
}
937939

938940
fn temporary_scope(&mut self, id: ast::NodeId) -> Option<ast::NodeId> {

branches/try2/src/librustc/middle/cfg/construct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ impl CFGBuilder {
523523
}
524524

525525
fn is_method_call(&self, expr: &ast::Expr) -> bool {
526-
let method_map = self.method_map.borrow();
527-
method_map.get().contains_key(&expr.id)
526+
let method_call = typeck::MethodCall::expr(expr.id);
527+
self.method_map.borrow().get().contains_key(&method_call)
528528
}
529529
}

branches/try2/src/librustc/middle/check_const.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ pub fn check_expr(v: &mut CheckCrateVisitor,
117117
}
118118
ExprLit(lit) if ast_util::lit_is_str(lit) => {}
119119
ExprBinary(..) | ExprUnary(..) => {
120-
let method_map = method_map.borrow();
121-
if method_map.get().contains_key(&e.id) {
120+
let method_call = typeck::MethodCall::expr(e.id);
121+
if method_map.borrow().get().contains_key(&method_call) {
122122
sess.span_err(e.span, "user-defined operators are not \
123123
allowed in constant expressions");
124124
}

branches/try2/src/librustc/middle/const_eval.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use middle::astencode;
1616
use middle::ty;
1717
use middle::typeck::astconv;
1818
use middle;
19-
use util::nodemap::{DefIdMap, NodeMap};
19+
use util::nodemap::{DefIdMap, FnvHashMap, NodeMap};
2020

2121
use syntax::ast::*;
2222
use syntax::parse::token::InternedString;
@@ -136,7 +136,7 @@ pub fn lookup_variant_by_id(tcx: ty::ctxt,
136136
}
137137
let maps = astencode::Maps {
138138
root_map: @RefCell::new(HashMap::new()),
139-
method_map: @RefCell::new(NodeMap::new()),
139+
method_map: @RefCell::new(FnvHashMap::new()),
140140
vtable_map: @RefCell::new(NodeMap::new()),
141141
capture_map: @RefCell::new(NodeMap::new())
142142
};
@@ -186,7 +186,7 @@ pub fn lookup_const_by_id(tcx: ty::ctxt, def_id: ast::DefId)
186186
}
187187
let maps = astencode::Maps {
188188
root_map: @RefCell::new(HashMap::new()),
189-
method_map: @RefCell::new(NodeMap::new()),
189+
method_map: @RefCell::new(FnvHashMap::new()),
190190
vtable_map: @RefCell::new(NodeMap::new()),
191191
capture_map: @RefCell::new(NodeMap::new())
192192
};

branches/try2/src/librustc/middle/dataflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,8 +810,8 @@ impl<'a, O:DataFlowOperator> PropagationContext<'a, O> {
810810
}
811811

812812
fn is_method_call(&self, expr: &ast::Expr) -> bool {
813-
let method_map = self.dfcx.method_map.borrow();
814-
method_map.get().contains_key(&expr.id)
813+
let method_call = typeck::MethodCall::expr(expr.id);
814+
self.dfcx.method_map.borrow().get().contains_key(&method_call)
815815
}
816816

817817
fn reset(&mut self, bits: &mut [uint]) {

branches/try2/src/librustc/middle/dead.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ impl MarkSymbolVisitor {
9292
}
9393
}
9494

95-
fn lookup_and_handle_method(&mut self, id: &ast::NodeId,
95+
fn lookup_and_handle_method(&mut self, id: ast::NodeId,
9696
span: codemap::Span) {
97-
match self.method_map.borrow().get().find(id) {
97+
let method_call = typeck::MethodCall::expr(id);
98+
match self.method_map.borrow().get().find(&method_call) {
9899
Some(method) => {
99100
match method.origin {
100101
typeck::MethodStatic(def_id) => {
@@ -179,7 +180,7 @@ impl Visitor<()> for MarkSymbolVisitor {
179180
fn visit_expr(&mut self, expr: &ast::Expr, _: ()) {
180181
match expr.node {
181182
ast::ExprMethodCall(..) => {
182-
self.lookup_and_handle_method(&expr.id, expr.span);
183+
self.lookup_and_handle_method(expr.id, expr.span);
183184
}
184185
_ => ()
185186
}

branches/try2/src/librustc/middle/effect.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/// `unsafe`.
1313
1414
use middle::ty;
15-
use middle::typeck::MethodMap;
15+
use middle::typeck::{MethodCall, MethodMap};
1616
use util::ppaux;
1717

1818
use syntax::ast;
@@ -138,7 +138,8 @@ impl Visitor<()> for EffectCheckVisitor {
138138
fn visit_expr(&mut self, expr: &ast::Expr, _:()) {
139139
match expr.node {
140140
ast::ExprMethodCall(_, _, _) => {
141-
let base_type = self.method_map.borrow().get().get(&expr.id).ty;
141+
let method_call = MethodCall::expr(expr.id);
142+
let base_type = self.method_map.borrow().get().get(&method_call).ty;
142143
debug!("effect: method call case, base type is {}",
143144
ppaux::ty_to_str(self.tcx, base_type));
144145
if type_is_unsafe_function(base_type) {

branches/try2/src/librustc/middle/kind.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ pub fn check_expr(cx: &mut Context, e: &Expr) {
267267
// Handle any kind bounds on type parameters
268268
{
269269
let method_map = cx.method_map.borrow();
270-
let method = method_map.get().find(&e.id);
270+
let method = method_map.get().find(&typeck::MethodCall::expr(e.id));
271271
let node_type_substs = cx.tcx.node_type_substs.borrow();
272272
let r = match method {
273273
Some(method) => Some(&method.substs.tps),
@@ -341,7 +341,8 @@ pub fn check_expr(cx: &mut Context, e: &Expr) {
341341
match **adjustment {
342342
ty::AutoObject(..) => {
343343
let source_ty = ty::expr_ty(cx.tcx, e);
344-
let target_ty = ty::expr_ty_adjusted(cx.tcx, e);
344+
let target_ty = ty::expr_ty_adjusted(cx.tcx, e,
345+
cx.method_map.borrow().get());
345346
check_trait_cast(cx, source_ty, target_ty, e.span);
346347
}
347348
ty::AutoAddEnv(..) |

branches/try2/src/librustc/middle/lint.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,8 @@ fn check_stability(cx: &Context, e: &ast::Expr) {
14911491
}
14921492
}
14931493
ast::ExprMethodCall(..) => {
1494-
match cx.method_map.borrow().get().find(&e.id) {
1494+
let method_call = typeck::MethodCall::expr(e.id);
1495+
match cx.method_map.borrow().get().find(&method_call) {
14951496
Some(method) => {
14961497
match method.origin {
14971498
typeck::MethodStatic(def_id) => {

0 commit comments

Comments
 (0)