Find out the current version of the box from the pile?

I am working on an extended obsolescence flag that can decide if something already exists or will become obsolete. However, one problem remains: in the boxes there is no version information. I know that I can get the current version of Crate using some environment variable that the load will set, but this is not enough to distinguish the outdated parts of the dependencies.

I can at least get the current mailbox path through ctx.sess.local_crate_source_file (as in fhahn current PR .

Thus, the ban on obtaining the path to the file and searching and parsing Cargo.lock manually (which I consider fragile and hacky), is there a way to get the version numbers of the dependencies, and if so, how?

+5
source share
1 answer

Use #[deprecated] instead, see Rust lang rfc 1270 for documentation. It is stable with Rust 1.9. Then the compiler does the job you want to create.

Instead, the way to implement what you asked for without touching the compiler or using the compiler function is to include the version in the box of your public API and use it from your string.

0
source

Source: https://habr.com/ru/post/1240881/


All Articles