@@ -85,6 +85,7 @@ fn compile_input(session.session sess,
85
85
bool save_temps ,
86
86
trans. output_type ot ,
87
87
bool time_passes ,
88
+ bool run_typestate ,
88
89
vec[ str] library_search_paths ) {
89
90
auto def = tup ( 0 , 0 ) ;
90
91
auto p = parser. new_parser ( sess, env, def, input, 0 u) ;
@@ -106,8 +107,10 @@ fn compile_input(session.session sess,
106
107
crate = typeck_result. _0 ;
107
108
auto type_cache = typeck_result. _1 ;
108
109
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
+ }
111
114
112
115
time[ ( ) ] ( time_passes, "translation" ,
113
116
bind trans. trans_crate ( sess, crate , ty_cx, type_cache, output, shared,
@@ -140,6 +143,7 @@ options:
140
143
-c compile and assemble, but do not link
141
144
--save-temps write intermediate files in addition to normal output
142
145
--time-passes time the individual phases of the compiler
146
+ --no-typestate don't run the typestate pass (unsafe!)
143
147
-h display this message\n \n " ) ;
144
148
}
145
149
@@ -170,7 +174,7 @@ fn main(vec[str] args) {
170
174
optflag ( "O" ) , optflag ( "shared" ) , optmulti ( "L" ) ,
171
175
optflag ( "S" ) , optflag ( "c" ) , optopt ( "o" ) ,
172
176
optflag ( "save-temps" ) , optflag ( "time-passes" ) ,
173
- optflag ( "noverify" ) ) ;
177
+ optflag ( "no-typestate" ) , optflag ( " noverify") ) ;
174
178
auto binary = _vec. shift [ str] ( args) ;
175
179
auto match;
176
180
alt ( GetOpts . getopts ( args, opts) ) {
@@ -201,6 +205,7 @@ fn main(vec[str] args) {
201
205
// FIXME: Maybe we should support -O0, -O1, -Os, etc
202
206
auto optimize = opt_present ( match , "O" ) ;
203
207
auto time_passes = opt_present ( match , "time-passes" ) ;
208
+ auto run_typestate = !opt_present ( match , "no-typestate" ) ;
204
209
auto n_inputs = _vec. len [ str] ( match . free) ;
205
210
206
211
if ( glue) {
@@ -233,12 +238,14 @@ fn main(vec[str] args) {
233
238
auto ofile = _str. concat ( parts) ;
234
239
compile_input ( sess, env, ifile, ofile, shared,
235
240
optimize, verify, save_temps, ot,
236
- time_passes, library_search_paths) ;
241
+ time_passes, run_typestate,
242
+ library_search_paths) ;
237
243
}
238
244
case ( some[ str] ( ?ofile) ) {
239
245
compile_input ( sess, env, ifile, ofile, shared,
240
246
optimize, verify, save_temps, ot,
241
- time_passes, library_search_paths) ;
247
+ time_passes, run_typestate,
248
+ library_search_paths) ;
242
249
}
243
250
}
244
251
}
0 commit comments