Skip to content

Commit beaf362

Browse files
committed
---
yaml --- r: 145183 b: refs/heads/try2 c: 2a706aa h: refs/heads/master i: 145181: 73a3d77 145179: 1e79987 145175: 562f82d 145167: f5e89a0 145151: 11e21e0 v: v3
1 parent f5948b2 commit beaf362

34 files changed

+840
-335
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: e1507f3120a14399af1a4bb097240c9be865634d
8+
refs/heads/try2: 2a706aab1c5990a37378f2b3fdfef8410c3743b2
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/.gitattributes

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
[attr]rust text eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=4
22

3-
* text=auto
3+
* text eol=lf
44
*.cpp rust
55
*.h rust
66
*.rs rust
77
src/rt/msvc/* -whitespace
88
src/rt/vg/* -whitespace
99
src/rt/linenoise/* -whitespace
1010
src/rt/jemalloc/**/* -whitespace
11-
src/rt/jemalloc/include/jemalloc/jemalloc.h.in text eol=lf
12-
src/rt/jemalloc/include/jemalloc/jemalloc_defs.h.in text eol=lf
13-
src/rt/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in text eol=lf

branches/try2/doc/tutorial-tasks.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,14 @@ concurrency at this writing:
4747

4848
* [`std::task`] - All code relating to tasks and task scheduling,
4949
* [`std::comm`] - The message passing interface,
50-
* [`std::pipes`] - The underlying messaging infrastructure,
51-
* [`extra::comm`] - Additional messaging types based on `std::pipes`,
50+
* [`extra::comm`] - Additional messaging types based on `std::comm`,
5251
* [`extra::sync`] - More exotic synchronization tools, including locks,
5352
* [`extra::arc`] - The Arc (atomically reference counted) type,
5453
for safely sharing immutable data,
5554
* [`extra::future`] - A type representing values that may be computed concurrently and retrieved at a later time.
5655

5756
[`std::task`]: std/task.html
5857
[`std::comm`]: std/comm.html
59-
[`std::pipes`]: std/pipes.html
6058
[`extra::comm`]: extra/comm.html
6159
[`extra::sync`]: extra/sync.html
6260
[`extra::arc`]: extra/arc.html
@@ -125,7 +123,7 @@ receiving messages. Pipes are low-level communication building-blocks and so
125123
come in a variety of forms, each one appropriate for a different use case. In
126124
what follows, we cover the most commonly used varieties.
127125

128-
The simplest way to create a pipe is to use the `pipes::stream`
126+
The simplest way to create a pipe is to use the `comm::stream`
129127
function to create a `(Port, Chan)` pair. In Rust parlance, a *channel*
130128
is a sending endpoint of a pipe, and a *port* is the receiving
131129
endpoint. Consider the following example of calculating two results

branches/try2/mk/platform.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ else
4747
CFG_GCCISH_CFLAGS += -O2
4848
endif
4949

50+
# The soname thing is for supporting a statically linked jemalloc.
51+
# see https://blog.mozilla.org/jseward/2012/06/05/valgrind-now-supports-jemalloc-builds-directly/
5052
ifdef CFG_VALGRIND
5153
CFG_VALGRIND += --error-exitcode=100 \
54+
--soname-synonyms=somalloc=NONE \
5255
--quiet \
5356
--suppressions=$(CFG_SRC_DIR)src/etc/x86.supp \
5457
$(OS_SUPP)

branches/try2/src/libextra/json.rs

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,21 @@ impl serialize::Encoder for Encoder {
135135
_id: uint,
136136
cnt: uint,
137137
f: &fn(&mut Encoder)) {
138-
// enums are encoded as strings or vectors:
138+
// enums are encoded as strings or objects
139139
// Bunny => "Bunny"
140-
// Kangaroo(34,"William") => ["Kangaroo",[34,"William"]]
141-
140+
// Kangaroo(34,"William") => {"variant": "Kangaroo", "fields": [34,"William"]}
142141
if cnt == 0 {
143142
self.wr.write_str(escape_str(name));
144143
} else {
145-
self.wr.write_char('[');
144+
self.wr.write_char('{');
145+
self.wr.write_str("\"variant\"");
146+
self.wr.write_char(':');
146147
self.wr.write_str(escape_str(name));
147148
self.wr.write_char(',');
149+
self.wr.write_str("\"fields\"");
150+
self.wr.write_str(":[");
148151
f(self);
149-
self.wr.write_char(']');
152+
self.wr.write_str("]}");
150153
}
151154
}
152155

@@ -947,14 +950,20 @@ impl serialize::Decoder for Decoder {
947950
debug!("read_enum_variant(names=%?)", names);
948951
let name = match self.stack.pop() {
949952
String(s) => s,
950-
List(list) => {
951-
for v in list.move_rev_iter() {
952-
self.stack.push(v);
953-
}
954-
match self.stack.pop() {
955-
String(s) => s,
956-
value => fail!("invalid variant name: %?", value),
953+
Object(o) => {
954+
let n = match o.find(&~"variant").expect("invalidly encoded json") {
955+
&String(ref s) => s.clone(),
956+
_ => fail!("invalidly encoded json"),
957+
};
958+
match o.find(&~"fields").expect("invalidly encoded json") {
959+
&List(ref l) => {
960+
for field in l.rev_iter() {
961+
self.stack.push(field.clone());
962+
}
963+
},
964+
_ => fail!("invalidly encoded json")
957965
}
966+
n
958967
}
959968
ref json => fail!("invalid variant: %?", *json),
960969
};
@@ -1517,7 +1526,7 @@ mod tests {
15171526
let mut encoder = Encoder(wr);
15181527
animal.encode(&mut encoder);
15191528
},
1520-
~"[\"Frog\",\"Henry\",349]"
1529+
~"{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}"
15211530
);
15221531
assert_eq!(
15231532
do io::with_str_writer |wr| {
@@ -1921,14 +1930,14 @@ mod tests {
19211930
assert_eq!(value, Dog);
19221931

19231932
let mut decoder =
1924-
Decoder(from_str("[\"Frog\",\"Henry\",349]").unwrap());
1933+
Decoder(from_str("{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}").unwrap());
19251934
let value: Animal = Decodable::decode(&mut decoder);
19261935
assert_eq!(value, Frog(~"Henry", 349));
19271936
}
19281937
19291938
#[test]
19301939
fn test_decode_map() {
1931-
let s = ~"{\"a\": \"Dog\", \"b\": [\"Frog\", \"Henry\", 349]}";
1940+
let s = ~"{\"a\": \"Dog\", \"b\": {\"variant\":\"Frog\",\"fields\":[\"Henry\", 349]}}";
19321941
let mut decoder = Decoder(from_str(s).unwrap());
19331942
let mut map: TreeMap<~str, Animal> = Decodable::decode(&mut decoder);
19341943

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ pub struct EncodeParams<'self> {
6060
reexports2: middle::resolve::ExportMap2,
6161
item_symbols: &'self HashMap<ast::NodeId, ~str>,
6262
discrim_symbols: &'self HashMap<ast::NodeId, @str>,
63+
non_inlineable_statics: &'self HashSet<ast::NodeId>,
6364
link_meta: &'self LinkMeta,
6465
cstore: @mut cstore::CStore,
6566
encode_inlined_item: encode_inlined_item<'self>,
@@ -89,6 +90,7 @@ pub struct EncodeContext<'self> {
8990
reexports2: middle::resolve::ExportMap2,
9091
item_symbols: &'self HashMap<ast::NodeId, ~str>,
9192
discrim_symbols: &'self HashMap<ast::NodeId, @str>,
93+
non_inlineable_statics: &'self HashSet<ast::NodeId>,
9294
link_meta: &'self LinkMeta,
9395
cstore: &'self cstore::CStore,
9496
encode_inlined_item: encode_inlined_item<'self>,
@@ -907,7 +909,9 @@ fn encode_info_for_item(ecx: &EncodeContext,
907909
encode_name(ecx, ebml_w, item.ident);
908910
let elt = ast_map::path_pretty_name(item.ident, item.id as u64);
909911
encode_path(ecx, ebml_w, path, elt);
910-
(ecx.encode_inlined_item)(ecx, ebml_w, path, ii_item(item));
912+
if !ecx.non_inlineable_statics.contains(&item.id) {
913+
(ecx.encode_inlined_item)(ecx, ebml_w, path, ii_item(item));
914+
}
911915
ebml_w.end_tag();
912916
}
913917
item_fn(_, purity, _, ref generics, _) => {
@@ -1728,6 +1732,7 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
17281732
encode_inlined_item,
17291733
link_meta,
17301734
reachable,
1735+
non_inlineable_statics,
17311736
_
17321737
} = parms;
17331738
let type_abbrevs = @mut HashMap::new();
@@ -1739,6 +1744,7 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
17391744
reexports2: reexports2,
17401745
item_symbols: item_symbols,
17411746
discrim_symbols: discrim_symbols,
1747+
non_inlineable_statics: non_inlineable_statics,
17421748
link_meta: link_meta,
17431749
cstore: cstore,
17441750
encode_inlined_item: encode_inlined_item,

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,15 +324,16 @@ fn trans_opt(bcx: @mut Block, o: &Opt) -> opt_result {
324324
return single_result(datumblock.to_result(bcx));
325325
}
326326
lit(ConstLit(lit_id)) => {
327-
let llval = consts::get_const_val(bcx.ccx(), lit_id);
327+
let (llval, _) = consts::get_const_val(bcx.ccx(), lit_id);
328328
return single_result(rslt(bcx, llval));
329329
}
330330
var(disr_val, repr) => {
331331
return adt::trans_case(bcx, repr, disr_val);
332332
}
333333
range(l1, l2) => {
334-
return range_result(rslt(bcx, consts::const_expr(ccx, l1)),
335-
rslt(bcx, consts::const_expr(ccx, l2)));
334+
let (l1, _) = consts::const_expr(ccx, l1);
335+
let (l2, _) = consts::const_expr(ccx, l2);
336+
return range_result(rslt(bcx, l1), rslt(bcx, l2));
336337
}
337338
vec_len(n, vec_len_eq, _) => {
338339
return single_result(rslt(bcx, C_int(ccx, n as int)));

0 commit comments

Comments
 (0)