Skip to content

Commit 1258299

Browse files
authored
Merge pull request #374 from apiraino/add-example
Add another example for hanging compilation
2 parents 9b5c04f + c1f218b commit 1258299

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

guide/src/examples/slow.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,21 @@ cargo-bisect-rustc --start=2021-09-01 --end=2021-10-02 --timeout 30 -- build --r
2929
You may need to adjust the timeout value based on the speed of your system.
3030

3131
> **Note**: `--timeout` is currently not working on macOS. See <https://github.com/rust-lang/cargo-bisect-rustc/issues/232>.
32+
33+
In some cases bisecting if a timeout happens is not enough, there might also be a compilation error (see for example [rustc#139197](https://github.com/rust-lang/rust/issues/139197)). In this case the script should handle all the work, here's a Bash example (given `main.rs` is the Rust code to reproduce the hanging compilation):
34+
```sh
35+
#!/bin/bash
36+
res=$( timeout 3 rustc main.rs )
37+
if [ "$?" -eq 124 ]; then
38+
# Excessive compile time
39+
exit 1
40+
else
41+
# Compilation fails as expected *but* it doesn't hang
42+
exit 0
43+
fi
44+
```
45+
46+
and then run (example):
47+
```sh
48+
cargo-bisect-rustc [...params...] --script test.sh
49+
```

0 commit comments

Comments
 (0)