Skip to content

Commit ccfe4d2

Browse files
committed
---
yaml --- r: 2281 b: refs/heads/master c: 9aeb679 h: refs/heads/master i: 2279: 9c2db4a v: v3
1 parent aa05030 commit ccfe4d2

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 648c4ae2ba0dc44284112fd91544cda598ce0603
2+
refs/heads/master: 9aeb67987c93c611be7e74b39630dd81c57acefb

trunk/Makefile.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ endif
2727
ifdef TIME_PASSES
2828
CFG_RUSTC_FLAGS += --time-passes
2929
endif
30+
ifdef NO_TYPESTATE
31+
CFG_RUSTC_FLAGS += --no-typestate
32+
endif
3033

3134
# On Darwin, we need to run dsymutil so the debugging information ends
3235
# up in the right place. On other platforms, it automatically gets

trunk/src/comp/driver/rustc.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ fn compile_input(session.session sess,
8585
bool save_temps,
8686
trans.output_type ot,
8787
bool time_passes,
88+
bool run_typestate,
8889
vec[str] library_search_paths) {
8990
auto def = tup(0, 0);
9091
auto p = parser.new_parser(sess, env, def, input, 0u);
@@ -106,8 +107,10 @@ fn compile_input(session.session sess,
106107
crate = typeck_result._0;
107108
auto type_cache = typeck_result._1;
108109

109-
crate = time[@ast.crate](time_passes, "typestate checking",
110-
bind typestate_check.check_crate(crate));
110+
if (run_typestate) {
111+
crate = time[@ast.crate](time_passes, "typestate checking",
112+
bind typestate_check.check_crate(crate));
113+
}
111114

112115
time[()](time_passes, "translation",
113116
bind trans.trans_crate(sess, crate, ty_cx, type_cache, output, shared,
@@ -140,6 +143,7 @@ options:
140143
-c compile and assemble, but do not link
141144
--save-temps write intermediate files in addition to normal output
142145
--time-passes time the individual phases of the compiler
146+
--no-typestate don't run the typestate pass (unsafe!)
143147
-h display this message\n\n");
144148
}
145149

@@ -170,7 +174,7 @@ fn main(vec[str] args) {
170174
optflag("O"), optflag("shared"), optmulti("L"),
171175
optflag("S"), optflag("c"), optopt("o"),
172176
optflag("save-temps"), optflag("time-passes"),
173-
optflag("noverify"));
177+
optflag("no-typestate"), optflag("noverify"));
174178
auto binary = _vec.shift[str](args);
175179
auto match;
176180
alt (GetOpts.getopts(args, opts)) {
@@ -201,6 +205,7 @@ fn main(vec[str] args) {
201205
// FIXME: Maybe we should support -O0, -O1, -Os, etc
202206
auto optimize = opt_present(match, "O");
203207
auto time_passes = opt_present(match, "time-passes");
208+
auto run_typestate = !opt_present(match, "no-typestate");
204209
auto n_inputs = _vec.len[str](match.free);
205210

206211
if (glue) {
@@ -233,12 +238,14 @@ fn main(vec[str] args) {
233238
auto ofile = _str.concat(parts);
234239
compile_input(sess, env, ifile, ofile, shared,
235240
optimize, verify, save_temps, ot,
236-
time_passes, library_search_paths);
241+
time_passes, run_typestate,
242+
library_search_paths);
237243
}
238244
case (some[str](?ofile)) {
239245
compile_input(sess, env, ifile, ofile, shared,
240246
optimize, verify, save_temps, ot,
241-
time_passes, library_search_paths);
247+
time_passes, run_typestate,
248+
library_search_paths);
242249
}
243250
}
244251
}

0 commit comments

Comments
 (0)