thepowersgang / mrustc

Alternative rust compiler (re-implementation)
MIT License
2.17k stars 110 forks source link

Use mrustc instead of rustc with cargo #335

Open HKalbasi opened 5 days ago

HKalbasi commented 5 days ago

I want to build a cargo project, using mrustc for compiling a single crate and rustc for the rest. Is it possible? I'm open to using hacks, for example renaming mrustc to rustc and putting it in PATH.

bjorn3 commented 5 days ago

It looks like mrustc has a different cli (which would be fixable using a shim between cargo and mrustc). In addition it doesn't look like it has an option to write the crate metadata in a separate file from the rlib, which cargo always does for pipelined compilation, so you may need to copy the .rlib file produced by mrustc to the location where cargo expects the .rmeta file in the shim. You also need to handle the various --print commands cargo uses for learning information about the target like expected filenames for various types of files in the shim itself instead.

thepowersgang commented 5 days ago

mrustc for one crate is interesting... and probably not possible, given that mrustc's metadata is completely different to rustc's.

For a whole project - cargo vendor and minicargo is the way to go.