Skip to content

Commit bf7e313

Browse files
RuoqingHemtjhrc
authored andcommitted
rustc: Fix mismatched_lifetime_syntaxes
Rust v1.89.0 is reporting rustc::mismatched_lifetime_syntaxes: ```console warning: hiding a lifetime that's elided elsewhere is confusing --> src/devices/src/virtio/descriptor_utils.rs:499:13 | 499 | memory: &GuestMemoryMmap, | ^^^^^^^^^^^^^^^^ the lifetime is elided here ... 504 | ) -> Result<DescriptorChain> { | --------------- the same lifetime is hidden here | = help: the same lifetime is referred to in inconsistent ways, making the signature confusing = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default help: use `'_` for type paths | 504 | ) -> Result<DescriptorChain<'_>> { | ++++ ``` fix as suggested by rustc to kill those warnings. Signed-off-by: Ruoqing He <[email protected]>
1 parent ee7aceb commit bf7e313

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/devices/src/virtio/descriptor_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ pub fn create_descriptor_chain(
501501
mut buffers_start_addr: GuestAddress,
502502
descriptors: Vec<(DescriptorType, u32)>,
503503
spaces_between_regions: u32,
504-
) -> Result<DescriptorChain> {
504+
) -> Result<DescriptorChain<'_>> {
505505
let descriptors_len = descriptors.len();
506506
for (index, (type_, size)) in descriptors.into_iter().enumerate() {
507507
let mut flags = 0;

src/devices/src/virtio/mmio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl MmioTransport {
195195
self.interrupt.event()
196196
}
197197

198-
pub fn locked_device(&self) -> MutexGuard<dyn VirtioDevice + 'static> {
198+
pub fn locked_device(&self) -> MutexGuard<'_, dyn VirtioDevice + 'static> {
199199
self.device.lock().expect("Poisoned device lock")
200200
}
201201

src/devices/src/virtio/queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl<'a> DescriptorChain<'a> {
225225
desc_table: GuestAddress,
226226
queue_size: u16,
227227
index: u16,
228-
) -> Option<DescriptorChain> {
228+
) -> Option<DescriptorChain<'_>> {
229229
if index >= queue_size {
230230
return None;
231231
}

src/hvf/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ impl HvfVcpu<'_> {
523523
}
524524
}
525525

526-
fn handle_psci_request(&self) -> Result<VcpuExit, Error> {
526+
fn handle_psci_request(&self) -> Result<VcpuExit<'_>, Error> {
527527
match self.read_reg(hv_reg_t_HV_REG_X0)? {
528528
0x8400_0000 /* QEMU_PSCI_0_2_FN_PSCI_VERSION */ => {
529529
self.write_reg(hv_reg_t_HV_REG_X0, 2)?;
@@ -550,7 +550,7 @@ impl HvfVcpu<'_> {
550550
}
551551
}
552552

553-
pub fn run(&mut self, vcpu_list: Arc<dyn Vcpus>) -> Result<VcpuExit, Error> {
553+
pub fn run(&mut self, vcpu_list: Arc<dyn Vcpus>) -> Result<VcpuExit<'_>, Error> {
554554
let pending_irq = vcpu_list.has_pending_irq(self.vcpuid);
555555

556556
if let Some(mmio_read) = self.pending_mmio_read.take() {

src/krun_display/src/rust_to_c.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ pub trait DisplayBackendBasicFramebuffer {
3636
}
3737

3838
pub trait IntoDisplayBackend<T: Sync> {
39-
fn into_display_backend(userdata: Option<&T>) -> DisplayBackend;
39+
fn into_display_backend(userdata: Option<&T>) -> DisplayBackend<'_>;
4040
}
4141

4242
impl<T: Sync, I: DisplayBackendBasicFramebuffer + DisplayBackendNew<T>> IntoDisplayBackend<T>
4343
for I
4444
{
45-
fn into_display_backend(userdata: Option<&T>) -> DisplayBackend {
45+
fn into_display_backend(userdata: Option<&T>) -> DisplayBackend<'_> {
4646
extern "C" fn create_fn<T: Sync, I: DisplayBackendNew<T>>(
4747
instance: *mut *mut c_void,
4848
userdata: *const c_void,

0 commit comments

Comments
 (0)