When you change the normal libc dependency in your manifest, it only affects your own use. Other crates in your dependency tree may still use the libc from crates.io, distinct from yours. Using overrides as documented above will affect everything.
Thanks for pointing out the document, it is very useful.
I added “libc = { path = “…/libc” }” to the field [patch.crates-io] in rust’s Cargo.toml, and I do see the building is using my local code, but I am seeing this error at the stage building rustc_msan:
error: the feature cfg_target_vendor has been stable since 1.33.0 and no longer requires an attribute to enable
–> /home/bpang/myrust/libc/src/lib.rs:22:13
|
22 | feature(cfg_target_vendor, link_cfg, no_core)
| ^^^^^^^^^^^^^^^^^
|
= note: -D stable-features implied by -D warnings
$ # edit Cargo.toml in rust to contain this line in field [patch.crates-io]:
libc = {path = “…/libc” }
$ ./x.py build
Then the erros appear:
error: the feature cfg_target_vendor has been stable since 1.33.0 and no longer requires an attribute to enable
–> /home/bpang/rust_ref/libc/src/lib.rs:22:13
|
22 | feature(cfg_target_vendor, link_cfg, no_core)
| ^^^^^^^^^^^^^^^^^
|
= note: -D stable-features implied by -D warnings