@@ -39,40 +39,39 @@ fn find_rust_files(&files: [str], path: str) {
39
39
40
40
fn safe_to_steal_expr( e : @ast:: expr ) -> bool {
41
41
alt e. node {
42
+ /*
43
+ // For compiling (rather than pretty-printing)
44
+ // combination of https://github.com/graydon/rust/issues/924 with unwind hang?
45
+ ast::expr_ret(option::none.) { false }
46
+ */
42
47
43
- // https://github.com/graydon/rust/issues/890
44
- ast:: expr_lit ( lit) {
45
- alt lit. node {
46
- ast:: lit_str ( _) { true }
47
- ast:: lit_char ( _) { true }
48
- ast:: lit_int ( _) { false }
49
- ast:: lit_uint ( _) { true }
50
- ast:: lit_mach_int ( _, _) { false }
51
- ast:: lit_float ( _) { false }
52
- ast:: lit_mach_float ( _, _) { false }
53
- ast:: lit_nil. { true }
54
- ast:: lit_bool ( _) { true }
55
- }
56
- }
48
+ // If the fuzzer moves a block-ending-in-semicolon into callee position,
49
+ // the pretty-printer can't preserve this even by parenthesizing!!
50
+ // See email to marijn.
51
+ ast:: expr_if ( _, _, _) { false }
52
+ ast:: expr_block ( _) { false }
53
+ ast:: expr_alt ( _, _) { false }
54
+ ast:: expr_for ( _, _, _) { false }
55
+ ast:: expr_for_each ( _, _, _) { false }
56
+ ast:: expr_while ( _, _) { false }
57
57
58
- // https://github.com/graydon/rust/issues/890
58
+ // https://github.com/graydon/rust/issues/929
59
59
ast:: expr_cast ( _, _) { false }
60
60
ast:: expr_assert ( _) { false }
61
61
ast:: expr_binary ( _, _, _) { false }
62
62
ast:: expr_assign ( _, _) { false }
63
63
ast:: expr_assign_op ( _, _, _) { false }
64
64
65
- // https://github.com/graydon/rust/issues/764
66
65
ast:: expr_fail( option:: none. ) { false }
67
66
ast:: expr_ret( option:: none. ) { false }
68
67
ast:: expr_put( option:: none. ) { false }
69
68
70
- // These prefix-operator keywords are not being parenthesized when in callee positions.
71
- // https://github.com/graydon/rust/issues/891
72
- ast:: expr_ret ( _) { false }
73
- ast:: expr_put ( _) { false }
69
+ // https://github.com/graydon/rust/issues/927
70
+ //ast::expr_assert(_) { false }
74
71
ast:: expr_check ( _, _) { false }
75
- ast:: expr_log ( _, _) { false }
72
+
73
+ // https://github.com/graydon/rust/issues/928
74
+ //ast::expr_cast(_, _) { false }
76
75
77
76
_ { true }
78
77
}
@@ -138,7 +137,12 @@ fn replace_expr_in_crate(crate: ast::crate, i: uint, newexpr: ast::expr) ->
138
137
* j_ += 1 u;
139
138
if i_ + 1 u == * j_ && safe_to_replace_expr ( original) {
140
139
newexpr_
141
- } else { fold:: noop_fold_expr ( original, fld) }
140
+ } else {
141
+ alt ( original) {
142
+ ast:: expr_fail ( _) { original /* Don't replace inside fail: https://github.com/graydon/rust/issues/930 */ }
143
+ _ { fold : : noop_fold_expr ( original, fld) }
144
+ }
145
+ }
142
146
}
143
147
let afp =
144
148
{ fold_expr: bind fold_expr_rep ( j, i, newexpr. node , _, _)
@@ -253,50 +257,65 @@ fn check_whole_compiler(code: str, suggested_filename: str) {
253
257
}
254
258
255
259
fn check_whole_compiler_inner ( filename : str ) -> compile_result {
260
+ /*
256
261
let p = std::run::program_output(
257
262
"/Users/jruderman/code/rust/build/stage1/rustc",
258
263
["-c", filename]);
264
+ */
265
+
266
+ let p = std:: run:: program_output ( "bash" , [ "-c" , "DYLD_LIBRARY_PATH=/Users/jruderman/code/rust/build/stage0/lib:/Users/jruderman/code/rust/build/rustllvm/ /Users/jruderman/code/rust/build/stage1/rustc -c " + filename] ) ;
259
267
260
268
//log_err #fmt("Status: %d", p.status);
261
269
if p. err != "" {
262
270
if contains ( p. err , "May only branch on boolean predicates" ) {
263
271
known_bug ( "https://github.com/graydon/rust/issues/892" )
264
272
} else if contains ( p. err , "(S->getType()->isPointerTy() && \" Invalid cast\" )" ) {
265
273
known_bug ( "https://github.com/graydon/rust/issues/895" )
266
- } else if contains ( p. err , "Initializer type must match GlobalVariable type" ) {
267
- known_bug ( "https://github.com/graydon/rust/issues/899" )
268
274
} else if contains ( p. err , "(castIsValid(op, S, Ty) && \" Invalid cast!\" ), function Create" ) {
269
275
known_bug ( "https://github.com/graydon/rust/issues/901" )
270
276
} else {
271
277
log_err "Stderr: " + p. err ;
272
278
failed ( "Unfamiliar error message" )
273
279
}
274
- } else if p. status == 256 {
275
- if contains ( p. out , "Out of stack space, sorry" ) {
276
- known_bug ( "Recursive types - https://github.com/graydon/rust/issues/742" )
277
- } else {
278
- log_err "Stdout: " + p. out ;
279
- failed ( "Unfamiliar sudden exit" )
280
- }
281
- } else if p. status == 6 {
282
- if contains ( p. out , "get_id_ident: can't find item in ext_map" ) {
283
- known_bug ( "https://github.com/graydon/rust/issues/876" )
284
- } else if contains ( p. out , "Assertion !cx.terminated failed" ) {
285
- known_bug ( "https://github.com/graydon/rust/issues/893 or https://github.com/graydon/rust/issues/894" )
286
- } else if !contains ( p. out , "error:" ) {
287
- log_err "Stdout: " + p. out ;
288
- failed ( "Rejected the input program without a span-error explanation" )
289
- } else {
290
- passed ( "Rejected the input program cleanly" )
291
- }
292
- } else if p. status == 11 {
293
- failed ( "Crashed!?" )
294
280
} else if p. status == 0 {
295
281
passed ( "Accepted the input program" )
282
+ } else if contains ( p. out , "Out of stack space, sorry" ) {
283
+ known_bug ( "Recursive types - https://github.com/graydon/rust/issues/742" )
284
+ } else if contains ( p. out , "Assertion !cx.terminated failed" ) {
285
+ known_bug ( "https://github.com/graydon/rust/issues/893 or https://github.com/graydon/rust/issues/894" )
286
+ // } else if contains(p.out, "upcall fail 'non-exhaustive match failure', ../src/comp/middle/trans.rs") {
287
+ } else if contains ( p. out , "trans_rec expected a rec but found _|_" ) {
288
+ known_bug ( "https://github.com/graydon/rust/issues/924" )
289
+ } else if contains ( p. out , "Assertion failed: (alloc->magic == MAGIC)" ) {
290
+ known_bug ( "https://github.com/graydon/rust/issues/934" )
291
+ } else if contains ( p. out , "Assertion failed: (S->getType()->isPointerTy() && \" Invalid cast\" )" ) {
292
+ known_bug ( "https://github.com/graydon/rust/issues/935" )
293
+ } else if contains ( p. out , "Ptr must be a pointer to Val type" ) {
294
+ known_bug ( "https://github.com/graydon/rust/issues/897" )
295
+ } else if contains ( p. out , "Assertion" ) && contains ( p. out , "failed" ) {
296
+ log_err "Stdout: " + p. out ;
297
+ failed ( "Looks like an llvm assertion failure" )
298
+
299
+ } else if contains ( p. out , "internal compiler error fail called with unsupported type _|_" ) {
300
+ known_bug ( "https://github.com/graydon/rust/issues/930" )
301
+ } else if contains ( p. out , "internal compiler error Translating unsupported cast" ) {
302
+ known_bug ( "https://github.com/graydon/rust/issues/932" )
303
+ } else if contains ( p. out , "internal compiler error sequence_element_type called on non-sequence value" ) {
304
+ known_bug ( "https://github.com/graydon/rust/issues/931" )
305
+ } else if contains ( p. out , "internal compiler error bit_num: asked for pred constraint, found an init constraint" ) {
306
+ known_bug ( "https://github.com/graydon/rust/issues/933" )
307
+ } else if contains ( p. out , "internal compiler error unimplemented" ) {
308
+ known_bug ( "Something unimplemented" )
309
+ } else if contains ( p. out , "internal compiler error" ) {
310
+ log_err "Stdout: " + p. out ;
311
+ failed ( "internal compiler error" )
312
+
313
+ } else if contains ( p. out , "error:" ) {
314
+ passed ( "Rejected the input program cleanly" )
296
315
} else {
297
316
log_err p. status ;
298
317
log_err "!Stdout: " + p. out ;
299
- failed ( "Unfamiliar status code " )
318
+ failed ( "What happened? " )
300
319
}
301
320
}
302
321
@@ -317,7 +336,7 @@ fn content_is_dangerous_to_modify(code: str) -> bool {
317
336
let dangerous_patterns =
318
337
[ "#macro" , // not safe to steal things inside of it, because they have a special syntax
319
338
"#" , // strange representation of the arguments to #fmt, for example
320
- "tag" , // typeck hang: https://github.com/graydon/rust/issues/900
339
+ "tag" , // typeck hang: https://github.com/graydon/rust/issues/742 (from dup # 900)
321
340
" be " ] ; // don't want to replace its child with a non-call: "Non-call expression in tail call"
322
341
323
342
for p: str in dangerous_patterns { if contains ( code, p) { ret true ; } }
@@ -337,7 +356,7 @@ fn content_is_confusing(code: str) -> bool {
337
356
}
338
357
339
358
fn file_is_confusing ( filename : str ) -> bool {
340
- let confusing_files = [ ] ;
359
+ let confusing_files = [ "expr-alt.rs" ] ; // pretty-printing "(a = b) = c" vs "a = b = c" and wrapping
341
360
342
361
for f in confusing_files { if contains ( filename, f) { ret true ; } }
343
362
@@ -418,6 +437,7 @@ fn main(args: [str]) {
418
437
find_rust_files ( files, root) ;
419
438
check_convergence ( files) ;
420
439
check_variants ( files) ;
440
+
421
441
log_err "Fuzzer done" ;
422
442
}
423
443
0 commit comments