Repository: kpcyrd/sn0int (language: rust)

Issue:
Release build hangs forever due to LTO
After some troubleshooting it seems the release build hangs forever during lto:
```
 INFO 2019-02-23T14:19:15Z: rustc_codegen_llvm::back::lto: 1470 symbols to preserve in this crate
 INFO 2019-02-23T14:19:15Z: rustc_codegen_llvm::back::lto: going for that thin, thin LTO
 INFO 2019-02-23T14:19:15Z: rustc_codegen_llvm::back::lto: local module: 0 - sn0int.15aj1zuq-cgu.5
 INFO 2019-02-23T14:19:15Z: rustc_codegen_llvm::back::lto: local module: 1 - sn0int.15aj1zuq-cgu.0
 INFO 2019-02-23T14:19:16Z: rustc_codegen_llvm::back::lto: local module: 2 - sn0int.15aj1zuq-cgu.15
 INFO 2019-02-23T14:19:16Z: rustc_codegen_llvm::back::lto: local module: 3 - sn0int.15aj1zuq-cgu.10
 INFO 2019-02-23T14:19:16Z: rustc_codegen_llvm::back::lto: local module: 4 - sn0int.15aj1zuq-cgu.3
 INFO 2019-02-23T14:19:16Z: rustc_codegen_llvm::back::lto: local module: 5 - sn0int.15aj1zuq-cgu.6
 INFO 2019-02-23T14:19:17Z: rustc_codegen_llvm::back::lto: local module: 6 - sn0int.15aj1zuq-cgu.1
 INFO 2019-02-23T14:19:17Z: rustc_codegen_llvm::back::lto: local module: 7 - sn0int.15aj1zuq-cgu.12
 INFO 2019-02-23T14:19:17Z: rustc_codegen_llvm::back::lto: local module: 8 - sn0int.15aj1zuq-cgu.14
 INFO 2019-02-23T14:19:17Z: rustc_codegen_llvm::back::lto: local module: 9 - sn0int.15aj1zuq-cgu.4
 INFO 2019-02-23T14:19:18Z: rustc_codegen_llvm::back::lto: local module: 10 - sn0int.15aj1zuq-cgu.2
 INFO 2019-02-23T14:19:18Z: rustc_codegen_llvm::back::lto: local module: 11 - sn0int.15aj1zuq-cgu.7
 INFO 2019-02-23T14:19:18Z: rustc_codegen_llvm::back::lto: local module: 12 - sn0int.15aj1zuq-cgu.9
 INFO 2019-02-23T14:19:18Z: rustc_codegen_llvm::back::lto: local module: 13 - sn0int.15aj1zuq-cgu.13
 INFO 2019-02-23T14:19:18Z: rustc_codegen_llvm::back::lto: local module: 14 - sn0int.15aj1zuq-cgu.11
 INFO 2019-02-23T14:19:18Z: rustc_codegen_llvm::back::lto: local module: 15 - sn0int.15aj1zuq-cgu.8
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto: thin LTO data created
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto: thin LTO import map loaded
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto: checking which modules can be-reused and which have to be re-optimized.
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.5: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.0: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.15: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.10: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.3: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.6: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.1: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.12: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.14: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.4: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.2: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.7: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.9: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.13: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.11: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.8: re-compiled
 INFO 2019-02-23T14:19:20Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.3
 INFO 2019-02-23T14:19:20Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.2
 INFO 2019-02-23T14:19:20Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.0
 INFO 2019-02-23T14:19:20Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.1
 INFO 2019-02-23T14:19:42Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.6
 INFO 2019-02-23T14:19:48Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.5
 INFO 2019-02-23T14:20:02Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.4
 INFO 2019-02-23T14:20:03Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.8
 INFO 2019-02-23T14:20:09Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.10
 INFO 2019-02-23T14:20:18Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.14
 INFO 2019-02-23T14:20:19Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.15
 INFO 2019-02-23T14:20:28Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.9
 INFO 2019-02-23T14:20:32Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.13
 INFO 2019-02-23T14:20:34Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.11
 INFO 2019-02-23T14:20:38Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.12
 INFO 2019-02-23T14:20:43Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.7
```

The solution is building with lto disabled:
```
RUSTFLAGS="-C lto=no" cargo build --release
```

This issue has been reproduced with:
- rustc 1.32.0 (9fda7c223 2019-01-16)
- rustc 1.34.0-nightly (e1c6d0057 2019-02-22)

This seems to be a rust/llvm issue, trying to disable lto in the `Cargo.toml` didn't work though:
```
[profile.release]
lto = false
```


Discussion / hints:
There is a workaround in place since a22caa4 so the release build is closer to the debug build. The underlying issue is still unresolved though.

Fix patch:
diff --git a/Cargo.toml b/Cargo.toml
index 3e4c548c..4b802b3a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,13 +9,6 @@ categories = ["command-line-utilities"]
 readme = "README.md"
 edition = "2018"
 
-[profile.release]
-# skip lto to avoid compiler bug:
-# https://github.com/kpcyrd/sn0int/issues/77
-# https://github.com/rust-lang/rust/issues/58674
-opt-level = 1
-lto = false
-
 [badges]
 travis-ci = { repository = "kpcyrd/sn0int" }
 


Test patch: