Skip to content

Commit 9fa912c

Browse files
committed
---
yaml --- r: 139367 b: refs/heads/try2 c: 2f1ab3a h: refs/heads/master i: 139365: f17a62a 139363: 315d99f 139359: ccc8cf1 v: v3
1 parent 6535bab commit 9fa912c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+783
-783
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: 4954d3e50177c46d260a5340ff91bfada8590ef0
8+
refs/heads/try2: 2f1ab3a7fad9aeb871479470785250fe2e923e19
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/RELEASES.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ Version 0.6 (March 2013)
6262
* Pattern matching over vectors improved and expanded
6363
* Typechecking of closure types has been overhauled to
6464
improve inference and eliminate unsoundness
65-
* Macros leave scope at the end of modules, unless that module is
66-
tagged with #[macro_escape]
6765

6866
* Libraries
6967
* Added big integers to `std::bigint`

branches/try2/configure

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ case $CFG_OSTYPE in
308308
esac
309309

310310

311+
if [ -z "$CFG_CPUTYPE" ]
312+
then
311313
case $CFG_CPUTYPE in
312314

313315
i386 | i486 | i686 | i786 | x86)
@@ -325,6 +327,7 @@ case $CFG_CPUTYPE in
325327
*)
326328
err "unknown CPU type: $CFG_CPUTYPE"
327329
esac
330+
fi
328331

329332
# Detect 64 bit linux systems with 32 bit userland and force 32 bit compilation
330333
if [ $CFG_OSTYPE = unknown-linux-gnu -a $CFG_CPUTYPE = x86_64 ]
@@ -572,7 +575,7 @@ fi
572575
CFG_PREFIX=${CFG_PREFIX%/}
573576
CFG_HOST_TRIPLES="$(echo $CFG_HOST_TRIPLES | tr ',' ' ')"
574577
CFG_TARGET_TRIPLES="$(echo $CFG_TARGET_TRIPLES | tr ',' ' ')"
575-
CFG_SUPPORTED_TARGET_TRIPLES="$(grep ^CC_*=* $CFG_SRC_DIR/mk/platform.mk | sed -e 's/^CC_//' -e 's/\([^=]*\).*/\1/' | xargs)"
578+
CFG_SUPPORTED_TARGET_TRIPLES="$(grep ^CC_*=* $CFG_SRC_DIR/mk/platform.mk | sed 's,^[^_]*_,,' | sed 's/\([^=]*\).*/\1/' | xargs)"
576579

577580
# copy host-triples to target-triples so that hosts are a subset of targets
578581
V_TEMP=""

branches/try2/src/libcore/hashmap.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! An unordered map and set type implemented as hash tables
12-
//!
13-
//! The tables use a keyed hash with new random keys generated for each container, so the ordering
14-
//! of a set of keys in a hash table is randomized.
11+
//! Sendable hash maps.
1512
1613
/// Open addressing with linear probing.
1714
pub mod linear {

branches/try2/src/libcore/ops.rs

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

11-
//! Traits for the built-in operators
11+
// Core operators
1212

1313
#[lang="drop"]
1414
pub trait Drop {
@@ -77,5 +77,5 @@ pub trait Shr<RHS,Result> {
7777

7878
#[lang="index"]
7979
pub trait Index<Index,Result> {
80-
fn index(&self, index: &Index) -> Result;
80+
fn index(&self, index: Index) -> Result;
8181
}

branches/try2/src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@ fn get_self_ty(item: ebml::Doc) -> ast::self_ty_ {
630630
let self_ty_kind = string[0];
631631
match self_ty_kind as char {
632632
's' => { return ast::sty_static; }
633+
'r' => { return ast::sty_by_ref; }
633634
'v' => { return ast::sty_value; }
634635
'@' => { return ast::sty_box(get_mutability(string[1])); }
635636
'~' => { return ast::sty_uniq(get_mutability(string[1])); }

branches/try2/src/librustc/metadata/encoder.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,9 @@ fn encode_self_type(ebml_w: writer::Encoder, self_type: ast::self_ty_) {
410410
sty_static => {
411411
ebml_w.writer.write(&[ 's' as u8 ]);
412412
}
413+
sty_by_ref => {
414+
ebml_w.writer.write(&[ 'r' as u8 ]);
415+
}
413416
sty_value => {
414417
ebml_w.writer.write(&[ 'v' as u8 ]);
415418
}

branches/try2/src/librustc/metadata/tydecode.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use core::vec;
2424
use syntax::ast;
2525
use syntax::ast::*;
2626
use syntax::codemap::{respan, dummy_sp};
27-
use syntax::opt_vec;
2827

2928
// Compact string representation for ty::t values. API ty_str &
3029
// parse_from_str. Extra parameters are for converting to/from def_ids in the
@@ -480,9 +479,7 @@ fn parse_sig(st: @mut PState, conv: conv_did) -> ty::FnSig {
480479
}
481480
st.pos += 1u; // eat the ']'
482481
let ret_ty = parse_ty(st, conv);
483-
ty::FnSig {bound_lifetime_names: opt_vec::Empty, // FIXME(#4846)
484-
inputs: inputs,
485-
output: ret_ty}
482+
ty::FnSig {inputs: inputs, output: ret_ty}
486483
}
487484
488485
// Rust metadata parsing

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ fn simplify_ast(ii: ast::inlined_item) -> ast::inlined_item {
342342
}
343343
344344
fn decode_ast(par_doc: ebml::Doc) -> ast::inlined_item {
345-
let chi_doc = par_doc.get(c::tag_tree as uint);
345+
let chi_doc = par_doc[c::tag_tree as uint];
346346
let d = &reader::Decoder(chi_doc);
347347
Decodable::decode(d)
348348
}
@@ -1089,9 +1089,9 @@ impl ebml_decoder_decoder_helpers for reader::Decoder {
10891089
fn decode_side_tables(xcx: @ExtendedDecodeContext,
10901090
ast_doc: ebml::Doc) {
10911091
let dcx = xcx.dcx;
1092-
let tbl_doc = ast_doc.get(c::tag_table as uint);
1092+
let tbl_doc = ast_doc[c::tag_table as uint];
10931093
for reader::docs(tbl_doc) |tag, entry_doc| {
1094-
let id0 = entry_doc.get(c::tag_table_id as uint).as_int();
1094+
let id0 = entry_doc[c::tag_table_id as uint].as_int();
10951095
let id = xcx.tr_id(id0);
10961096
10971097
debug!(">> Side table document with tag 0x%x \
@@ -1103,7 +1103,7 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
11031103
} else if tag == (c::tag_table_moves_map as uint) {
11041104
dcx.maps.moves_map.insert(id);
11051105
} else {
1106-
let val_doc = entry_doc.get(c::tag_table_val as uint);
1106+
let val_doc = entry_doc[c::tag_table_val as uint];
11071107
let val_dsr = &reader::Decoder(val_doc);
11081108
if tag == (c::tag_table_def as uint) {
11091109
let def = decode_def(xcx, val_doc);
@@ -1172,7 +1172,7 @@ fn encode_item_ast(ebml_w: writer::Encoder, item: @ast::item) {
11721172
11731173
#[cfg(test)]
11741174
fn decode_item_ast(par_doc: ebml::Doc) -> @ast::item {
1175-
let chi_doc = par_doc.get(c::tag_tree as uint);
1175+
let chi_doc = par_doc[c::tag_tree as uint];
11761176
let d = &reader::Decoder(chi_doc);
11771177
@Decodable::decode(d)
11781178
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,21 @@ fn req_loans_in_expr(ex: @ast::expr,
180180
}
181181
}
182182

183+
match self.bccx.method_map.find(&ex.id) {
184+
Some(ref method_map_entry) => {
185+
match (*method_map_entry).explicit_self {
186+
ast::sty_by_ref => {
187+
let rcvr_cmt = self.bccx.cat_expr(rcvr);
188+
self.guarantee_valid(rcvr_cmt, m_imm, scope_r);
189+
}
190+
_ => {} // Nothing to do.
191+
}
192+
}
193+
None => {
194+
self.tcx().sess.span_bug(ex.span, ~"no method map entry");
195+
}
196+
}
197+
183198
visit::visit_expr(ex, self, vt);
184199
}
185200

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

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ use middle::typeck;
111111
use middle::moves;
112112
use util::ppaux::ty_to_str;
113113

114+
use core::cmp;
114115
use core::hashmap::linear::LinearMap;
115116
use core::io::WriterUtil;
116117
use core::io;
@@ -136,19 +137,58 @@ use syntax::{visit, ast_util};
136137
// if it detects an outstanding loan (that is, the addr is taken).
137138
pub type last_use_map = @mut LinearMap<node_id, @mut ~[node_id]>;
138139

139-
#[deriving(Eq)]
140140
struct Variable(uint);
141-
#[deriving(Eq)]
142141
struct LiveNode(uint);
143142

144-
#[deriving(Eq)]
143+
impl cmp::Eq for Variable {
144+
fn eq(&self, other: &Variable) -> bool { *(*self) == *(*other) }
145+
fn ne(&self, other: &Variable) -> bool { *(*self) != *(*other) }
146+
}
147+
148+
impl cmp::Eq for LiveNode {
149+
fn eq(&self, other: &LiveNode) -> bool { *(*self) == *(*other) }
150+
fn ne(&self, other: &LiveNode) -> bool { *(*self) != *(*other) }
151+
}
152+
145153
enum LiveNodeKind {
146154
FreeVarNode(span),
147155
ExprNode(span),
148156
VarDefNode(span),
149157
ExitNode
150158
}
151159

160+
impl cmp::Eq for LiveNodeKind {
161+
fn eq(&self, other: &LiveNodeKind) -> bool {
162+
match (*self) {
163+
FreeVarNode(e0a) => {
164+
match (*other) {
165+
FreeVarNode(e0b) => e0a == e0b,
166+
_ => false
167+
}
168+
}
169+
ExprNode(e0a) => {
170+
match (*other) {
171+
ExprNode(e0b) => e0a == e0b,
172+
_ => false
173+
}
174+
}
175+
VarDefNode(e0a) => {
176+
match (*other) {
177+
VarDefNode(e0b) => e0a == e0b,
178+
_ => false
179+
}
180+
}
181+
ExitNode => {
182+
match (*other) {
183+
ExitNode => true,
184+
_ => false
185+
}
186+
}
187+
}
188+
}
189+
fn ne(&self, other: &LiveNodeKind) -> bool { !(*self).eq(other) }
190+
}
191+
152192
fn live_node_kind_to_str(lnk: LiveNodeKind, cx: ty::ctxt) -> ~str {
153193
let cm = cx.sess.codemap;
154194
match lnk {
@@ -427,6 +467,11 @@ fn visit_fn(fk: &visit::fn_kind,
427467
match *fk {
428468
fk_method(_, _, method) => {
429469
match method.self_ty.node {
470+
sty_by_ref => {
471+
fn_maps.add_variable(Arg(method.self_id,
472+
special_idents::self_,
473+
by_ref));
474+
}
430475
sty_value | sty_region(*) | sty_box(_) | sty_uniq(_) => {
431476
fn_maps.add_variable(Arg(method.self_id,
432477
special_idents::self_,

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

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ pub impl VisitContext {
436436

437437
expr_unary(deref, base) => { // *base
438438
if !self.use_overloaded_operator(
439-
expr, base, [], visitor)
439+
expr, DontDerefArgs, base, [], visitor)
440440
{
441441
// Moving out of *base moves out of base.
442442
self.use_expr(base, comp_mode, visitor);
@@ -450,7 +450,7 @@ pub impl VisitContext {
450450

451451
expr_index(lhs, rhs) => { // lhs[rhs]
452452
if !self.use_overloaded_operator(
453-
expr, lhs, [rhs], visitor)
453+
expr, DontDerefArgs, lhs, [rhs], visitor)
454454
{
455455
self.use_expr(lhs, comp_mode, visitor);
456456
self.consume_expr(rhs, visitor);
@@ -579,15 +579,15 @@ pub impl VisitContext {
579579

580580
expr_unary(_, lhs) => {
581581
if !self.use_overloaded_operator(
582-
expr, lhs, [], visitor)
582+
expr, DontDerefArgs, lhs, [], visitor)
583583
{
584584
self.consume_expr(lhs, visitor);
585585
}
586586
}
587587

588588
expr_binary(_, lhs, rhs) => {
589589
if !self.use_overloaded_operator(
590-
expr, lhs, [rhs], visitor)
590+
expr, DoDerefArgs, lhs, [rhs], visitor)
591591
{
592592
self.consume_expr(lhs, visitor);
593593
self.consume_expr(rhs, visitor);
@@ -659,6 +659,7 @@ pub impl VisitContext {
659659

660660
fn use_overloaded_operator(&self,
661661
expr: @expr,
662+
deref_args: DerefArgs,
662663
receiver_expr: @expr,
663664
arg_exprs: &[@expr],
664665
visitor: vt<VisitContext>) -> bool
@@ -669,10 +670,21 @@ pub impl VisitContext {
669670

670671
self.use_receiver(expr.id, expr.span, receiver_expr, visitor);
671672

672-
// for overloaded operatrs, we are always passing in a
673-
// borrowed pointer, so it's always read mode:
674-
for arg_exprs.each |arg_expr| {
675-
self.use_expr(*arg_expr, Read, visitor);
673+
// The deref_args stuff should eventually be converted into
674+
// adjustments. Moreover, it should eventually be applied
675+
// consistently to all overloaded operators. But that's not
676+
// how it is today.
677+
match deref_args {
678+
DoDerefArgs => {
679+
// we are always passing in a borrowed pointer,
680+
// so it's always read mode:
681+
for arg_exprs.each |arg_expr| {
682+
self.use_expr(*arg_expr, Read, visitor);
683+
}
684+
}
685+
DontDerefArgs => {
686+
self.use_fn_args(expr.callee_id, arg_exprs, visitor);
687+
}
676688
}
677689

678690
return true;
@@ -725,7 +737,20 @@ pub impl VisitContext {
725737
receiver_expr: @expr,
726738
visitor: vt<VisitContext>)
727739
{
728-
self.use_fn_arg(by_copy, receiver_expr, visitor);
740+
let callee_mode = match self.method_map.find(&expr_id) {
741+
Some(ref method_map_entry) => {
742+
match method_map_entry.explicit_self {
743+
sty_by_ref => by_ref,
744+
_ => by_copy
745+
}
746+
}
747+
None => {
748+
self.tcx.sess.span_bug(
749+
span,
750+
~"no method map entry");
751+
}
752+
};
753+
self.use_fn_arg(callee_mode, receiver_expr, visitor);
729754
}
730755

731756
fn use_fn_args(&self,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use syntax::ast::{named_field, ne, neg, node_id, pat, pat_enum, pat_ident};
5050
use syntax::ast::{path, pat_box, pat_lit, pat_range, pat_struct};
5151
use syntax::ast::{pat_tup, pat_uniq, pat_wild, prim_ty, private, provided};
5252
use syntax::ast::{public, required, rem, self_ty_, shl, shr, stmt_decl};
53-
use syntax::ast::{struct_dtor, struct_field, struct_variant_kind};
53+
use syntax::ast::{struct_dtor, struct_field, struct_variant_kind, sty_by_ref};
5454
use syntax::ast::{sty_static, subtract, trait_ref, tuple_variant_kind, Ty};
5555
use syntax::ast::{ty_bool, ty_char, ty_f, ty_f32, ty_f64, ty_float, ty_i};
5656
use syntax::ast::{ty_i16, ty_i32, ty_i64, ty_i8, ty_int, TyParam, ty_path};
@@ -3792,6 +3792,7 @@ pub impl Resolver {
37923792
// we only have self ty if it is a non static method
37933793
let self_binding = match method.self_ty.node {
37943794
sty_static => { NoSelfBinding }
3795+
sty_by_ref => { HasSelfBinding(method.self_id, true) }
37953796
_ => { HasSelfBinding(method.self_id, false) }
37963797
};
37973798

branches/try2/src/librustc/middle/trans/cabi_x86_64.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ use lib::llvm::struct_tys;
1818
use middle::trans::common::*;
1919
use middle::trans::cabi::*;
2020

21+
use core::cmp;
2122
use core::libc::c_uint;
2223
use core::option;
2324
use core::option::Option;
2425
use core::uint;
2526
use core::vec;
2627

27-
#[deriving(Eq)]
2828
enum x86_64_reg_class {
2929
no_class,
3030
integer_class,
@@ -40,6 +40,13 @@ enum x86_64_reg_class {
4040
memory_class
4141
}
4242

43+
impl cmp::Eq for x86_64_reg_class {
44+
fn eq(&self, other: &x86_64_reg_class) -> bool {
45+
((*self) as uint) == ((*other) as uint)
46+
}
47+
fn ne(&self, other: &x86_64_reg_class) -> bool { !(*self).eq(other) }
48+
}
49+
4350
fn is_sse(++c: x86_64_reg_class) -> bool {
4451
return match c {
4552
sse_fs_class | sse_fv_class |

0 commit comments

Comments
 (0)