Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions c2rust-ast-builder/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,26 @@ impl Builder {
}))
}

pub fn const_impl_item<I>(self, name: I, ty: Box<Type>, init: Box<Expr>) -> ImplItem
where
I: Make<Ident>,
{
let name = name.make(&self);
ImplItem::Const(ImplItemConst {
attrs: self.attrs,
vis: self.vis,
defaultness: None,
const_token: Token![const](self.span),
ident: name,
generics: self.generics,
colon_token: Token![:](self.span),
ty: *ty,
eq_token: Token![=](self.span),
expr: *init,
semi_token: Token![;](self.span),
})
}

pub fn fn_item<S>(self, sig: S, mut block: Block) -> Box<Item>
where
S: Make<Signature>,
Expand Down
3 changes: 2 additions & 1 deletion c2rust-transpile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use c2rust_ast_exporter as ast_exporter;

use crate::build_files::{emit_build_files, get_build_dir, CrateConfig};
use crate::compile_cmds::get_compile_commands;
pub use crate::translator::ReplaceMode;
pub use crate::translator::{EnumMode, ReplaceMode};
use std::prelude::v1::Vec;

type PragmaVec = Vec<(&'static str, Vec<&'static str>)>;
Expand Down Expand Up @@ -108,6 +108,7 @@ pub struct TranspilerConfig {
pub log_level: log::LevelFilter,
pub edition: RustEdition,
pub deny_unsafe_op_in_unsafe_fn: bool,
pub enum_mode: EnumMode,

/// Run `c2rust-postprocess` after transpiling and potentially refactoring.
pub postprocess: bool,
Expand Down
Loading
Loading