Add the dyn keyword before trait objects;

This commit is contained in:
Benjamin Bouvier
2019-06-06 10:11:41 +02:00
parent eee824b6bd
commit d7d48d5cc6
77 changed files with 274 additions and 247 deletions

View File

@@ -34,8 +34,8 @@ pub struct MemoryCodeSink<'a> {
data: *mut u8,
/// Offset is isize because its major consumer needs it in that form.
offset: isize,
relocs: &'a mut RelocSink,
traps: &'a mut TrapSink,
relocs: &'a mut dyn RelocSink,
traps: &'a mut dyn TrapSink,
/// Information about the generated code and read-only data.
pub info: CodeInfo,
}
@@ -45,7 +45,11 @@ impl<'a> MemoryCodeSink<'a> {
///
/// This function is unsafe since `MemoryCodeSink` does not perform bounds checking on the
/// memory buffer, and it can't guarantee that the `data` pointer is valid.
pub unsafe fn new(data: *mut u8, relocs: &'a mut RelocSink, traps: &'a mut TrapSink) -> Self {
pub unsafe fn new(
data: *mut u8,
relocs: &'a mut dyn RelocSink,
traps: &'a mut dyn TrapSink,
) -> Self {
Self {
data,
offset: 0,

View File

@@ -40,7 +40,7 @@ use log::debug;
/// Relax branches and compute the final layout of EBB headers in `func`.
///
/// Fill in the `func.offsets` table so the function is ready for binary emission.
pub fn relax_branches(func: &mut Function, isa: &TargetIsa) -> CodegenResult<CodeInfo> {
pub fn relax_branches(func: &mut Function, isa: &dyn TargetIsa) -> CodegenResult<CodeInfo> {
let _tt = timing::relax_branches();
let encinfo = isa.encoding_info();
@@ -174,7 +174,7 @@ fn relax_branch(
offset: CodeOffset,
dest_offset: CodeOffset,
encinfo: &EncInfo,
isa: &TargetIsa,
isa: &dyn TargetIsa,
) -> CodeOffset {
let inst = cur.current_inst().unwrap();
debug!(

View File

@@ -13,7 +13,7 @@ use crate::timing;
use log::debug;
/// Pick the smallest valid encodings for instructions.
pub fn shrink_instructions(func: &mut Function, isa: &TargetIsa) {
pub fn shrink_instructions(func: &mut Function, isa: &dyn TargetIsa) {
let _tt = timing::shrink_instructions();
let encinfo = isa.encoding_info();