Skip to content

Commit 9b4ccca

Browse files
committed
---
yaml --- r: 51678 b: refs/heads/incoming c: f792d17 h: refs/heads/master v: v3
1 parent 9387c59 commit 9b4ccca

File tree

16 files changed

+171
-147
lines changed

16 files changed

+171
-147
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 8eb2bab100b42f0ba751552d8eff00eb2134c55a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 6f2783d5151cb8e9ee3aa9ab591b65847042cf1b
9+
refs/heads/incoming: f792d177a493aa3ced268ed4d6815baef5ab8d29
1010
refs/heads/dist-snap: 8b98e5a296d95c5e832db0756828e5bec31c6f50
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libcore/gc.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#[doc(hidden)];
12+
1113
/*! Precise garbage collector
1214
1315
The precise GC exposes two functions, gc and

branches/incoming/src/libcore/unstable/lang.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,8 @@ pub unsafe fn borrow_as_imm(a: *u8) {
9999
#[lang="return_to_mut"]
100100
#[inline(always)]
101101
pub unsafe fn return_to_mut(a: *u8) {
102-
// Sometimes the box is null, if it is conditionally frozen.
103-
// See e.g. #4904.
104-
if !a.is_null() {
105-
let a: *mut BoxRepr = transmute(a);
106-
(*a).header.ref_count &= !FROZEN_BIT;
107-
}
102+
let a: *mut BoxRepr = transmute(a);
103+
(*a).header.ref_count &= !FROZEN_BIT;
108104
}
109105

110106
#[lang="check_not_borrowed"]

branches/incoming/src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,15 +1579,7 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
15791579
id: ast::node_id,
15801580
impl_id: Option<ast::def_id>,
15811581
param_substs: Option<@param_substs>,
1582-
sp: Option<span>) -> fn_ctxt
1583-
{
1584-
debug!("new_fn_ctxt_w_id(path=%s, id=%?, impl_id=%?, \
1585-
param_substs=%s",
1586-
path_str(ccx.sess, path),
1587-
id,
1588-
impl_id,
1589-
opt_param_substs_to_str(ccx.tcx, &param_substs));
1590-
1582+
sp: Option<span>) -> fn_ctxt {
15911583
let llbbs = mk_standard_basic_blocks(llfndecl);
15921584
return @mut fn_ctxt_ {
15931585
llfn: llfndecl,

branches/incoming/src/librustc/middle/trans/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ pub fn trans_fn_ref_with_vtables(
217217
// - `type_params`: values for each of the fn/method's type parameters
218218
// - `vtables`: values for each bound on each of the type parameters
219219

220-
let _icx = bcx.insn_ctxt("trans_fn_ref_with_vtables");
220+
let _icx = bcx.insn_ctxt("trans_fn_with_vtables");
221221
let ccx = bcx.ccx();
222222
let tcx = ccx.tcx;
223223

branches/incoming/src/librustc/middle/trans/common.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,6 @@ pub fn param_substs_to_str(tcx: ty::ctxt, substs: &param_substs) -> ~str {
257257
substs.bounds.map(|b| ty::param_bounds_to_str(tcx, *b)))
258258
}
259259

260-
pub fn opt_param_substs_to_str(tcx: ty::ctxt,
261-
substs: &Option<@param_substs>) -> ~str {
262-
substs.map_default(~"None", |&ps| param_substs_to_str(tcx, ps))
263-
}
264-
265260
// Function context. Every LLVM function we create will have one of
266261
// these.
267262
pub struct fn_ctxt_ {
@@ -1428,7 +1423,7 @@ pub fn resolve_vtable_in_fn_ctxt(fcx: fn_ctxt, +vt: typeck::vtable_origin)
14281423
}
14291424
14301425
pub fn find_vtable(tcx: ty::ctxt, ps: &param_substs,
1431-
n_param: uint, n_bound: uint)
1426+
n_param: uint, n_bound: uint)
14321427
-> typeck::vtable_origin {
14331428
debug!("find_vtable_in_fn_ctxt(n_param=%u, n_bound=%u, ps=%?)",
14341429
n_param, n_bound, param_substs_to_str(tcx, ps));

branches/incoming/src/librustc/middle/trans/meth.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,6 @@ pub fn trans_method_callee(bcx: block,
175175
-> Callee {
176176
let _icx = bcx.insn_ctxt("impl::trans_method_callee");
177177
178-
debug!("trans_method_callee(callee_id=%?, self=%s, mentry=%?)",
179-
callee_id, bcx.expr_to_str(self), mentry);
180-
181178
// Replace method_self with method_static here.
182179
let mut origin = mentry.origin;
183180
match origin {
@@ -221,8 +218,6 @@ pub fn trans_method_callee(bcx: block,
221218
typeck::method_trait(*) => {}
222219
}
223220
224-
debug!("origin=%?", origin);
225-
226221
match origin {
227222
typeck::method_static(did) => {
228223
let callee_fn = callee::trans_fn_ref(bcx, did, callee_id);

branches/incoming/src/librustc/middle/trans/monomorphize.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,9 @@ pub fn monomorphic_fn(ccx: @CrateContext,
6767
must_cast = true;
6868
}
6969

70-
debug!("monomorphic_fn(fn_id=%? (%s), vtables=%?, \
71-
real_substs=%?, substs=%?, \
72-
hash_id = %?",
70+
debug!("monomorphic_fn(fn_id=%? (%s), real_substs=%?, substs=%?, \
71+
hash_id = %?",
7372
fn_id, ty::item_path_str(ccx.tcx, fn_id),
74-
vtables,
7573
real_substs.map(|s| ty_to_str(ccx.tcx, *s)),
7674
substs.map(|s| ty_to_str(ccx.tcx, *s)), hash_id);
7775

branches/incoming/src/librustc/middle/typeck/check/mod.rs

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,13 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
13211321
sugar: ast::CallSugar) {
13221322
// Index expressions need to be handled separately, to inform them
13231323
// that they appear in call position.
1324-
let mut bot = check_expr(fcx, f);
1324+
match f.node {
1325+
ast::expr_field(ref base, ref field, ref tys) => {
1326+
check_field(fcx, f, true, *base, *field, *tys)
1327+
}
1328+
_ => check_expr(fcx, f)
1329+
};
1330+
13251331
check_call_or_method(fcx,
13261332
sp,
13271333
call_expr_id,
@@ -1683,6 +1689,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
16831689
// Check field access expressions
16841690
fn check_field(fcx: @mut FnCtxt,
16851691
expr: @ast::expr,
1692+
is_callee: bool,
16861693
base: @ast::expr,
16871694
field: ast::ident,
16881695
tys: &[@ast::Ty]) {
@@ -1716,6 +1723,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
17161723
}
17171724

17181725
let tps = vec::map(tys, |ty| fcx.to_ty(*ty));
1726+
17191727
match method::lookup(fcx,
17201728
expr,
17211729
base,
@@ -1726,30 +1734,34 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
17261734
DontDerefArgs,
17271735
CheckTraitsAndInherentMethods,
17281736
AutoderefReceiver) {
1729-
Some(_) => {
1730-
fcx.type_error_message(
1731-
expr.span,
1732-
|actual| {
1733-
fmt!("attempted to take value of method `%s` on type `%s` \
1734-
(try writing an anonymous function)",
1735-
*tcx.sess.str_of(field), actual)
1736-
},
1737-
expr_t, None);
1738-
}
1737+
Some(ref entry) => {
1738+
let method_map = fcx.ccx.method_map;
1739+
method_map.insert(expr.id, (*entry));
17391740

1741+
// If we have resolved to a method but this is not in
1742+
// a callee position, error
1743+
if !is_callee {
1744+
tcx.sess.span_err(
1745+
expr.span,
1746+
~"attempted to take value of method \
1747+
(try writing an anonymous function)");
1748+
// Add error type for the result
1749+
fcx.write_error(expr.id);
1750+
}
1751+
}
17401752
None => {
1741-
fcx.type_error_message(
1742-
expr.span,
1743-
|actual| {
1744-
fmt!("attempted access of field `%s` on type `%s`, \
1745-
but no field with that name was found",
1746-
*tcx.sess.str_of(field), actual)
1747-
},
1748-
expr_t, None);
1753+
fcx.type_error_message(expr.span,
1754+
|actual| {
1755+
fmt!("attempted access of field `%s` on type `%s`, but \
1756+
no field or method with that name was found",
1757+
*tcx.sess.str_of(field), actual)
1758+
},
1759+
expr_t, None);
1760+
// Add error type for the result
1761+
fcx.write_error(expr.id);
17491762
}
17501763
}
17511764

1752-
fcx.write_error(expr.id);
17531765
}
17541766

17551767
fn check_struct_or_variant_fields(fcx: @mut FnCtxt,
@@ -2738,7 +2750,15 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
27382750
}
27392751
}
27402752
ast::expr_field(base, field, ref tys) => {
2741-
check_field(fcx, expr, base, field, *tys);
2753+
check_field(fcx, expr, false, base, field, * tys);
2754+
let base_t = fcx.expr_ty(base);
2755+
if ty::type_is_error(base_t) {
2756+
fcx.write_error(id);
2757+
}
2758+
else if ty::type_is_bot(base_t) {
2759+
fcx.write_bot(id);
2760+
}
2761+
// Otherwise, type already got written
27422762
}
27432763
ast::expr_index(base, idx) => {
27442764
check_expr(fcx, base);

branches/incoming/src/librustc/middle/typeck/check/regionck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ pub mod guarantor {
615615
// expressions, both of which always yield a region variable, so
616616
// mk_subr should never fail.
617617
let rptr_ty = rcx.resolve_node_type(id);
618-
if !ty::type_is_error(rptr_ty) && !ty::type_is_bot(rptr_ty) {
618+
if !ty::type_is_error(rptr_ty) {
619619
let tcx = rcx.fcx.ccx.tcx;
620620
debug!("rptr_ty=%s", ty_to_str(tcx, rptr_ty));
621621
let r = ty::ty_region(tcx, span, rptr_ty);

0 commit comments

Comments
 (0)