c2rust
c2rust copied to clipboard
Allow `c2rust transpile` to accept a single C file without a `compile_commands.json`
We already support adding compiler flags to a transpiler run, so we can do without compile_commands.json if we're doing a one-off translation of a single file.
That would be great. I assumed c2rust command would behave like cc or bindgen and was utterly confused by the errors it reported.
intercept-build command requires Python, which is a major pain.
An example 1-file commands.json in the repo would be very useful, so that I could fudge it to refer to whatever file I need. When migrating projects the first thing I do is moving to build.rs and Rust's cc crate to build my C code, which ironically makes intercept-build unusable. When migrating C projects I always want to migrate them file by file, not the whole thing at once.
intercept-buildcommand requires Python, which is a major pain.
bear is written in C++ now; you could try that. That's usually what I use.
An example 1-file commands.json in the repo would be very useful, so that I could fudge it to refer to whatever file I need. When migrating projects the first thing I do is moving to
build.rsand Rust'scccrate to build my C code, which ironically makes c2rust unusable. When migrating C projects I always want to migrate them file by file, not the whole thing at once.
c2rust allows you to transpile the whole project at once since the semantics should be identical, and then refactor to safe Rust file by file, or whatever granularity you want. That way you don't have to deal with mixing C and Rust at any point, just C-like unsafe and C ABI Rust and idiomatic Rust.
@kkysen I think this is a very reasonable request. Happy to brainstorm with you or review a PR that lifts the requirement to provide compile_commands.json. We need to make sure that we do not attempt to emit Rust unless all included files were found.