Endle / rust-bundler-cp

rust-bundler-cp bundles a cargo package into a single rust file. It's designed for Competitive programming like Codeforces.
https://crates.io/crates/rust_bundler_cp
MIT License
17 stars 6 forks source link

Does not work with 2021 edition #34

Closed weezy20 closed 5 months ago

weezy20 commented 5 months ago

I get stderr: error[E0670]: `async fn` is not permitted in Rust 2015

Endle commented 5 months ago

Thank you for reporting it. Can you add a few more details so I can reproduce it?

weezy20 commented 5 months ago

I installed this and tried it on this repo : https://github.com/r0gue-io/pop-cli.

Endle commented 5 months ago

The reason is that rust-bundler-cp doesn't support cargo dependencies. I've updated readme

weezy20 commented 5 months ago

@Endle Any reason why?

Endle commented 5 months ago

rust-bundler-cp will not recursively load [dependencies] in Cargo.toml.

Can you share your use case for it?

weezy20 commented 5 months ago

I don't have a particular use case, just curious about what's possible. Since cargo dependencies are just extern crates, I could imagine a scenario where it would be possible but at the same time I also think that there are unseen challenges. I have been looking into various bundlers so that I could compile a single .rs file with all libraries linked to it, but yeah, it would be a lot of code duplication from cargo which is not trivial by any means.

Endle commented 5 months ago

Thanks for explanation. I haven't read the details of cargo design, but I think the logic for extern crates is not simple. It needs internet connection to crates.io and other repos, and do it recursively. It also solves conflicting versions. After solving, different crates will be compiled in parallel. I don't see benefit of not using cargo.

For this project, rust-bundler-cp, it targets a very specific scenario: competitive programming. These sites only allow a single file for submission. This is also the purpose for other bundlers mentioned in https://github.com/Endle/rust-bundler-cp?tab=readme-ov-file#similar-projects