Skip to content

Releases: immunant/c2rust

v0.20.0

25 Feb 07:44
Compare
Choose a tag to compare

Significant Changes

  • (#1128, #1163) Fix fn compare_src_locs to use a valid total, transitive ordering

What's Changed

c2rust-transpile

  • transpile: don't assume macro invocations are whitespace-free by @fw-immunant in #1120
  • transpile: Make cast from bool to pointer compile through size_t by @GPHemsley in #1134
  • Fix segfault due to failing Expr classification by @thedataking in #1145
  • transpile: Rewrite fn compare_src_locs implementation to have a total order by @Kriskras99 in #1128
  • transpile: fix curl transpile breakage while maintaining a total SrcLoc order by @kkysen in #1163
  • transpile: emit zeroed array expressions as [0; N] by @folkertdev in #1170
  • transpile: fix previously ignored enum usage in compound literals by @Yeaseen in #1185
  • transpile: allow expressions in compound literals for structs by @Yeaseen in #1188
  • Fix proc macro punctuation panic by @fw-immunant in #1197
  • correctly construct _ as Ident rather than Punctuation by @chrysn in #1202
  • transpile: parenthesize subexpression of reference expressions if necessary by @fw-immunant in #1121

c2rust-analyze

Build Systems, CI, docs, etc.

New Contributors

Full Changelog: v0.19.0...v0.20.0

v0.19.0

01 Sep 20:26
b9339f4
Compare
Choose a tag to compare

What's Changed

  • (c2rust-analyze) Relax the transmutable checks from two-way to one-way, now allowing for arrays and slices to decay by @kkysen in #841
  • c2rust-analyze: initial implementation of error recovery by @spernsteiner in #876
  • analyze: preserve refs by @spernsteiner in #923
  • (c2rust-analyze/tests) Specify --edition 2021 for the tests, fixing issues with imports and core (#912) by @kkysen in #935
  • analyze: fix panic on addr_of!(...) as ... by @spernsteiner in #945
  • analyze: add function attrs for testing by @spernsteiner in #942
  • analyze: add support for some unsupported casts by @spernsteiner in #929
  • (c2rust-analyze) Support ptr-to-ptr casts between safely transmutable types, for now limited to same-sized integers by @kkysen in #839
  • analyze: refactor rewrite::apply by @spernsteiner in #937
  • analyze: new implementation of MIR-to-HIR rewrite lifting by @spernsteiner in #934
  • analyze: generate casts around call arguments and results by @spernsteiner in #936
  • (c2rust-analyze/tests) Enable transpiled string literals in tests by @kkysen in #955
  • Add hypothetical lifetime to structure rewrites with empty generic type parameter lists by @aneksteind in #956
  • rewrite: add #[derive(Clone)] test case by @aneksteind in #958
  • Update README.md to add compile_commands.json setup for meson by @orowith2os in #954
  • Fix the permissions of some scripts by @mjgarton in #962
  • Do not rewrite ADTs mentioned in extern blocks by @aneksteind in #960
  • Improve Fedora detection by @mjgarton in #963
  • mark extern block function signatures as FIXED by @aneksteind in #966
  • [c2rust-analyze] Run analysis on pdg input by @fw-immunant in #894
  • analyze: account for Spans indexing into aggregated sources, not individual files by @fw-immunant in #967
  • add test case showing #905 is resolved by @aneksteind in #970
  • analyze: README: fix invocation by @fw-immunant in #972
  • analyze: generate shims for calls from non-rewritten to rewritten code by @spernsteiner in #939
  • add support for emitting casts to and from *mut T and Cell by @aneksteind in #968
  • analyze: recover from failures in shim generation by @spernsteiner in #979
  • fix mismatch in number of origin parameters for cast result by @aneksteind in #976
  • (c2rust-analyze) Add known_fns! for declaring the permissions on ptrs in known (i.e. libc) UnknownDef fns by @kkysen in #978
  • (c2rust-analyze) Allow calls to UnknownDef KnownFns with known ptr perms by @kkysen in #980
  • (c2rust-analyze) Remove UNIQUE from initial ptr perms before asserting it's empty by @kkysen in #981
  • instrument: README: fix invocation by @fw-immunant in #973
  • (c2rust-analyze/tests) Add a generic extern "rust-intrinsic" foreign fn` test (currently disabled as we crash on it) by @kkysen in #1001
  • provide statics with hypothetical origins by @aneksteind in #975
  • fix subset relation comment between fn argument nested lifetimes by @aneksteind in #1003
  • analyze: don't add fields to adt_metadata_table by @spernsteiner in #1004
  • (c2rust-analyze) Add almost all libc KnownFns used in lighttpd_rust_amalgamated by @kkysen in #998
  • analyze: refactor struct and static rewrites by @spernsteiner in #1005
  • analyze: add extern statics to gacx.static_tys by @spernsteiner in #1008
  • Add hypothetical lifetime parameters and arguments to function signatures by @aneksteind in #1000
  • replace allow_unused with leading underscore for TyGenericParams by @aneksteind in #1011
  • add test for unions by @aneksteind in #1012
  • analyze: add DefId filter by @spernsteiner in #1014
  • analyze: omit unused hypothetical lifetimes during rewriting by @spernsteiner in #1015
  • handle deconstruct_hir_ty for function pointers by @aneksteind in #1019
  • Test.lighttpd.md5 by @aneksteind in #1020
  • analyze: fix deconstruct_hir_ty adt/path case by @spernsteiner in #1023
  • Support intermediate casts in calls. by @aneksteind in #1022
  • analyze: assign fresh PointerIds to Ref and AddressOf rvalues by @spernsteiner in #1028
  • analyze: add pointee_type analysis by @spernsteiner in #1029
  • dataflow: avoid propagating offset permissions upward from field access by @aneksteind in #1031
  • build(deps): bump rustix from 0.37.19 to 0.37.25 by @dependabot in #1032
  • fix typos by @not-my-profile in #1016
  • c2rust-analyze: Move all of main.rs to analyze.rs except for fn main by @kkysen in #1035
  • c2rust-analyze: Add a cargo wrapper by @kkysen in #1036
  • Support llvm 17.0.0 by @thedataking in #1041
  • analyze: memcpy/memset, void* rewrites, and other fixes for algo_md5 by @spernsteiner in #1043
  • LLVM17: Fix preprocessor expression in AstExporter.cpp by @thedataking in #1044
  • c2rust transpile: When casting bools to floats, go through the integral type u8 by @dgherzka in #1030
  • support c2rust <path/to/*.c> in lieu of compile_commands.json by @aneksteind in #1037
  • Fix nix build by @HKalbasi in #1047
  • analyze: borrowck: cache results of polonius runs on disk by @spernsteiner in #1056
  • build(deps): bump shlex from 1.1.0 to 1.3.0 by @dependabot in #1062
  • Add support for LLVM18 by @thedataking in #1067
  • analyze: CLI options by @spernsteiner in #1057
  • ast-exporter: use major, not full, version for clang resource dir by @fw-immunant in #1075
  • Demonstrate use of PDG from dynamic analysis in static analysis by @fw-immunant in #1069
  • c2rust transpile: Allow any integral types in init lists, not just char and int by @kkysen in #1076
  • analyze: add C2RUST_ANALYZE_NO_CARGO env var to disable cargo integration by @spernsteiner in #1070
  • analyze: emit inline annotations for debugging by @spernsteiner in #1071
  • analyze: track reasons why functions are not rewritten by @spernsteiner in #1072
  • analyze: add --rewrite-mode pointwise by @spernsteiner in #1073
  • Fix noop deref warning by @LegNeato in #1082
  • analyze: initial implementation of NON_NULL static analysis by @spernsteiner in #1081
  • analyze: add scripts for computing pointwise metrics by @spernsteiner in #1074
  • c2rust-transpile: only delete compile_commands.json if it was a temp file by @fw-immunant in #1079
  • analyze: uncomment line in scripts/run_pointwise_metrics.sh by @spernsteiner in #1087
  • analyze: allow overriding dataflow for specific permissions by @spernsteiner in #1088
  • Switch to crossbeam-queue for events by @ahomescu in #1091
  • analyze: add NON_NULL rewrites by @spernsteiner in #1095
  • Fix ordering of clang libs for static linking by @thedataking in #1100
  • analyze: support rewriting field projections on nullable pointers by @spernsteiner in #1096
  • Fix c2rust-analyze panic for variadic functions by @ahomescu in #1105
  • analyze: borrowck performance improvements by @spernst...
Read more

v0.18.0

22 May 20:16
Compare
Choose a tag to compare

In addition to lots of (still very WIP) progress towards our goal of automatic safening of c2rust's unsafe output, this release also includes:

  • a bug fix for compile_commands.json handling (3f4f128)
  • fixes for LLVM 17 and macOS 12 (e1043cd)
  • a crash fix for c2rust-ast-exporter (5b9800a)
  • fixes for unary operations with side effects (f9c5195)
  • compilation fixes for freebsd (abe22f6)
  • improved translation for else-if chains (d467a76)
  • transpilation fixes for many compiler builtins (5b097bb)

v0.17.0

01 Feb 21:52
Compare
Choose a tag to compare

This is our first release in a while, and includes many fixes and small improvements from the community. While most of our efforts on C2Rust are focused on working towards tools for lifting C2Rust's unsafe output into safe Rust (which is not yet polished enough for release), there have still been quite a few changes since the last release.

Significant changes:

  • various CLI improvements (#777, #703, #579)
  • fixes for Apple Silicon macs (#711)
  • basic RISC-V vector type support (#693)
  • LLVM 15 support (#677)
  • improvements to va_copy handling (#612)
  • permit translation of wrapping arithmetic ops in constant contexts (#528)
  • remove c2rust-macros (#527)
  • handle more non-UTF8 system paths (#519)
  • preserving C label names (#415)
  • various inline asm fixes (#405, #404)

v0.16.0 - C2Rust builds with stable Rust

12 May 18:55
Compare
Choose a tag to compare

C2Rust now uses the syn crate for Rust AST construction, which means we no longer depend on rustc compiler internals and can build with a stable Rust toolchain! Huge thanks to @fw-immunant for all the hard work involved in decoupling the transpiler from Rust internals.

In the process, we've added support for transpiling C inline assembly to stable Rust asm! blocks. C2Rust also now supports building against newer LLVM versions (up to version 13). Unfortunately we have not yet re-implemented translation of C comments into Rust using the new AST framework, but expect that to be fixed soon!

As part of moving away from compiler internals, we have deprecated the refactoring engine and cross-checks. Source code for the refactoring engine is still available in tree, but you may encounter issues trying to use it and we're not planning to put any substantial effort in that direction in the near future.

Other changes:

  • Fix packed unions: #347 (thanks @chrysn)
  • Preserve attributes on non-canonical declarations: #385
  • Include git commit info in --version: #394
  • Fix tinycbor build in recurive make: #396
  • Project was re-formatted with rustfmt
  • Updated most crate dependencies to their latest versions

Maintenance Release

14 Feb 18:06
Compare
Choose a tag to compare
Maintenance Release Pre-release
Pre-release

This is just a current snapshot, nothing major to see here. New and exciting things are just around the corner!

Maintenance Update

21 Oct 00:26
Compare
Choose a tag to compare

This release rolls up various maintenance and adds support for a few new
language features. C2Rust now supports LLVM 10.

Other changes:

  • Improved refactoring: reorg now reorganizes (approximately) 100% better, lua script support is now more robust, and refactoring correctly handles #[cfg] annotations in the input Rust code.
  • --preserve-unused-functions added to c2rust transpile. This option preserves all functions, regardless of usage in the program. Only turn this on if you know you need it! Thanks to @chrysn for this new feature.
  • @chrysn added support for AAPCSABIBuiltinVaList. Thanks again!

C Declaration Linking in Rust

19 Dec 00:34
652104a
Compare
Choose a tag to compare

C2Rust now merges header declarations and imports them with proper Rust use statements instead of duplicating header items in every file. To take advantage of this new feature, you will need to transpile with --emit-build-files. See our blog post for a deep dive into how this works.

This release updates C2Rust to use rustc nightly-2019-12-05, so be sure to install with cargo +nightly-2019-12-05 install c2rust.

Other changes:

  • Updating to nightly-2019-12-05 fixes a compiler bug that was sometimes triggered by transpiled code.
  • Added support for AArch64 variadic function definitions.
  • Added experimental refactoring support for rewriting parameters and locals from raw pointers into safe Rust types.
  • Fixed infinite loop in const C macro expansion.
  • Significant improvements to the Lua refactoring API: Reading and writing fields is now supported for all AST nodes through auto-generated Lua bindings.
  • LLVM 9 support

v0.12.0 - Variadics support

23 Aug 00:42
Compare
Choose a tag to compare

This release improves support for translating variadic functions. C2Rust now supports translation of va_start, va_end, and va_copy into equivalent Rust APIs.

v0.11.0

15 Aug 00:15
Compare
Choose a tag to compare

We've made some significant improvements, so it's past time for a new crates.io release. C2Rust now requires nightly 2019-06-22, so install with cargo +nightly-2019-06-22 install c2rust.

Changes:

  • Update to nightly 2019-06-22 (needed for va_copy support)
  • Improved support for flexible array members
  • Better error messages
  • Translate constant expression C macros to Rust const globals
  • Improved support for inline assembly
  • Support GNU __builtin_choose_expr
  • Support K&R style C function pointers (unspecified arguments)
  • Improve module reorganization (consolidating duplicate header items across modules)
  • Speed up refactoring
  • Expanded Lua refactoring script API
  • Update to using c2rust-bitfields 0.2.0
  • Preserve comments during translation
  • Add support for translating multiple binaries in the same project
  • More refactoring capabilities