Just supposing a major bug in an unmaintained Rust library happened

This is a kind of "thought experiment". I don't know the answer,.If you need to incorporate an "emergency fix" for an unmaintained crate, how do you go about it? To be specific, suppose I want to build an application using cargo, but I want to make one small change to a crates.io crate ( which may be a direct or indirect dependency ), how would I go about it? Or to put it another way, how would I "patch" crates.io in an emergency? Is there any way to express this in a cargo.toml file?

( I was thinking about this due to this post "Concerns on the Long Term Viability of Rust for Real World Applications" )

1 Like

Like this.

7 Likes

Thanks! I haven't read it too closely yet, it looks like the solution, but I never heard of that before. When did this become available?

Can't really tell since when has this been available, but after a quick search it seems that it was there since at least before 1.0 came out in 2015.

2 Likes

Could well be that [replace] is a pre-1.0 feature, but I definitely remember [patch] being introduced later (not that it matters so much). Did some digging and found it: Announcing Rust 1.21 | Rust Blog

5 Likes