Releases: immunant/c2rust
v0.22.1
v0.22.0
What's Changed
- Update c2rust-refactor to nightly-2022-08-08 by @ahomescu in #1328
- refactor: fix some
Cargo.tomlthings by @kkysen in #1404 - refactor: set
rustc_private = trueinCargo.tomlforrust-analyzerby @kkysen in #1406 - README: Update acknowledgements by @thedataking in #1413
- ast-exporter: fix crash on cast of empty initializer by @fw-immunant in #1412
- transpile: tests: specify
--edition 2021forrustfmt, too by @kkysen in #1409 - bitfields-derive: strip
::prefix from type if present by @Rua in #1411 - fix removing literal suffixes from vec![10u32, 20u32, 30u32] by @oinoom in #1368
- Fix the reorganize_definitions refactoring by @ahomescu in #1364
- transpile: search for
llvm-config-21andllvm-config-20by @kkysen in #1415 - ci: keep
RUSTFLAGSconsistent to not rebuild everything by @kkysen in #1423 - pdg: check in
Cargo.locks for analysis tests by @kkysen in #1429 - c2rust-refactor: generate artifacts by @oinoom in #1425
- transpile: update generated nightly to
nightly-2023-04-15(1.70.0) forsyn v2.0.107andcargo's sparse registry by @kkysen in #1422 - tests: copy
generated-rust-toolchain.tomlto test directories by @kkysen in #1430 - transpile: update dependencies in generated
Cargo.tomlby @kkysen in #1418 - refactor: update to
cargo v0.65, matching our pinned nightly of Rust 1.65 by @kkysen in #1421 - transpile: remove
~inCargo.toml.hbscausing trailing whitespace to be removed by @kkysen in #1419 - ci: set
C2RUST_DIRforc2rust-testsuiteso that current versions of c2rust crates are used by @kkysen in #1420 - exporter: print src loc for all warnings, including in type encoding by @kkysen in #1416
- transpile, analyze: remove
#![feature(label_break_value)], stabilized in Rust 1.65 (our current nightly) by @kkysen in #1431 - transpile: Always use absolute paths when referring to crates by @Rua in #1408
- refactor: help the user find a transform by @fw-immunant in #1427
- transpile: Extend lifetime of compound literals whose address is taken by @Rua in #1407
- exporter: tag all SVE types w/
TagSve(unhandled) by @kkysen in #1417 - transpile: Use literal directly when taking address of string literal by @Rua in #1434
- Fix NodeId->HirId lookups by carrying structural context by @oinoom in #1445
- transpile: Avoid unnecessary parentheses around calls or fields by @Rua in #1449
- transpile: add
--reorganize-definitionsback by @kkysen in #1454 - docs: update out-of-date info in
README.md,docs/, andmanual/by @kkysen in #1459 - ci: install generated nightly toolchain as well by @kkysen in #1460
- refactor: fix
canonicalize_refsin libxml transforms by @oinoom in #1450 - readme: update section on cross-transpilation to explain how to cross-arch transpile by @kkysen in #1456
- transpile: fixes before re-enabling
--reorganize-definitionsby @kkysen in #1452 - ci: Add runner name to rust-cache key by @ahomescu in #1466
- transpile: defer+cache imports alongside zero initializers by @fw-immunant in #1455
- ci: run
testsuite/test.pyfrom insidetestsuiteso that thepyproject.tomlis loaded correctly by @kkysen in #1468 - ci: remove
scan-buildinstall by @kkysen in #1461 - refactor: Fix name collisions in
reorganize_definitionsby @ahomescu in #1465 - transpile: fix out-of-range literals by @kkysen in #1442
- ci: enable new
libmcstest from c2rust-testsuite by @kkysen in #1470 - Fix type error in generated Rust when indexing typedef'd pointers by @fw-immunant in #1471
- refactor: Fix
remove_unnecessary_refsto ignore pointers by @ahomescu in #1467 - Fix Rust compiler version mismatches in c2rust-refactor, rebased by @ahomescu in #1472
- c2rust-refactor: Structurally match types more conservatively by comparing visibility by @ahomescu in #1474
- Fix quickcheck-derived test case for refactor casts by @fw-immunant in #1392
- Add the testsuite as a subtree of c2rust by @ahomescu in #1485
- Enable more refactor transforms on lua by @ahomescu in #1486
- transpile: Add varargs snapshot test by @Rua in #1491
- Add index to name of refactor diff files to keep track of order of application by @ahomescu in #1487
- transpile: Split
convert_pointerinto two functions for easier reuse by @Rua in #1478 - transpile: Factor out common function for address-of and array-decay by @Rua in #1446
- transpile: Resolve expression first in address-of and array-decay by @Rua in #1481
- transpile: Translate null pointers with
ptr::null[_mut]by @Rua in #1479 - transpile: Rework
is_va_listfor better accuracy by @Rua in #1439 - transpile: Translate
va_listwith correct types by @Rua in #1443 - transpile: Split off new pointers.rs module by @Rua in #1495
- transpile: Do not leak
mainargument strings by @Rua in #1447 - transpile: tests: rename
main.ctomain_fn.csince themain.rsgenerated is detected as a test by @kkysen in #1499 - refactor: Update
reorganize_definitionstest and fix some issues by @ahomescu in #1484 - test.py: only run
*.gen.shscripts actually generated during that run by @kkysen in #1488 - refactor: Implement deep structural comparison of ADTs by comparing all variants individually by @ahomescu in #1475
- transpile: Do not deref when taking address of array indexing expression by @Rua in #1494
- Enable more refactor transforms for python2 by @ahomescu in #1502
- transpile: Use raw borrows instead of normal borrows by @Rua in #1355
- transpile: Do not emit block and
initvariable for non-bitfield structs by @Rua in #1508 - Add crisp tools by @fw-immunant in #1505
- transpile: Avoid some identity transmutes for function pointers by @Rua in #1510
- Add definition splitting to transpiler by @fw-immunant in #1477
- Add c2rust-postprocess tool by @thedataking in #1504
- transpile: Also resolve extension operators in
unwrap_predefined_identby @Rua in #1515 - Support python 3.12 in test suite runner by @randomPoison in #1518
- Fix error code reporting for test suite failures by @randomPoison in #1517
- tests: Print stderr too on unit test failure by @Rua in #1527
- Allow empty include paths by @abakst in #1528
- c2rust-bitfields-derive: pin all dependencies by @kkysen in #1529
- postprocess: add type-checking by @kkysen in #1531
- postprocess: add
--update-rustso we can avoid updating in-place for tests by @kkysen in #1532 - postprocess: run on a whole dir at once, searching for
*.c_decls.jsonfiles by @kkysen in #1533 - postprocess: switch from
gemini-3-pro-previewtogemini-3-flash-previewfor the default by @kkysen in #1535 - transpile: Run
rustfmton generated .rs files by @Rua in #1458 - Fix nix build for c2rust by @Chobbes in #1341
- transpile: Move some stuff into
structmodule by @Rua in #1516 - Add missing
uvdependency to Nix flake by @Rua in #1539 - ci: add basic CI for
tools/by @kkysen in #1538 - reorganize_definitions: Shorten paths that are imported into the current module by @ahomescu in #1399
- Handle C decls with zero ending row/col by @fw-immunant in #1546
- postprocess: add
--exclude-filefor skipping functions by @kkysen in #1541 - tests/integration: print times for each step and flush to see it in CI by @kkysen in #1547
- transpile: simplify and fix comparing
SrcLocs by include paths by @kkysen in #1548 - refactor: unset
$RUSTC_WRAPPERso it doesn't add an extrarustcarg by @kkysen in #1500 - build(deps): bump pyasn1 from 0.6.1 to 0.6.2 in /c2rust-postprocess by @dependabot[bot] in #1549
- build(deps): bump urllib3 from 2.6.2 to 2.6.3 in /c2rust-postprocess by @dependabot[bot] in #1550
- transpile: replace glob import used for linking with a normal import by @ahomescu in #1540
- Fix issue #1509 by improving handling of unused expression side effects by @ahomescu in #1544
- tests/integration: update
json-c's postprocess LLM cache after #1554 by @kkysen in #1551 - transpile: add
--c2rust-dirto resolve relative c2rust dependencies by @kkysen in #1559 - tests/integration: cleanups for postprocess integration by @kkysen in #1568
- refactor: configure
cargoby @kkysen in #1573 - Restore cross checking code, part 1 by @ahomescu in #1575
- refactor: Fix transform casts from non-unit to unit types by @ahomescu in #1567
- build(deps): bump spin from 0.5.0 to 0.5.2 in /cross-checks/zero-malloc by @dependabot[bot] in #1576
- build(deps): bump smallvec from 0.6.4 to 0.6.14 in /cross-checks/zero-malloc by @dependabot[bot] in #1577
- git: set
update = nonefor all submodules so that cargo git dependencies don't clone them by @kkysen in #1574 - Restore cross checks, part 2: fix the Rust runtime and unit tests by @ahomescu in #1578
- build(deps): bump bytes from 1.10.1 to 1.11.1 by @dependabot[bot] in #1585
- Prepare for v0.22.0 release by @kkysen in #1588
New Contributors
- @randomPoison made their first contribution in #1518
- @abakst made their first contribution in #1528
Full Changelog: v0.21.0...v0.22.0
v0.21.0
Major Changes
Portable Types
In #1266, we added support for transpiling portable integer types like size_t and uint64_t. Previously, these were translated in a platform-dependent way, as C defines these portable types as typedefs of the platform-dependent primitive types like int and long.
Now we special case these portable integer types and make sure to translate them as the equivalent Rust portable types, so size_t becomes usize and uint64_t becomes u64, for example.
These still often go through multiple typedefs in C, which become multiple type aliases in Rust, so the definitions are not always textually identical in Rust, but the underlying types should always be portable now.
Const Macros
We previously had an unstable and often broken --translate-const-macros option, which translated const/object-like C macros as Rust consts. This has now been significantly improved and --translate-const-macros conservative is enabled by default. The option has been split into none, conservative, and experimental, so we still allow the previous more experimental translations under experimental, but conservative should generally work and thus is enabled by default. However, some const macros are not yet translatable, like macros referencing other variables, functions, etc., which conservative skips, while some const macros can never be properly translated as a Rust const, such as when it references a variable that is not yet defined. We're still working on improving these cases so that more const macros can be successfully translated, but the current version should capture most usages in the wild. For tmux, 98% of const macro definitions and expansions are successfully translated, for example.
One area in particular we're still working on is the combination of const macros and portable types. The features don't yet work together seamlessly, with const macro types using the old non-portable types and then casting to the portable type at use sites.
SrcLoc Sorting
On stable, sorting now panics when a non-total order is discovered, which was the case in fn compare_src_locs. We had previously tried to fix this, and fixed it in a bunch of cases, but it was still cropping up sometimes, like when transpiling libxml2.
We've now fixed the root cause of incorrect SrcLoc::fileids when we calculate #include paths. Besides fixing any panics, this should improve the sorting of items, which was sometimes buggy before, likely due to this.
cmake 4.0 Support
#1214 adds support for cmake 4.0 by increasing the minimum to cmake 3.5. This should fix any installation issues due to using a new cmake.
LLVM/Clang Support
Misc. Bug Fixes
- (#1265) Handle all cases of extra braces in string initializers.
- (#1340) Remove extraneous
::separators in paths with arguments (e.g.::core::mem::size_of::<libc::c_int>::()). - (#1359) Store
allocavector at function-level scope, matching C. - (#1360) Avoid mutable transmutes (UB) for string literals (
mem::transmute::<[u8; N], [c_char; N]>(*b"")instead of*mem::transmute::<&[u8; N], &mut [c_char; N]>(b"")). - (#1361) Support anonymous
struct/union/enums withinstructs andunions. - (#1374) Inline asm fixes for
ioq3.
Misc. Improvements
- (#1221, #1222, #1229, #1381) Prefer
core::overlibc::andstd::, fixing--emit-no-std. - (#1218) Prefer
[x; N]over[x, ..., x]. - (#1344) Skip redundant expressions for
++and--(i += 1; i;vs.i += 1;). - (#1373)
use libconly when needed.
New Instrinsics Added
- (#814) C11 atomics
- (#1342)
_Static_assert - (#1235)
__float128 - (#1259, #1260)
__builtin_rotateright* - (#1263, #1292)
__builtin_ia32_pause - (#1263, #1292)
__builtin_arm_yield - (#1129)
__builtin_ia32_vperm2f128_pd256 - (#1129)
_mm256_permute2f128_pd
Changelog
- docs/readme: Update
beararguments by @javierhonduco in #1206 - GH Actions: bump tagged versions of actions/cache by @brk in #1212
- build: support cmake 4.0 by @chenrui333 in #1214
- CI updates (Ubuntu 22, LLVM 15, pinned
once_cell) by @folkertdev in #1219 - Remove some
libcdependencies. by @nnethercote in #1221 - Fixes to
rust-toolchain.tomlhandling by @joshtriplett in #1225 - Reduce
libcusage inc2rust-transpileby @nnethercote in #1222 - Remove more unnecessary
libcusage by @nnethercote in #1229 - Make
test_translator.pytests pass on LLVM 19 by @nnethercote in #1230 - Support
__float128, which shows up in clang headers on some systems by @joshtriplett in #1235 - Allow running multiple transpiles in parallel by @jameysharp in #1241
- transpile: remove invalid
Punct::new(' ')infn convert_asmand updateproc-macro2by @kkysen in #1244 - Move Linux CI from Azure Pipelines to GitHub Actions by @joshtriplett in #1232
- Bump bindgen to be able to handle CXCursor_LinkageSpec in LLVM18+ by @spastorino in #1243
- Fix getBitWidthValue compilation error on LLVM 20+ by @shirok1 in #1248
- Introduce some snapshot tests of c2rust-transpile by @jameysharp in #1246
transpile: some snapshot test fixes by @kkysen in #1258- Support C11 atomics required by dav1d by @thedataking in #814
transpile: impl__builtin_ia32_pauseand__builtin_arm_yieldby @thedataking in #1263- Various small cleanups by @fw-immunant in #1267
- More driveby cleanups by @fw-immunant in #1268
transpile: Add SIMD intrinsic__builtin_ia32_vperm2f128_pd256/_mm256_permute2f128_pdby @Kriskras99 in #1129- transpile: fix doc tests on aarch64 (
c_charis unsigned there) by @kkysen in #1255 transpile: impl__builtin_rotateright*ascore::intrinsics::rotate_rightby @kkysen in #1259transpile: emit.rotate_{left,right}instead ofcore::intrinsics::rotate_{left,right}by @kkysen in #1260- Add
tests/requirements.txtdependencies into nix python environment by @Chobbes in #1269 - ci: allow reusing testsuite workflow by @fw-immunant in #1272
- Allow platform-dependent snapshot test results by @fw-immunant in #1270
- transpile: operators: resolve type when checking for unsignedness by @fw-immunant in #1273
- fix compilation error on clang/llvm 21 by @bungcip in #1274
- ci: switch python to use
uvby @kkysen in #1276 - ci: move macOS
azure-pipelines.ymlto GitHub Actions with a matrix by @kkysen in #1275 - ci: add
archto the matrix for clarity by @kkysen in #1284 - Fix skipping of Paren expressions in typed AST iterators by @fw-immunant in #1286
- ci: run on both Ubuntu 22.04 and ubuntu-latest by @fw-immunant in #1288
- Revert "transpile: snapshot: build to stdout rather than creating+deleting rlib" by @kkysen in #1287
- ci: reorder some steps to cache more (
rustup) and run fast checks earlier by @kkysen in #1289 - transpile: handle all cases of extra braces in string initializers by @kkysen in #1265
- transpile: do not allow f128::new in const contexts by @fw-immunant in #1294
- A couple testing tweaks by @fw-immunant in #928
- test_translator: remove
#![feature(nll)], stabilized in 1.63 by @kkysen in #1290 - scripts: restore
provision_mac.sh(removed in #1275) and remove docker scripts by @kkysen in #1299 - transpile: save platform-specific
.rsfiles, too by @kkysen in #1291 - ci: test on aarch64 macOS by @kkysen in #1280
- transpile: add arch-specific snapshots by @kkysen in #1293
- transpile: revert
__builtin_ia32_pause/__builtin_arm_yieldto emit_mm_pauseand__yieldinstead of cross-platformspin_loopby @kkysen in #1292 - Upgrade to Syn 2 by @bungcip in #1271
- ci: use
awalsh128/cache-apt-pkgs-action@latestto cacheapt installby @kkysen in #1277 - Remove snapshot .rs files by @fw-immunant in #1300
- transpile: use a repeat expression for arrays with a single zero initializer by @folkertdev in https://github.com/immunant/c2...
v0.20.0
Significant Changes
What's Changed
c2rust-transpile
- transpile: don't assume macro invocations are whitespace-free by @fw-immunant in #1120
- transpile: Make cast from
boolto pointer compile throughsize_tby @GPHemsley in #1134 - Fix segfault due to failing Expr classification by @thedataking in #1145
transpile: Rewritefn compare_src_locsimplementation to have a total order by @Kriskras99 in #1128- transpile: fix
curltranspile breakage while maintaining a totalSrcLocorder by @kkysen in #1163 transpile: emit zeroed array expressions as[0; N]by @folkertdev in #1170transpile: fix previously ignoredenumusage in compound literals by @Yeaseen in #1185transpile: 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
- Import null pointer information from PDG into static analysis by @ahomescu in #1086
- analyze: implement Box rewrites by @spernsteiner in #1106
- analyze: static/dynamic comparison mode for NON_NULL by @spernsteiner in #1151
- analyze: add HEAP and STACK permissions by @spernsteiner in #1147
- analyze: misc fixes for simple_buffer by @spernsteiner in #1148
- Use log crate for debugging output in c2rust-analyze by @ahomescu in #1102
- analyze: use a common namespace for all local and global PointerIds by @spernsteiner in #1164
- analyze: allow pointee analysis to work interprocedurally by @spernsteiner in #1172
- analyze: run equiv pass before pointee by @spernsteiner in #1173
- analyze: script for automatically fixing some compile errors by @spernsteiner in #1174
- analyze: more def list options by @spernsteiner in #1175
- analyze: memcpy rewrite improvements by @spernsteiner in #1176
- analyze: discard rewrites on bounds checking code by @spernsteiner in #1177
- analyze: misc fixes for lighttpd buffer (part 1/2) by @spernsteiner in #1178
- analyze: move
Option<&mut T>on last use instead of reborrowing by @spernsteiner in #1179 - analyze: misc fixes for lighttpd buffer (part 2/2) by @spernsteiner in #1180
- analyze: add option to skip borrowck by @spernsteiner in #1181
- analyze: add test based on lighttpd buffer by @spernsteiner in #1182
- analyze: use println! instead of info! to print rewritten code by @spernsteiner in #1190
- fix: clippy::not_unsafe_ptr_arg_deref by @Nugine in #1187
Build Systems, CI, docs, etc.
- Update CI workflow to use upload-artifacts@v4 action by @fw-immunant in #1130
- Fix Nix by @DieracDelta in #1094
rust-analyzer: addrust-analyzercomponent torust-toolchain.tomlso that it is in sync with our pinned nightly by @kkysen in #1137- Fix Darwin CI by @fw-immunant in #1146
- Update
analysis/ownership/README.mdto add syntax highlighting to code snippets. by @elliottyoon in #1156 - fix typos by @jayvdb in #1192
New Contributors
- @GPHemsley made his first contribution in #1134
- @DieracDelta made their first contribution in #1094
- @Kriskras99 made their first contribution in #1128
- @elliottyoon made their first contribution in #1156
- @folkertdev made their first contribution in #1170
- @Yeaseen made his first contribution in #1185
- @jayvdb made his first contribution in #1192
- @Nugine made his first contribution in #1187
Full Changelog: v0.19.0...v0.20.0
v0.19.0
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 2021for the tests, fixing issues with imports andcore(#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::applyby @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.mdto addcompile_commands.jsonsetup formesonby @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) Addknown_fns!for declaring the permissions on ptrs in known (i.e.libc)UnknownDeffns by @kkysen in #978 - (
c2rust-analyze) Allow calls toUnknownDefKnownFns with known ptr perms by @kkysen in #980 - (
c2rust-analyze) RemoveUNIQUEfrom 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 genericextern "rust-intrinsic" foreignfn` 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 alllibcKnownFns used inlighttpd_rust_amalgamatedby @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_tyfor 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 ofmain.rstoanalyze.rsexcept forfn mainby @kkysen in #1035c2rust-analyze: Add acargowrapper 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 castingbools to floats, go through the integral typeu8by @dgherzka in #1030- support
c2rust <path/to/*.c>in lieu ofcompile_commands.jsonby @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 justcharandintby @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...
v0.18.0
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.jsonhandling (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
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_copyhandling (#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
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:
Maintenance Release
This is just a current snapshot, nothing major to see here. New and exciting things are just around the corner!
Maintenance Update
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-functionsadded 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!