Skip to content

Commit ee6d591

Browse files
committed
---
yaml --- r: 143338 b: refs/heads/try2 c: 4a1a0fb h: refs/heads/master v: v3
1 parent 4b94889 commit ee6d591

File tree

26 files changed

+500
-389
lines changed

26 files changed

+500
-389
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: fe9929e303f4e0322fd0f38ec6cb6b3ec932e4a3
8+
refs/heads/try2: 4a1a0fbed5a57958eb7b658bbe3e5257872ae99f
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libextra/json.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,34 +1867,35 @@ mod tests {
18671867
col: 8u,
18681868
msg: @~"EOF while parsing object"}));
18691869
1870-
assert_eq!(from_str("{}").unwrap(), mk_object([]));
1871-
assert_eq!(from_str("{\"a\": 3}").unwrap(),
1870+
assert_eq!(result::unwrap(from_str("{}")), mk_object([]));
1871+
assert_eq!(result::unwrap(from_str("{\"a\": 3}")),
18721872
mk_object([(~"a", Number(3.0f))]));
18731873
1874-
assert_eq!(from_str(
1875-
"{ \"a\": null, \"b\" : true }").unwrap(),
1874+
assert_eq!(result::unwrap(from_str(
1875+
"{ \"a\": null, \"b\" : true }")),
18761876
mk_object([
18771877
(~"a", Null),
18781878
(~"b", Boolean(true))]));
1879-
assert_eq!(from_str("\n{ \"a\": null, \"b\" : true }\n").unwrap(),
1879+
assert_eq!(result::unwrap(
1880+
from_str("\n{ \"a\": null, \"b\" : true }\n")),
18801881
mk_object([
18811882
(~"a", Null),
18821883
(~"b", Boolean(true))]));
1883-
assert_eq!(from_str(
1884-
"{\"a\" : 1.0 ,\"b\": [ true ]}").unwrap(),
1884+
assert_eq!(result::unwrap(from_str(
1885+
"{\"a\" : 1.0 ,\"b\": [ true ]}")),
18851886
mk_object([
18861887
(~"a", Number(1.0)),
18871888
(~"b", List(~[Boolean(true)]))
18881889
]));
1889-
assert_eq!(from_str(
1890+
assert_eq!(result::unwrap(from_str(
18901891
~"{" +
18911892
"\"a\": 1.0, " +
18921893
"\"b\": [" +
18931894
"true," +
18941895
"\"foo\\nbar\", " +
18951896
"{ \"c\": {\"d\": null} } " +
18961897
"]" +
1897-
"}").unwrap(),
1898+
"}")),
18981899
mk_object([
18991900
(~"a", Number(1.0f)),
19001901
(~"b", List(~[

branches/try2/src/libextra/time.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,13 +1132,13 @@ mod tests {
11321132
assert!(test("6", "%w"));
11331133
assert!(test("2009", "%Y"));
11341134
assert!(test("09", "%y"));
1135-
assert!(strptime("UTC", "%Z").unwrap().tm_zone ==
1135+
assert!(result::unwrap(strptime("UTC", "%Z")).tm_zone ==
11361136
~"UTC");
1137-
assert!(strptime("PST", "%Z").unwrap().tm_zone ==
1137+
assert!(result::unwrap(strptime("PST", "%Z")).tm_zone ==
11381138
~"");
1139-
assert!(strptime("-0000", "%z").unwrap().tm_gmtoff ==
1139+
assert!(result::unwrap(strptime("-0000", "%z")).tm_gmtoff ==
11401140
0);
1141-
assert!(strptime("-0800", "%z").unwrap().tm_gmtoff ==
1141+
assert!(result::unwrap(strptime("-0800", "%z")).tm_gmtoff ==
11421142
0);
11431143
assert!(test("%", "%%"));
11441144

branches/try2/src/libextra/workcache.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use std::cell::Cell;
2222
use std::comm::{PortOne, oneshot, send_one, recv_one};
2323
use std::either::{Either, Left, Right};
2424
use std::io;
25+
use std::result;
2526
use std::run;
2627
use std::task;
2728

@@ -207,7 +208,7 @@ fn json_encode<T:Encodable<json::Encoder>>(t: &T) -> ~str {
207208
// FIXME(#5121)
208209
fn json_decode<T:Decodable<json::Decoder>>(s: &str) -> T {
209210
do io::with_str_reader(s) |rdr| {
210-
let j = json::from_reader(rdr).unwrap();
211+
let j = result::unwrap(json::from_reader(rdr));
211212
let mut decoder = json::Decoder(j);
212213
Decodable::decode(&mut decoder)
213214
}

branches/try2/src/librust/rust.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,7 @@ struct Command<'self> {
6060
usage_full: UsageSource<'self>,
6161
}
6262

63-
static NUM_OF_COMMANDS: uint = 7;
64-
65-
// FIXME(#7617): should just be &'static [Command<'static>]
66-
// but mac os doesn't seem to like that and tries to loop
67-
// past the end of COMMANDS in usage thus passing garbage
68-
// to str::repeat and eventually malloc and crashing.
69-
static COMMANDS: [Command<'static>, .. NUM_OF_COMMANDS] = [
63+
static COMMANDS: &'static [Command<'static>] = &[
7064
Command{
7165
cmd: "build",
7266
action: CallMain("rustc", rustc::main),

branches/try2/src/librustc/lib/llvm.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,6 +1594,9 @@ pub mod llvm {
15941594
Order: AtomicOrdering)
15951595
-> ValueRef;
15961596

1597+
pub unsafe fn LLVMBuildAtomicFence(B: BuilderRef, Order: AtomicOrdering);
1598+
1599+
15971600
/* Selected entries from the downcasts. */
15981601
#[fast_ffi]
15991602
pub unsafe fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub fn get_rustpkg_root() -> Result<Path, ~str> {
147147
}
148148

149149
pub fn get_rustpkg_root_nearest() -> Result<Path, ~str> {
150-
do get_rustpkg_root().chain |p| {
150+
do result::chain(get_rustpkg_root()) |p| {
151151
let cwd = os::getcwd();
152152
let cwd_rustpkg = cwd.push(".rustpkg");
153153
let rustpkg_is_non_root_file =
@@ -173,13 +173,13 @@ pub fn get_rustpkg_root_nearest() -> Result<Path, ~str> {
173173
}
174174

175175
fn get_rustpkg_lib_path() -> Result<Path, ~str> {
176-
do get_rustpkg_root().chain |p| {
176+
do result::chain(get_rustpkg_root()) |p| {
177177
result::Ok(p.push(libdir()))
178178
}
179179
}
180180

181181
fn get_rustpkg_lib_path_nearest() -> Result<Path, ~str> {
182-
do get_rustpkg_root_nearest().chain |p| {
182+
do result::chain(get_rustpkg_root_nearest()) |p| {
183183
result::Ok(p.push(libdir()))
184184
}
185185
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,11 @@ pub fn CallWithConv(cx: @mut Block, Fn: ValueRef, Args: &[ValueRef],
660660
B(cx).call_with_conv(Fn, Args, Conv)
661661
}
662662

663+
pub fn AtomicFence(cx: @mut Block, order: AtomicOrdering) {
664+
if cx.unreachable { return; }
665+
B(cx).atomic_fence(order)
666+
}
667+
663668
pub fn Select(cx: @mut Block, If: ValueRef, Then: ValueRef, Else: ValueRef) -> ValueRef {
664669
if cx.unreachable { return _Undef(Then); }
665670
B(cx).select(If, Then, Else)

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,4 +943,10 @@ impl Builder {
943943
llvm::LLVMBuildAtomicRMW(self.llbuilder, op, dst, src, order)
944944
}
945945
}
946+
947+
pub fn atomic_fence(&self, order: AtomicOrdering) {
948+
unsafe {
949+
llvm::LLVMBuildAtomicFence(self.llbuilder, order);
950+
}
951+
}
946952
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,10 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
661661
order);
662662
RetVoid(bcx);
663663
}
664+
"fence" => {
665+
AtomicFence(bcx, order);
666+
RetVoid(bcx);
667+
}
664668
op => {
665669
// These are all AtomicRMW ops
666670
let atom_op = match op {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3521,7 +3521,9 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
35213521
ty::re_bound(ty::br_anon(0)),
35223522
ty::mk_int()), ty::mk_int() ], ty::mk_int())
35233523
}
3524-
3524+
"fence" => {
3525+
(0, ~[], ty::mk_nil())
3526+
}
35253527
op => {
35263528
tcx.sess.span_err(it.span,
35273529
fmt!("unrecognized atomic operation function: `%s`",

branches/try2/src/librustdoc/config.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,30 +138,36 @@ fn config_from_opts(
138138

139139
let config = default_config(input_crate);
140140
let result = result::Ok(config);
141-
let result = do result.chain |config| {
141+
let result = do result::chain(result) |config| {
142142
let output_dir = getopts::opt_maybe_str(matches, opt_output_dir());
143143
let output_dir = output_dir.map(|s| Path(*s));
144144
result::Ok(Config {
145145
output_dir: output_dir.get_or_default(config.output_dir.clone()),
146146
.. config
147147
})
148148
};
149-
let result = do result.chain |config| {
150-
let output_format = getopts::opt_maybe_str(matches, opt_output_format());
151-
do output_format.map_default(result::Ok(config.clone())) |output_format| {
152-
do parse_output_format(*output_format).chain |output_format| {
149+
let result = do result::chain(result) |config| {
150+
let output_format = getopts::opt_maybe_str(
151+
matches, opt_output_format());
152+
do output_format.map_default(result::Ok(config.clone()))
153+
|output_format| {
154+
do result::chain(parse_output_format(*output_format))
155+
|output_format| {
156+
153157
result::Ok(Config {
154158
output_format: output_format,
155159
.. config.clone()
156160
})
157161
}
158162
}
159163
};
160-
let result = do result.chain |config| {
164+
let result = do result::chain(result) |config| {
161165
let output_style =
162166
getopts::opt_maybe_str(matches, opt_output_style());
163-
do output_style.map_default(result::Ok(config.clone())) |output_style| {
164-
do parse_output_style(*output_style).chain |output_style| {
167+
do output_style.map_default(result::Ok(config.clone()))
168+
|output_style| {
169+
do result::chain(parse_output_style(*output_style))
170+
|output_style| {
165171
result::Ok(Config {
166172
output_style: output_style,
167173
.. config.clone()
@@ -170,11 +176,11 @@ fn config_from_opts(
170176
}
171177
};
172178
let process_output = Cell::new(process_output);
173-
let result = do result.chain |config| {
179+
let result = do result::chain(result) |config| {
174180
let pandoc_cmd = getopts::opt_maybe_str(matches, opt_pandoc_cmd());
175181
let pandoc_cmd = maybe_find_pandoc(
176182
&config, pandoc_cmd, process_output.take());
177-
do pandoc_cmd.chain |pandoc_cmd| {
183+
do result::chain(pandoc_cmd) |pandoc_cmd| {
178184
result::Ok(Config {
179185
pandoc_cmd: pandoc_cmd,
180186
.. config.clone()

branches/try2/src/librustpkg/tests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ fn git_repo_pkg() -> PkgId {
6262
}
6363

6464
fn writeFile(file_path: &Path, contents: &str) {
65-
let out = io::file_writer(file_path, [io::Create, io::Truncate]).unwrap();
65+
let out: @io::Writer =
66+
result::unwrap(io::file_writer(file_path,
67+
[io::Create, io::Truncate]));
6668
out.write_line(contents);
6769
}
6870

0 commit comments

Comments
 (0)