rust-vmm / vm-memory

Virtual machine's guest memory crate
Apache License 2.0
299 stars 97 forks source link

Build errors with latest nightly toolchain `cargo 1.75.0-nightly (65e297d1e 2023-11-03)` #261

Closed likebreath closed 9 months ago

likebreath commented 9 months ago

With latest nightly toolchain:

cargo 1.75.0-nightly (65e297d1e 2023-11-03)
rustc 1.75.0-nightly (fee5518cd 2023-11-05)

There are several building errors like below:

error[E0308]: mismatched types
  --> src/bitmap/mod.rs:54:14
   |
54 |     type S = Self;
   |              ^^^^ lifetime mismatch
   |
   = note: expected associated type `<() as WithBitmapSlice<'a>>::S`
              found associated type `<() as WithBitmapSlice<'a>>::S`
note: the required lifetime does not necessarily outlive the lifetime `'a` as defined here
  --> src/bitmap/mod.rs:53:6
   |
53 | impl<'a> WithBitmapSlice<'a> for () {
   |      ^^
note: the lifetime requirement is introduced here
  --> src/bitmap/mod.rs:22:13
   |
22 |     type S: BitmapSlice;
   |             ^^^^^^^^^^^

error[E0308]: mismatched types
  --> src/bitmap/mod.rs:54:14
   |
54 |     type S = Self;
   |              ^^^^ lifetime mismatch
   |
   = note: expected associated type `<() as WithBitmapSlice<'a>>::S`
              found associated type `<() as WithBitmapSlice<'a>>::S`
note: the lifetime `'a` as defined here doesn't meet the lifetime requirements
  --> src/bitmap/mod.rs:53:6
   |
53 | impl<'a> WithBitmapSlice<'a> for () {
   |      ^^
note: the lifetime requirement is introduced here
  --> src/bitmap/mod.rs:22:13
   |
22 |     type S: BitmapSlice;
   |             ^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `vm-memory` (lib) due to 2 previous errors
roypat commented 9 months ago

Hi @likebreath, Thanks for the report! It seems like this is an instance of https://github.com/rust-lang/rust/issues/117598, a regression in rustc. I've reduced the vm-memory code that triggers it to https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=6e162d11925f16dcdaaf1def4c81c0e3, and the trait definitions are isomorphic to what is being reported over in that issue.

likebreath commented 9 months ago

@roypat Thank you for prompt response. Sine this is an issue from rustc nightly, I am closing the issue now.

roypat commented 9 months ago

This seems to be fixed in tonights nightly :tada: