Skip to content

Commit 66e2419

Browse files
committed
---
yaml --- r: 31479 b: refs/heads/dist-snap c: 93c2f5e h: refs/heads/master i: 31477: d7654a6 31475: 776041d 31471: fe72d02 v: v3
1 parent 7cca471 commit 66e2419

24 files changed

+343
-290
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: e6d2e49852873c52b872185a0ae5a8ca941ed2f1
10+
refs/heads/dist-snap: 93c2f5e0e43532a2288ed6dec378564264d1a77c
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/libcore/core.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ import f32::num;
3131
import f64::num;
3232
import num::num;
3333
import ops::{const, copy, send, owned};
34-
import ops::{add, sub, mul, div, modulo, neg, bitops, index};
34+
import ops::{add, sub, mul, div, modulo, neg, bitand, bitor, bitxor, shl};
35+
import ops::{shr, index};
3536

3637
export path, option, some, none, unreachable;
3738
export extensions;

branches/dist-snap/src/libcore/ops.rs

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,96 @@
11
// Core operators and kinds.
22

3+
#[cfg(notest)]
34
#[lang="const"]
45
trait const {
56
// Empty.
67
}
78

9+
#[cfg(notest)]
810
#[lang="copy"]
911
trait copy {
1012
// Empty.
1113
}
1214

15+
#[cfg(notest)]
1316
#[lang="send"]
1417
trait send {
1518
// Empty.
1619
}
1720

21+
#[cfg(notest)]
1822
#[lang="owned"]
1923
trait owned {
2024
// Empty.
2125
}
2226

27+
#[cfg(notest)]
2328
#[lang="add"]
2429
trait add<RHS,Result> {
2530
pure fn add(rhs: RHS) -> Result;
2631
}
2732

33+
#[cfg(notest)]
2834
#[lang="sub"]
2935
trait sub<RHS,Result> {
3036
pure fn sub(rhs: RHS) -> Result;
3137
}
3238

39+
#[cfg(notest)]
3340
#[lang="mul"]
3441
trait mul<RHS,Result> {
3542
pure fn mul(rhs: RHS) -> Result;
3643
}
3744

45+
#[cfg(notest)]
3846
#[lang="div"]
3947
trait div<RHS,Result> {
4048
pure fn div(rhs: RHS) -> Result;
4149
}
4250

51+
#[cfg(notest)]
4352
#[lang="modulo"]
4453
trait modulo<RHS,Result> {
4554
pure fn modulo(rhs: RHS) -> Result;
4655
}
4756

57+
#[cfg(notest)]
4858
#[lang="neg"]
49-
trait neg<RHS,Result> {
50-
pure fn neg(rhs: RHS) -> Result;
59+
trait neg<Result> {
60+
pure fn neg() -> Result;
5161
}
5262

53-
#[lang="bitops"]
54-
trait bitops<RHS,BitCount,Result> {
55-
pure fn and(rhs: RHS) -> Result;
56-
pure fn or(rhs: RHS) -> Result;
57-
pure fn xor(rhs: RHS) -> Result;
58-
pure fn shl(n: BitCount) -> Result;
59-
pure fn shr(n: BitCount) -> Result;
63+
#[cfg(notest)]
64+
#[lang="bitand"]
65+
trait bitand<RHS,Result> {
66+
pure fn bitand(rhs: RHS) -> Result;
6067
}
6168

69+
#[cfg(notest)]
70+
#[lang="bitor"]
71+
trait bitor<RHS,Result> {
72+
pure fn bitor(rhs: RHS) -> Result;
73+
}
74+
75+
#[cfg(notest)]
76+
#[lang="bitxor"]
77+
trait bitxor<RHS,Result> {
78+
pure fn bitxor(rhs: RHS) -> Result;
79+
}
80+
81+
#[cfg(notest)]
82+
#[lang="shl"]
83+
trait shl<RHS,Result> {
84+
pure fn shl(rhs: RHS) -> Result;
85+
}
86+
87+
#[cfg(notest)]
88+
#[lang="shr"]
89+
trait shr<RHS,Result> {
90+
pure fn shr(rhs: RHS) -> Result;
91+
}
92+
93+
#[cfg(notest)]
6294
#[lang="index"]
6395
trait index<Index,Result> {
6496
pure fn index(index: Index) -> Result;

branches/dist-snap/src/libstd/ebml.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export serializer;
2727
export ebml_deserializer;
2828
export deserializer;
2929
export with_doc_data;
30+
export get_doc;
31+
export extensions;
3032

3133
type ebml_tag = {id: uint, size: uint};
3234

@@ -40,6 +42,24 @@ type doc = {data: @~[u8], start: uint, end: uint};
4042

4143
type tagged_doc = {tag: uint, doc: doc};
4244

45+
trait get_doc {
46+
fn [](tag: uint) -> doc;
47+
}
48+
49+
impl extensions of get_doc for doc {
50+
fn [](tag: uint) -> doc {
51+
get_doc(self, tag)
52+
}
53+
}
54+
55+
impl extensions of ops::index<uint,doc> for doc {
56+
pure fn index(&&tag: uint) -> doc {
57+
unchecked {
58+
get_doc(self, tag)
59+
}
60+
}
61+
}
62+
4363
fn vuint_at(data: &[u8], start: uint) -> {val: uint, next: uint} {
4464
let a = data[start];
4565
if a & 0x80u8 != 0u8 {

branches/dist-snap/src/libsyntax/ast.rs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,59 @@ enum inlined_item {
773773
ii_dtor(class_dtor, ident, ~[ty_param], def_id /* parent id */)
774774
}
775775

776+
// Convenience functions
777+
778+
pure fn simple_path(id: ident, span: span) -> @path {
779+
@{span: span,
780+
global: false,
781+
idents: ~[id],
782+
rp: none,
783+
types: ~[]}
784+
}
785+
786+
pure fn empty_span() -> span {
787+
{lo: 0, hi: 0, expn_info: none}
788+
}
789+
790+
// Convenience implementations
791+
792+
// Remove after snapshot!
793+
trait path_concat {
794+
pure fn +(&&id: ident) -> @path;
795+
}
796+
797+
// Remove after snapshot!
798+
impl methods of path_concat for ident {
799+
pure fn +(&&id: ident) -> @path {
800+
simple_path(self, empty_span()) + id
801+
}
802+
}
803+
804+
impl methods of ops::add<ident,@path> for ident {
805+
pure fn add(&&id: ident) -> @path {
806+
simple_path(self, empty_span()) + id
807+
}
808+
}
809+
810+
// Remove after snapshot!
811+
impl methods of path_concat for @path {
812+
pure fn +(&&id: ident) -> @path {
813+
@{
814+
idents: vec::append_one(self.idents, id)
815+
with *self
816+
}
817+
}
818+
}
819+
820+
impl methods of ops::add<ident,@path> for @path {
821+
pure fn add(&&id: ident) -> @path {
822+
@{
823+
idents: vec::append_one(self.idents, id)
824+
with *self
825+
}
826+
}
827+
}
828+
776829
//
777830
// Local Variables:
778831
// mode: rust

branches/dist-snap/src/libsyntax/ast_util.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,22 @@ pure fn binop_to_str(op: binop) -> ~str {
8787
}
8888
}
8989
90+
pure fn binop_to_method_name(op: binop) -> option<~str> {
91+
alt op {
92+
add { ret some(~"add"); }
93+
subtract { ret some(~"sub"); }
94+
mul { ret some(~"mul"); }
95+
div { ret some(~"div"); }
96+
rem { ret some(~"modulo"); }
97+
bitxor { ret some(~"bitxor"); }
98+
bitand { ret some(~"bitand"); }
99+
bitor { ret some(~"bitor"); }
100+
shl { ret some(~"shl"); }
101+
shr { ret some(~"shr"); }
102+
and | or | eq | lt | le | ne | ge | gt { ret none; }
103+
}
104+
}
105+
90106
pure fn lazy_binop(b: binop) -> bool {
91107
alt b { and { true } or { true } _ { false } }
92108
}

branches/dist-snap/src/libsyntax/ext/pipes/ast_builder.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,6 @@ fn empty_span() -> span {
3131
{lo: 0, hi: 0, expn_info: none}
3232
}
3333

34-
trait path_concat {
35-
fn +(id: ident) -> @ast::path;
36-
}
37-
38-
impl methods of path_concat for ident {
39-
fn +(id: ident) -> @ast::path {
40-
path(self, empty_span()) + id
41-
}
42-
}
43-
44-
impl methods of path_concat for @ast::path {
45-
fn +(id: ident) -> @ast::path {
46-
@{idents: vec::append_one(self.idents, id)
47-
with *self}
48-
}
49-
}
50-
5134
trait append_types {
5235
fn add_ty(ty: @ast::ty) -> @ast::path;
5336
fn add_tys(+tys: ~[@ast::ty]) -> @ast::path;

branches/dist-snap/src/libsyntax/ext/pipes/pipec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ import ext::base::{mk_ctxt, ext_ctxt};
1616
import parse;
1717
import parse::*;
1818
import proto::*;
19+
import ast::methods;
1920

2021
import ast_builder::append_types;
2122
import ast_builder::ast_builder;
2223
import ast_builder::methods;
2324
import ast_builder::path;
24-
import ast_builder::path_concat;
2525

2626
// Transitional reexports so qquote can find the paths it is looking for
2727
mod syntax {

branches/dist-snap/src/rustc/driver/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
170170
session::sess_os_to_meta_os(sess.targ_cfg.os),
171171
sess.opts.static));
172172

173-
time(time_passes, ~"language item collection", ||
173+
let lang_items = time(time_passes, ~"language item collection", ||
174174
middle::lang_items::collect_language_items(crate, sess));
175175

176176
let { def_map: def_map,
177177
exp_map: exp_map,
178178
impl_map: impl_map,
179179
trait_map: trait_map } =
180180
time(time_passes, ~"resolution", ||
181-
middle::resolve3::resolve_crate(sess, ast_map, crate));
181+
middle::resolve3::resolve_crate(sess, lang_items, crate));
182182

183183
let freevars = time(time_passes, ~"freevar finding", ||
184184
freevars::annotate_freevars(def_map, crate));

branches/dist-snap/src/rustc/middle/astencode.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import std::ebml;
1313
import std::ebml::writer;
1414
import std::ebml::serializer;
1515
import std::ebml::deserializer;
16+
import std::ebml::extensions;
17+
import std::ebml::get_doc;
1618
import std::map::hashmap;
1719
import std::serialization::serializer;
1820
import std::serialization::deserializer;
@@ -285,7 +287,7 @@ fn simplify_ast(ii: ast::inlined_item) -> ast::inlined_item {
285287
}
286288

287289
fn decode_ast(par_doc: ebml::doc) -> ast::inlined_item {
288-
let chi_doc = par_doc[c::tag_tree];
290+
let chi_doc = par_doc[c::tag_tree as uint];
289291
let d = ebml::ebml_deserializer(chi_doc);
290292
ast::deserialize_inlined_item(d)
291293
}
@@ -776,15 +778,11 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
776778

777779
trait doc_decoder_helpers {
778780
fn as_int() -> int;
779-
fn [](tag: c::astencode_tag) -> ebml::doc;
780781
fn opt_child(tag: c::astencode_tag) -> option<ebml::doc>;
781782
}
782783

783784
impl decoder of doc_decoder_helpers for ebml::doc {
784785
fn as_int() -> int { ebml::doc_as_u64(self) as int }
785-
fn [](tag: c::astencode_tag) -> ebml::doc {
786-
ebml::get_doc(self, tag as uint)
787-
}
788786
fn opt_child(tag: c::astencode_tag) -> option<ebml::doc> {
789787
ebml::maybe_get_doc(self, tag as uint)
790788
}
@@ -843,9 +841,9 @@ impl decoder of ebml_deserializer_decoder_helpers
843841
fn decode_side_tables(xcx: extended_decode_ctxt,
844842
ast_doc: ebml::doc) {
845843
let dcx = xcx.dcx;
846-
let tbl_doc = ast_doc[c::tag_table];
844+
let tbl_doc = ast_doc[c::tag_table as uint];
847845
for ebml::docs(tbl_doc) |tag, entry_doc| {
848-
let id0 = entry_doc[c::tag_table_id].as_int();
846+
let id0 = entry_doc[c::tag_table_id as uint].as_int();
849847
let id = xcx.tr_id(id0);
850848

851849
#debug[">> Side table document with tag 0x%x \
@@ -855,7 +853,7 @@ fn decode_side_tables(xcx: extended_decode_ctxt,
855853
if tag == (c::tag_table_mutbl as uint) {
856854
dcx.maps.mutbl_map.insert(id, ());
857855
} else {
858-
let val_doc = entry_doc[c::tag_table_val];
856+
let val_doc = entry_doc[c::tag_table_val as uint];
859857
let val_dsr = ebml::ebml_deserializer(val_doc);
860858
if tag == (c::tag_table_def as uint) {
861859
let def = decode_def(xcx, val_doc);
@@ -916,7 +914,7 @@ fn encode_item_ast(ebml_w: ebml::writer, item: @ast::item) {
916914

917915
#[cfg(test)]
918916
fn decode_item_ast(par_doc: ebml::doc) -> @ast::item {
919-
let chi_doc = par_doc[c::tag_tree];
917+
let chi_doc = par_doc[c::tag_tree as uint];
920918
let d = ebml::ebml_deserializer(chi_doc);
921919
@ast::deserialize_item(d)
922920
}

0 commit comments

Comments
 (0)