6 releases (breaking)
✓ Uses Rust 2018 edition
|0.14.0||Dec 19, 2019|
|0.13.0||Oct 24, 2019|
|0.12.0||Aug 23, 2019|
|0.11.0||Aug 15, 2019|
|0.10.1||Apr 16, 2019|
167 downloads per month
Used in c2rust
This is a refactoring tool for Rust programs, aimed at removing unsafety from automatically-generated Rust code.
c2rust refactor command line usage is as follows:
c2rust refactor [flags] <command> [command args] -- <input file> [rustc flags]
c2rust refactor are described by
c2rust refactor --help.
See the command documentation (online manual)
for a list of commands, including complete usage and descriptions.
Multiple commands can be separated by an argument consisting of a single
semicolon, as in
c2rust refactor cmd1 arg1 \; cmd2 arg2.
(Note the semicolon needs to be escaped to prevent it from being interpreted by
c2rust refactor requires
rustc command line arguments for the program to be
refactored, so that it can use
rustc to load and typecheck the source code.
For projects built with
cargo, pass the
--cargo flag to
and it will obtain the right arguments from
cargo automatically. Otherwise,
you must provide the
rustc arguments on the
c2rust refactor command line,
Some commands require the user to "mark" some AST nodes for it to operate on.
For example, the
rename_struct command requires that the user mark the
declaration of the struct that should be renamed.
Each mark associates a "label" with a specific AST node (identified by its
NodeId). Labels are used to distinguish different types of marks, and a
single node can have any number of marks with distinct labels. For example,
when running the
func_to_method command, which turns functions into methods
in an inherent
impl, the user must mark the functions to move with the
target label and must mark the destination
impl with the
Nodes marked with other labels will be ignored. The set of labels recognized
by a command is described in the command's documentation; by default, most
commands that use marks operate on
The most flexible way of marking nodes is by using the
command. See the command documentation and
src/select/mod.rs for details.
Note that marks are not preserved across
c2rust refactor invocations, so you
usually want to run
select followed by the command of interest using the
separator mentioned above.