c2rust
c2rust copied to clipboard
C2Rust transpiler emits features removed in recent nightlies
I'm experiencing difficulties in building the bzip2 project, which I have converted from C to Rust using C2Rust. The original bzip2 project is hosted on GitLab, and my converted version is on GitHub.
I am unable to build the converted project, hindering any further testing or development. Below are the details:
- Original Project: bzip2 original
- Converted Project: bzip2-c2rust
- Conversion Tool: C2Rust
Build Issues:
- The project fails to build after conversion.
- [Include specific error messages or issues encountered during the build process.]
Questions:
- Are there known challenges or common errors when building a C2Rust converted project?
- What steps can be taken to resolve build issues in a project converted from C to Rust?
- Are there specific configurations or adjustments needed for a successful build in such cases?
I would appreciate any guidance or suggestions to resolve these build issues. Thank you for your assistance.
Hi @SheldonHH
Thanks for your report, it would have been helpful if you'd directly included the build errors. This is what I see:
error[E0557]: feature has been removed
--> c2rust-lib.rs:8:12
|
8 | #![feature(const_raw_ptr_to_usize_cast)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ feature has been removed
|
= note: at compile-time, pointers do not have an integer value, so these casts cannot be properly supported
error[E0557]: feature has been removed
--> c2rust-lib.rs:12:12
|
12 | #![feature(main)]
| ^^^^ feature has been removed
error: cannot find attribute `main` in this scope
--> bzip2.rs:3164:3
|
3164 | #[main]
| ^^^^
|
= note: `main` is in scope, but it is a function, not an attribute
error: cannot find attribute `main` in this scope
--> bzip2recover.rs:590:3
|
590 | #[main]
| ^^^^
|
= note: `main` is in scope, but it is a function, not an attribute
It seems that C2Rust relies on features that are no longer in the latest nightlies. As a workaround, you can build with a much older nightly until you've patched the transpiled code to remove uses of the deprecated features. This works for me:
cargo +nightly-2020-03-21 build