Skip to content

Commit e5d4b4f

Browse files
committed
---
yaml --- r: 152151 b: refs/heads/try2 c: e5e865b h: refs/heads/master i: 152149: b9747e8 152147: 0d15665 152143: 9f8852e v: v3
1 parent ca1b171 commit e5d4b4f

Some content is hidden

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

88 files changed

+821
-574
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: 5aff0e7cec9a3833ea67477bca13efcb4d950db7
8+
refs/heads/try2: e5e865b8044cef76bd33ba268a8cdea8a401c96c
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ config.mk
6060
/rt/
6161
/rustllvm/
6262
/test/
63-
/build
6463
/inst/
6564
/mingw-build/
6665
src/.DS_Store

branches/try2/src/compiletest/runtest.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) {
7373
let proc_res = compile_test(config, props, testfile);
7474

7575
if proc_res.status.success() {
76-
fatal_ProcRes("compile-fail test compiled successfully!".to_string(),
76+
fatal_proc_rec("compile-fail test compiled successfully!".to_string(),
7777
&proc_res);
7878
}
7979

@@ -97,7 +97,7 @@ fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) {
9797
let proc_res = compile_test(config, props, testfile);
9898

9999
if !proc_res.status.success() {
100-
fatal_ProcRes("compilation failed!".to_string(), &proc_res);
100+
fatal_proc_rec("compilation failed!".to_string(), &proc_res);
101101
}
102102

103103
exec_compiled_test(config, props, testfile)
@@ -108,7 +108,7 @@ fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) {
108108
// The value our Makefile configures valgrind to return on failure
109109
static VALGRIND_ERR: int = 100;
110110
if proc_res.status.matches_exit_status(VALGRIND_ERR) {
111-
fatal_ProcRes("run-fail test isn't valgrind-clean!".to_string(),
111+
fatal_proc_rec("run-fail test isn't valgrind-clean!".to_string(),
112112
&proc_res);
113113
}
114114

@@ -120,7 +120,7 @@ fn check_correct_failure_status(proc_res: &ProcRes) {
120120
// The value the rust runtime returns on failure
121121
static RUST_ERR: int = 101;
122122
if !proc_res.status.matches_exit_status(RUST_ERR) {
123-
fatal_ProcRes(
123+
fatal_proc_rec(
124124
format!("failure produced the wrong error: {}", proc_res.status),
125125
proc_res);
126126
}
@@ -131,19 +131,19 @@ fn run_rpass_test(config: &Config, props: &TestProps, testfile: &Path) {
131131
let mut proc_res = compile_test(config, props, testfile);
132132

133133
if !proc_res.status.success() {
134-
fatal_ProcRes("compilation failed!".to_string(), &proc_res);
134+
fatal_proc_rec("compilation failed!".to_string(), &proc_res);
135135
}
136136

137137
proc_res = exec_compiled_test(config, props, testfile);
138138

139139
if !proc_res.status.success() {
140-
fatal_ProcRes("test run failed!".to_string(), &proc_res);
140+
fatal_proc_rec("test run failed!".to_string(), &proc_res);
141141
}
142142
} else {
143143
let proc_res = jit_test(config, props, testfile);
144144

145145
if !proc_res.status.success() {
146-
fatal_ProcRes("jit failed!".to_string(), &proc_res);
146+
fatal_proc_rec("jit failed!".to_string(), &proc_res);
147147
}
148148
}
149149
}
@@ -172,7 +172,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
172172
"normal");
173173

174174
if !proc_res.status.success() {
175-
fatal_ProcRes(format!("pretty-printing failed in round {}", round),
175+
fatal_proc_rec(format!("pretty-printing failed in round {}", round),
176176
&proc_res);
177177
}
178178

@@ -204,21 +204,21 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
204204
let proc_res = typecheck_source(config, props, testfile, actual);
205205

206206
if !proc_res.status.success() {
207-
fatal_ProcRes("pretty-printed source does not typecheck".to_string(),
207+
fatal_proc_rec("pretty-printed source does not typecheck".to_string(),
208208
&proc_res);
209209
}
210210
if props.no_pretty_expanded { return }
211211

212212
// additionally, run `--pretty expanded` and try to build it.
213213
let proc_res = print_source(config, props, testfile, (*srcs.get(round)).clone(), "expanded");
214214
if !proc_res.status.success() {
215-
fatal_ProcRes(format!("pretty-printing (expanded) failed"), &proc_res);
215+
fatal_proc_rec(format!("pretty-printing (expanded) failed"), &proc_res);
216216
}
217217

218218
let ProcRes{ stdout: expanded_src, .. } = proc_res;
219219
let proc_res = typecheck_source(config, props, testfile, expanded_src);
220220
if !proc_res.status.success() {
221-
fatal_ProcRes(format!("pretty-printed source (expanded) does \
221+
fatal_proc_rec(format!("pretty-printed source (expanded) does \
222222
not typecheck"),
223223
&proc_res);
224224
}
@@ -326,7 +326,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
326326
// compile test file (it shoud have 'compile-flags:-g' in the header)
327327
let compiler_run_result = compile_test(config, props, testfile);
328328
if !compiler_run_result.status.success() {
329-
fatal_ProcRes("compilation failed!".to_string(), &compiler_run_result);
329+
fatal_proc_rec("compilation failed!".to_string(), &compiler_run_result);
330330
}
331331

332332
let exe_file = make_exe_name(config, testfile);
@@ -517,7 +517,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
517517
// compile test file (it shoud have 'compile-flags:-g' in the header)
518518
let compile_result = compile_test(config, props, testfile);
519519
if !compile_result.status.success() {
520-
fatal_ProcRes("compilation failed!".to_string(), &compile_result);
520+
fatal_proc_rec("compilation failed!".to_string(), &compile_result);
521521
}
522522

523523
let exe_file = make_exe_name(config, testfile);
@@ -560,7 +560,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
560560
let debugger_run_result = run_lldb(config, &exe_file, &debugger_script);
561561

562562
if !debugger_run_result.status.success() {
563-
fatal_ProcRes("Error while running LLDB".to_string(),
563+
fatal_proc_rec("Error while running LLDB".to_string(),
564564
&debugger_run_result);
565565
}
566566

@@ -720,7 +720,7 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String])
720720
}
721721
}
722722
if i != num_check_lines {
723-
fatal_ProcRes(format!("line not found in debugger output: {}",
723+
fatal_proc_rec(format!("line not found in debugger output: {}",
724724
check_lines.get(i).unwrap()),
725725
debugger_run_result);
726726
}
@@ -764,22 +764,22 @@ fn check_error_patterns(props: &TestProps,
764764
let missing_patterns =
765765
props.error_patterns.slice(next_err_idx, props.error_patterns.len());
766766
if missing_patterns.len() == 1u {
767-
fatal_ProcRes(format!("error pattern '{}' not found!",
767+
fatal_proc_rec(format!("error pattern '{}' not found!",
768768
missing_patterns[0]),
769769
proc_res);
770770
} else {
771771
for pattern in missing_patterns.iter() {
772772
error(format!("error pattern '{}' not found!", *pattern));
773773
}
774-
fatal_ProcRes("multiple error patterns not found".to_string(),
774+
fatal_proc_rec("multiple error patterns not found".to_string(),
775775
proc_res);
776776
}
777777
}
778778

779779
fn check_no_compiler_crash(proc_res: &ProcRes) {
780780
for line in proc_res.stderr.as_slice().lines() {
781781
if line.starts_with("error: internal compiler error:") {
782-
fatal_ProcRes("compiler encountered internal error".to_string(),
782+
fatal_proc_rec("compiler encountered internal error".to_string(),
783783
proc_res);
784784
}
785785
}
@@ -857,7 +857,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
857857
}
858858

859859
if !was_expected && is_compiler_error_or_warning(line) {
860-
fatal_ProcRes(format!("unexpected compiler error or warning: '{}'",
860+
fatal_proc_rec(format!("unexpected compiler error or warning: '{}'",
861861
line),
862862
proc_res);
863863
}
@@ -866,7 +866,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
866866
for (i, &flag) in found_flags.iter().enumerate() {
867867
if !flag {
868868
let ee = expected_errors.get(i);
869-
fatal_ProcRes(format!("expected {} on line {} not found: {}",
869+
fatal_proc_rec(format!("expected {} on line {} not found: {}",
870870
ee.kind, ee.line, ee.msg),
871871
proc_res);
872872
}
@@ -1047,7 +1047,7 @@ fn compose_and_run_compiler(
10471047
config.compile_lib_path.as_slice(),
10481048
None);
10491049
if !auxres.status.success() {
1050-
fatal_ProcRes(
1050+
fatal_proc_rec(
10511051
format!("auxiliary build of {} failed to compile: ",
10521052
abs_ab.display()),
10531053
&auxres);
@@ -1286,7 +1286,7 @@ fn error(err: String) { println!("\nerror: {}", err); }
12861286

12871287
fn fatal(err: String) -> ! { error(err); fail!(); }
12881288

1289-
fn fatal_ProcRes(err: String, proc_res: &ProcRes) -> ! {
1289+
fn fatal_proc_rec(err: String, proc_res: &ProcRes) -> ! {
12901290
print!("\n\
12911291
error: {}\n\
12921292
status: {}\n\
@@ -1562,35 +1562,35 @@ fn run_codegen_test(config: &Config, props: &TestProps,
15621562

15631563
let mut proc_res = compile_test_and_save_bitcode(config, props, testfile);
15641564
if !proc_res.status.success() {
1565-
fatal_ProcRes("compilation failed!".to_string(), &proc_res);
1565+
fatal_proc_rec("compilation failed!".to_string(), &proc_res);
15661566
}
15671567

15681568
proc_res = extract_function_from_bitcode(config, props, "test", testfile, "");
15691569
if !proc_res.status.success() {
1570-
fatal_ProcRes("extracting 'test' function failed".to_string(),
1570+
fatal_proc_rec("extracting 'test' function failed".to_string(),
15711571
&proc_res);
15721572
}
15731573

15741574
proc_res = disassemble_extract(config, props, testfile, "");
15751575
if !proc_res.status.success() {
1576-
fatal_ProcRes("disassembling extract failed".to_string(), &proc_res);
1576+
fatal_proc_rec("disassembling extract failed".to_string(), &proc_res);
15771577
}
15781578

15791579

15801580
let mut proc_res = compile_cc_with_clang_and_save_bitcode(config, props, testfile);
15811581
if !proc_res.status.success() {
1582-
fatal_ProcRes("compilation failed!".to_string(), &proc_res);
1582+
fatal_proc_rec("compilation failed!".to_string(), &proc_res);
15831583
}
15841584

15851585
proc_res = extract_function_from_bitcode(config, props, "test", testfile, "clang");
15861586
if !proc_res.status.success() {
1587-
fatal_ProcRes("extracting 'test' function failed".to_string(),
1587+
fatal_proc_rec("extracting 'test' function failed".to_string(),
15881588
&proc_res);
15891589
}
15901590

15911591
proc_res = disassemble_extract(config, props, testfile, "clang");
15921592
if !proc_res.status.success() {
1593-
fatal_ProcRes("disassembling extract failed".to_string(), &proc_res);
1593+
fatal_proc_rec("disassembling extract failed".to_string(), &proc_res);
15941594
}
15951595

15961596
let base = output_base_name(config, testfile);

branches/try2/src/doc/guide-ffi.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ extern crate libc;
476476
477477
#[cfg(target_os = "win32", target_arch = "x86")]
478478
#[link(name = "kernel32")]
479+
#[allow(non_snake_case_functions)]
479480
extern "stdcall" {
480481
fn SetEnvironmentVariableA(n: *u8, v: *u8) -> libc::c_int;
481482
}

branches/try2/src/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ let ys = xs;
11121112
11131113
xs = Nil;
11141114
1115-
// `xs` can't be used again
1115+
// `xs` can be used again
11161116
~~~
11171117

11181118
A destructor call will only occur for a variable that has not been moved from,

branches/try2/src/liballoc/arc.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@ impl<T: Send + Share + Clone> Arc<T> {
152152
#[inline]
153153
#[experimental]
154154
pub fn make_unique<'a>(&'a mut self) -> &'a mut T {
155-
if self.inner().strong.load(atomics::SeqCst) != 1 {
155+
// Note that we hold a strong reference, which also counts as
156+
// a weak reference, so we only clone if there is an
157+
// additional reference of either kind.
158+
if self.inner().strong.load(atomics::SeqCst) != 1 ||
159+
self.inner().weak.load(atomics::SeqCst) != 1 {
156160
*self = Arc::new(self.deref().clone())
157161
}
158162
// This unsafety is ok because we're guaranteed that the pointer
@@ -356,6 +360,20 @@ mod tests {
356360
assert!(*cow1 == *cow2);
357361
}
358362

363+
#[test]
364+
fn test_cowarc_clone_weak() {
365+
let mut cow0 = Arc::new(75u);
366+
let cow1_weak = cow0.downgrade();
367+
368+
assert!(75 == *cow0);
369+
assert!(75 == *cow1_weak.upgrade().unwrap());
370+
371+
*cow0.make_unique() += 1;
372+
373+
assert!(76 == *cow0);
374+
assert!(cow1_weak.upgrade().is_none());
375+
}
376+
359377
#[test]
360378
fn test_live() {
361379
let x = Arc::new(5);

0 commit comments

Comments
 (0)