diff options
author | David Tolnay <dtolnay@chromium.org> | 2019-03-08 16:56:14 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-08 02:51:37 -0700 |
commit | fdac5ede468e0fddfe527d6108430ee932b02fc3 (patch) | |
tree | 398c2ace79eea2babb4439810c43b793068fd8cc /devices/src/virtio/virtio_pci_device.rs | |
parent | 98895ac05d42ed346a161035134600b0d0e0bb87 (diff) | |
download | crosvm-fdac5ede468e0fddfe527d6108430ee932b02fc3.tar crosvm-fdac5ede468e0fddfe527d6108430ee932b02fc3.tar.gz crosvm-fdac5ede468e0fddfe527d6108430ee932b02fc3.tar.bz2 crosvm-fdac5ede468e0fddfe527d6108430ee932b02fc3.tar.lz crosvm-fdac5ede468e0fddfe527d6108430ee932b02fc3.tar.xz crosvm-fdac5ede468e0fddfe527d6108430ee932b02fc3.tar.zst crosvm-fdac5ede468e0fddfe527d6108430ee932b02fc3.zip |
edition: Use dyn syntax for trait objects
Found by running: `cargo rustc -- -D bare_trait_objects` Bare trait objects like `&Trait` and `Box<Trait>` are soft-deprecated in 2018 edition and will start warning at some point. As part of this, I replaced `Box<Trait + 'static>` with `Box<dyn Trait>` because the 'static bound is implied for boxed trait objects. TEST=cargo check --all-features TEST=cargo check --target aarch64-unknown-linux-gnu TEST=local kokoro Change-Id: I41c4f13530bece8a34a8ed1c1afd7035b8f86f19 Reviewed-on: https://chromium-review.googlesource.com/1513059 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: David Tolnay <dtolnay@chromium.org>
Diffstat (limited to 'devices/src/virtio/virtio_pci_device.rs')
-rw-r--r-- | devices/src/virtio/virtio_pci_device.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/devices/src/virtio/virtio_pci_device.rs b/devices/src/virtio/virtio_pci_device.rs index 4ba5437..27ab5fb 100644 --- a/devices/src/virtio/virtio_pci_device.rs +++ b/devices/src/virtio/virtio_pci_device.rs @@ -149,7 +149,7 @@ const VIRTIO_PCI_DEVICE_ID_BASE: u16 = 0x1040; // Add to device type to get devi pub struct VirtioPciDevice { config_regs: PciConfiguration, - device: Box<VirtioDevice>, + device: Box<dyn VirtioDevice>, device_activated: bool, interrupt_status: Arc<AtomicUsize>, @@ -165,7 +165,7 @@ pub struct VirtioPciDevice { impl VirtioPciDevice { /// Constructs a new PCI transport for the given virtio device. - pub fn new(mem: GuestMemory, device: Box<VirtioDevice>) -> Result<Self> { + pub fn new(mem: GuestMemory, device: Box<dyn VirtioDevice>) -> Result<Self> { let mut queue_evts = Vec::new(); for _ in device.queue_max_sizes().iter() { queue_evts.push(EventFd::new()?) @@ -414,7 +414,7 @@ impl PciDevice for VirtioPciDevice { o - COMMON_CONFIG_BAR_OFFSET, data, &mut self.queues, - &mut self.device, + self.device.as_mut(), ) } o if ISR_CONFIG_BAR_OFFSET <= o && o < ISR_CONFIG_BAR_OFFSET + ISR_CONFIG_SIZE => { @@ -448,7 +448,7 @@ impl PciDevice for VirtioPciDevice { o - COMMON_CONFIG_BAR_OFFSET, data, &mut self.queues, - &mut self.device, + self.device.as_mut(), ) } o if ISR_CONFIG_BAR_OFFSET <= o && o < ISR_CONFIG_BAR_OFFSET + ISR_CONFIG_SIZE => { |