How to get path to extern .rlib from Cargo?


I’m trying to get compilefail-rs working with my project. Current problem is that compilefail-rs calls rustc by itself and Cargo generates many targets named “package_name-.rlib”, so it’s not sufficient to give rustc path to directory with dependencies — it still can’t find or choose right one.

Is there way to get actual .rlib/.dylib path used by Cargo for dependency?

As far as I understand from Cargo source, hash part of target file name is just result of built-in derived Hash implementation for Unit struct, so it’s hard to reproduce in my own code. The only hope is that Cargo may be used as library (if it cannot be — why? anyway, hash may vary from version to version, which is blocker) or it has some hidden command dumping this hashes out.