Skip to content

Commit 9d19215

Browse files
committed
---
yaml --- r: 30392 b: refs/heads/incoming c: 14303ba h: refs/heads/master v: v3
1 parent a03e777 commit 9d19215

File tree

5 files changed

+60
-22
lines changed

5 files changed

+60
-22
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: c21b3ff81847e9c9bcce83f961dffa385fa059ae
9+
refs/heads/incoming: 14303bad89a049b5ca54ad49b4f4ccff7a06b85f
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/rustc/driver/driver.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,10 @@ fn build_session_options(binary: ~str,
514514
link::output_type_llvm_assembly | link::output_type_assembly => (),
515515
_ => debugging_opts |= session::no_asm_comments
516516
}
517-
let opt_level =
518-
if opt_present(matches, ~"O") {
517+
let opt_level = {
518+
if (debugging_opts & session::no_opt) != 0 {
519+
No
520+
} else if opt_present(matches, ~"O") {
519521
if opt_present(matches, ~"opt-level") {
520522
early_error(demitter, ~"-O and --opt-level both provided");
521523
}
@@ -531,7 +533,8 @@ fn build_session_options(binary: ~str,
531533
~"to be between 0-3")
532534
}
533535
}
534-
} else { No };
536+
} else { No }
537+
};
535538
let target =
536539
match target_opt {
537540
None => host_triple(),

branches/incoming/src/rustc/driver/session.rs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,26 @@ type config =
3838
uint_type: uint_ty,
3939
float_type: float_ty};
4040

41-
const ppregions: uint = 1u;
42-
const time_passes: uint = 2u;
43-
const count_llvm_insns: uint = 4u;
44-
const time_llvm_passes: uint = 8u;
45-
const trans_stats: uint = 16u;
46-
const no_asm_comments: uint = 32u;
47-
const no_verify: uint = 64u;
48-
const trace: uint = 128u;
41+
const ppregions: uint = 1 << 0;
42+
const time_passes: uint = 1 << 1;
43+
const count_llvm_insns: uint = 1 << 2;
44+
const time_llvm_passes: uint = 1 << 3;
45+
const trans_stats: uint = 1 << 4;
46+
const no_asm_comments: uint = 1 << 5;
47+
const no_verify: uint = 1 << 6;
48+
const trace: uint = 1 << 7;
4949
// FIXME (#2377): This exists to transition to a Rust crate runtime
5050
// It should be removed
51-
const no_rt: uint = 256u;
52-
const coherence: uint = 512u;
53-
const borrowck_stats: uint = 1024u;
54-
const borrowck_note_pure: uint = 2048;
55-
const borrowck_note_loan: uint = 4096;
56-
const no_landing_pads: uint = 8192;
57-
const debug_llvm: uint = 16384;
58-
const count_type_sizes: uint = 32768;
59-
const meta_stats: uint = 65536;
51+
const no_rt: uint = 1 << 8;
52+
const coherence: uint = 1 << 9;
53+
const borrowck_stats: uint = 1 << 10;
54+
const borrowck_note_pure: uint = 1 << 11;
55+
const borrowck_note_loan: uint = 1 << 12;
56+
const no_landing_pads: uint = 1 << 13;
57+
const debug_llvm: uint = 1 << 14;
58+
const count_type_sizes: uint = 1 << 15;
59+
const meta_stats: uint = 1 << 16;
60+
const no_opt: uint = 1 << 17;
6061

6162
fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
6263
~[(~"ppregions", ~"prettyprint regions with \
@@ -82,7 +83,8 @@ fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
8283
(~"debug-llvm", ~"enable debug output from LLVM", debug_llvm),
8384
(~"count-type-sizes", ~"count the sizes of aggregate types",
8485
count_type_sizes),
85-
(~"meta-stats", ~"gather metadata statistics", meta_stats)
86+
(~"meta-stats", ~"gather metadata statistics", meta_stats),
87+
(~"no-opt", ~"do not optimize, even if -O is passed", no_opt),
8688
]
8789
}
8890

branches/incoming/src/rustc/middle/trans/datum.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ impl Datum {
241241

242242
let _icx = bcx.insn_ctxt("copy_to");
243243

244+
if ty::type_is_nil(self.ty) || ty::type_is_bot(self.ty) {
245+
return bcx;
246+
}
247+
244248
debug!("copy_to(self=%s, action=%?, dst=%s)",
245249
self.to_str(bcx.ccx()), action, bcx.val_str(dst));
246250

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// compile-flags:-Z no-opt
2+
use comm::*;
3+
4+
// This test has to be setup just so to trigger
5+
// the condition which was causing us a crash.
6+
// The situation is that we are capturing a
7+
// () value by ref. We generally feel free,
8+
// however, to substitute NULL pointers and
9+
// undefined values for values of () type, and
10+
// so this caused a segfault when we copied into
11+
// the closure.
12+
//
13+
// The fix is just to not emit any actual loads
14+
// or stores for copies of () type (which is of
15+
// course preferable, as the value itself is
16+
// irrelevant).
17+
18+
fn foo(&&x: ()) -> Port<()> {
19+
let p = Port();
20+
let c = Chan(p);
21+
do task::spawn() |copy c, copy x| {
22+
c.send(x);
23+
}
24+
p
25+
}
26+
27+
fn main() {
28+
foo(()).recv()
29+
}

0 commit comments

Comments
 (0)