Update to rustfmt-preview (#348)
* Update to rustfmt-preview. * Run "cargo fmt --all" with rustfmt 0.4.1. rustfmt 0.4.1 is the latest release of rustfmt-preview available on the stable channel. * Fix a long line that rustfmt 0.4.1 can't handle. * Remove unneeded commas left behind by rustfmt.
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
//! Defines `FaerieBackend`.
|
||||
|
||||
use container;
|
||||
use cretonne_codegen::binemit::{Addend, CodeOffset, Reloc, RelocSink, NullTrapSink};
|
||||
use cretonne_codegen::binemit::{Addend, CodeOffset, NullTrapSink, Reloc, RelocSink};
|
||||
use cretonne_codegen::isa::TargetIsa;
|
||||
use cretonne_codegen::{self, binemit, ir};
|
||||
use cretonne_module::{Backend, DataContext, Linkage, ModuleNamespace, Init, DataDescription,
|
||||
ModuleError};
|
||||
use failure::Error;
|
||||
use cretonne_module::{Backend, DataContext, DataDescription, Init, Linkage, ModuleError,
|
||||
ModuleNamespace};
|
||||
use faerie;
|
||||
use failure::Error;
|
||||
use std::fs::File;
|
||||
use target;
|
||||
use traps::{FaerieTrapManifest, FaerieTrapSink};
|
||||
@@ -33,7 +33,6 @@ pub struct FaerieBuilder {
|
||||
libcall_names: Box<Fn(ir::LibCall) -> String>,
|
||||
}
|
||||
|
||||
|
||||
impl FaerieBuilder {
|
||||
/// Create a new `FaerieBuilder` using the given Cretonne target, that
|
||||
/// can be passed to
|
||||
@@ -89,7 +88,6 @@ impl FaerieBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// A `FaerieBackend` implements `Backend` and emits ".o" files using the `faerie` library.
|
||||
pub struct FaerieBackend {
|
||||
isa: Box<TargetIsa>,
|
||||
@@ -192,9 +190,9 @@ impl Backend for FaerieBackend {
|
||||
}
|
||||
}
|
||||
|
||||
self.artifact.define(name, code).expect(
|
||||
"inconsistent declaration",
|
||||
);
|
||||
self.artifact
|
||||
.define(name, code)
|
||||
.expect("inconsistent declaration");
|
||||
Ok(FaerieCompiledFunction {})
|
||||
}
|
||||
|
||||
@@ -239,8 +237,7 @@ impl Backend for FaerieBackend {
|
||||
}
|
||||
for &(offset, id, addend) in data_relocs {
|
||||
debug_assert_eq!(
|
||||
addend,
|
||||
0,
|
||||
addend, 0,
|
||||
"faerie doesn't support addends in data section relocations yet"
|
||||
);
|
||||
let to = &namespace.get_data_decl(&data_decls[id]).name;
|
||||
@@ -253,9 +250,9 @@ impl Backend for FaerieBackend {
|
||||
.map_err(|e| ModuleError::Backend(format!("{}", e)))?;
|
||||
}
|
||||
|
||||
self.artifact.define(name, bytes).expect(
|
||||
"inconsistent declaration",
|
||||
);
|
||||
self.artifact
|
||||
.define(name, bytes)
|
||||
.expect("inconsistent declaration");
|
||||
Ok(FaerieCompiledData {})
|
||||
}
|
||||
|
||||
@@ -346,25 +343,20 @@ fn translate_function_linkage(linkage: Linkage) -> faerie::Decl {
|
||||
fn translate_data_linkage(linkage: Linkage, writable: bool) -> faerie::Decl {
|
||||
match linkage {
|
||||
Linkage::Import => faerie::Decl::DataImport,
|
||||
Linkage::Local => {
|
||||
faerie::Decl::Data {
|
||||
global: false,
|
||||
writeable: writable,
|
||||
}
|
||||
}
|
||||
Linkage::Export => {
|
||||
faerie::Decl::Data {
|
||||
global: true,
|
||||
writeable: writable,
|
||||
}
|
||||
}
|
||||
Linkage::Local => faerie::Decl::Data {
|
||||
global: false,
|
||||
writeable: writable,
|
||||
},
|
||||
Linkage::Export => faerie::Decl::Data {
|
||||
global: true,
|
||||
writeable: writable,
|
||||
},
|
||||
Linkage::Preemptible => {
|
||||
unimplemented!("faerie doesn't support preemptible globals yet");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct FaerieRelocSink<'a> {
|
||||
format: container::Format,
|
||||
artifact: &'a mut faerie::Artifact,
|
||||
|
||||
@@ -5,18 +5,10 @@
|
||||
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
|
||||
#![warn(unused_import_braces, unstable_features)]
|
||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(new_without_default, new_without_default_derive))]
|
||||
#![cfg_attr(feature = "cargo-clippy",
|
||||
allow(new_without_default, new_without_default_derive))]
|
||||
#![cfg_attr(feature="cargo-clippy", warn(
|
||||
float_arithmetic,
|
||||
mut_mut,
|
||||
nonminimal_bool,
|
||||
option_map_unwrap_or,
|
||||
option_map_unwrap_or_else,
|
||||
print_stdout,
|
||||
unicode_not_nfc,
|
||||
use_self,
|
||||
))]
|
||||
warn(float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or,
|
||||
option_map_unwrap_or_else, print_stdout, unicode_not_nfc, use_self))]
|
||||
|
||||
extern crate cretonne_codegen;
|
||||
extern crate cretonne_module;
|
||||
@@ -29,5 +21,5 @@ mod container;
|
||||
mod target;
|
||||
pub mod traps;
|
||||
|
||||
pub use backend::{FaerieBuilder, FaerieBackend, FaerieProduct, FaerieTrapCollection};
|
||||
pub use backend::{FaerieBackend, FaerieBuilder, FaerieProduct, FaerieTrapCollection};
|
||||
pub use container::Format;
|
||||
|
||||
@@ -13,8 +13,9 @@ pub fn translate(isa: &isa::TargetIsa) -> Result<Target, ModuleError> {
|
||||
}),
|
||||
"arm32" => Ok(Target::ARMv7),
|
||||
"arm64" => Ok(Target::ARM64),
|
||||
_ => Err(ModuleError::Backend(
|
||||
format!("unsupported faerie isa: {}", name),
|
||||
)),
|
||||
_ => Err(ModuleError::Backend(format!(
|
||||
"unsupported faerie isa: {}",
|
||||
name
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Faerie trap manifests record every `TrapCode` that cretonne outputs during code generation,
|
||||
//! for every function in the module. This data may be useful at runtime.
|
||||
|
||||
use cretonne_codegen::{ir, binemit};
|
||||
use cretonne_codegen::{binemit, ir};
|
||||
|
||||
/// Record of the arguments cretonne passes to `TrapSink::trap`
|
||||
pub struct FaerieTrapSite {
|
||||
@@ -23,7 +23,6 @@ pub struct FaerieTrapSink {
|
||||
pub sites: Vec<FaerieTrapSite>,
|
||||
}
|
||||
|
||||
|
||||
impl FaerieTrapSink {
|
||||
/// Create an empty `FaerieTrapSink`
|
||||
pub fn new(name: &str, code_size: u32) -> Self {
|
||||
|
||||
Reference in New Issue
Block a user