You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[idea] Add an option put the metadata in a separate file #57076
When -Zsplit-metadata is passed to rustc, it will put the metadata normally inside a rlib or dylib in a separate rmeta file. The rlib/dylib will contain the SVH to prevent accidentally mixing the rmeta and rlib/dylib of different compilations.
Advantages
This would make the increase in size of #56987 easily fixable by deleting the rlib files, while keeping the rmeta files. Those are not necessary anyway, because rustc_driver.so already contains the code.
This will decrease staticlib, dylib and cdylib compilation time, because there is no need to copy all object files to a new archive to remove the rust.metadata.bin file from the rlib.
changed the title [-]Add an option put the metadata in a separate file[/-][+][idea] Add an option put the metadata in a separate file[/+]on Dec 23, 2018
If I understand this correctly, an another advantage is that we'd get a cargo check done for free when we do cargo {build, run, test}, which might speed up some workflows (no need to generate separate .rmeta for deps).
If this is accepted rust-lang/cargo#4831 could be done without invoking rustc twice. Just let rustc print a message when the metadata file is emitted and allow it to read .rmeta files before the .rlib file is ready. When a crate is built which needs to run the linker (dylib or bin) either cargo or rustc could wait till all necessary .rlib files are generated.
Activity
[-]Add an option put the metadata in a separate file[/-][+][idea] Add an option put the metadata in a separate file[/+]Xanewok commentedon Dec 28, 2018
If I understand this correctly, an another advantage is that we'd get a
cargo checkdone for free when we docargo {build, run, test}, which might speed up some workflows (no need to generate separate.rmetafor deps).bjorn3 commentedon Dec 28, 2018
@Xanewok If I read rust-lang/cargo#3501 correctly, it is technically possible to do so already, but cargo doesn't support it.
bjorn3 commentedon Dec 28, 2018
If this is accepted rust-lang/cargo#4831 could be done without invoking rustc twice. Just let rustc print a message when the metadata file is emitted and allow it to read
.rmetafiles before the.rlibfile is ready. When a crate is built which needs to run the linker (dyliborbin) either cargo or rustc could wait till all necessary.rlibfiles are generated.steveklabnik commentedon Nov 13, 2019
Triage: no real changes; sort of a duplicate of the cargo ticket, kinda.
Auto merge of rust-lang#120855 - bjorn3:split_metadata4, r=<try>
Auto merge of rust-lang#137535 - Kobzol:split-metadata, r=petrochenkov
Auto merge of #137535 - Kobzol:split-metadata, r=petrochenkov