Add explicit dyn for trait objects

Fix "trait objects without an explicit `dyn` are deprecated" warnings
introduced in Rust 1.38.

BUG=None
TEST=emerge-nami crosvm

Change-Id: I8ca6aa747475268ae898adddd5d091d401326ceb
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1862999
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Daniel Verkamp 2019-10-15 13:13:40 -07:00 committed by Commit Bot
parent 6494117e17
commit 130fbbe71d
7 changed files with 9 additions and 8 deletions

View file

@ -448,7 +448,7 @@ mod tests {
#[test]
fn static_register_interface_test() {
let r: Box<RegisterInterface> = Box::new(static_register! {
let r: Box<dyn RegisterInterface> = Box::new(static_register! {
ty: u8,
offset: 3,
value: 32,

View file

@ -236,7 +236,7 @@ mod tests {
cvar: Condvar::new(),
evt,
});
let t: Arc<EventHandler> = h.clone();
let t: Arc<dyn EventHandler> = h.clone();
l.add_event(
&h.evt,
WatchingEvents::empty().set_read(),

View file

@ -284,7 +284,7 @@ impl Worker {
fn process_one_request(
avail_desc: DescriptorChain,
read_only: bool,
disk: &mut DiskFile,
disk: &mut dyn DiskFile,
disk_size: u64,
flush_timer: &mut TimerFd,
flush_timer_armed: &mut bool,
@ -571,7 +571,7 @@ impl Block {
fn execute_request(
avail_desc: DescriptorChain,
read_only: bool,
disk: &mut DiskFile,
disk: &mut dyn DiskFile,
disk_size: u64,
flush_timer: &mut TimerFd,
flush_timer_armed: &mut bool,

View file

@ -159,7 +159,7 @@ trait DisplayT: AsRawFd {
/// The user of `GpuDisplay` can use `AsRawFd` to poll on the compositor connection's file
/// descriptor. When the connection is readable, `dispatch_events` can be called to process it.
pub struct GpuDisplay {
inner: Box<DisplayT>,
inner: Box<dyn DisplayT>,
}
impl GpuDisplay {

View file

@ -77,7 +77,7 @@ pub unsafe extern "C" fn expand_disk_image(path: *const c_char, virtual_size: u6
Err(_) => return -EINVAL,
};
let mut disk_image: Box<DiskFile> = match image_type {
let mut disk_image: Box<dyn DiskFile> = match image_type {
ImageType::Raw => Box::new(raw_image),
ImageType::Qcow2 => match QcowFile::from(raw_image) {
Ok(f) => Box::new(f),

View file

@ -111,7 +111,8 @@ impl GpuMemoryAllocator for GpuBufferDevice {
}
#[cfg(feature = "wl-dmabuf")]
pub fn create_gpu_memory_allocator() -> Result<Option<Box<GpuMemoryAllocator>>, GpuAllocatorError> {
pub fn create_gpu_memory_allocator(
) -> Result<Option<Box<dyn GpuMemoryAllocator>>, GpuAllocatorError> {
let undesired: &[&str] = &["vgem", "pvr"];
let fd = gpu_buffer::rendernode::open_device(undesired)
.map_err(|_| GpuAllocatorError::OpenGpuBufferDevice)?;

View file

@ -326,7 +326,7 @@ pub fn validate_raw_fd(raw_fd: RawFd) -> Result<RawFd> {
///
/// On an error, such as an invalid or incompatible FD, this will return false, which can not be
/// distinguished from a non-ready to read FD.
pub fn poll_in(fd: &AsRawFd) -> bool {
pub fn poll_in(fd: &dyn AsRawFd) -> bool {
let mut fds = libc::pollfd {
fd: fd.as_raw_fd(),
events: libc::POLLIN,