gfx-rs/wgpu

RequestAdapterOptions/RenderPassDescriptor compilation error in 0.20.0?

Zageron opened this issue · 2 comments

Description
When build release configuration or generating docs, I get lifetime argument errors in wgpu-0.20.0\src\lib.rs.

It appears to work in debug builds but rust-analyser also reports issue.

Repro steps
cargo build --release
Open 0.20.0 with rust-analyzer

Expected vs observed behavior
Clearly describe what you get, and how it goes across your expectations.

Extra materials

Compiling wgpu v0.20.0
error[E0107]: type alias takes 2 lifetime arguments but 1 lifetime argument was supplied
    --> C:\Users\Zageron\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-0.20.0\src\lib.rs:2133:19
     |
2133 |         options: &RequestAdapterOptions<'_>,
     |                   ^^^^^^^^^^^^^^^^^^^^^ -- supplied 1 lifetime argument
     |                   |
     |                   expected 2 lifetime arguments
     |
note: type alias defined here, with 2 lifetime parameters: `'a`, `'b`
    --> C:\Users\Zageron\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-0.20.0\src\lib.rs:1392:10
     |
1392 | pub type RequestAdapterOptions<'a, 'b> = RequestAdapterOptionsBase<&'a Surface<'b>>;
     |          ^^^^^^^^^^^^^^^^^^^^^ --  --
help: add missing lifetime argument
     |
2133 |         options: &RequestAdapterOptions<'_, '_>,
     |                                           ++++

error[E0107]: type alias takes 2 lifetime arguments but 1 lifetime argument was supplied
    --> C:\Users\Zageron\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-0.20.0\src\lib.rs:1394:37
     |
1394 | static_assertions::assert_impl_all!(RequestAdapterOptions<'_>: Send, Sync);
     |                                     ^^^^^^^^^^^^^^^^^^^^^ -- supplied 1 lifetime argument
     |                                     |
     |                                     expected 2 lifetime arguments
     |
note: type alias defined here, with 2 lifetime parameters: `'a`, `'b`
    --> C:\Users\Zageron\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-0.20.0\src\lib.rs:1392:10
     |
1392 | pub type RequestAdapterOptions<'a, 'b> = RequestAdapterOptionsBase<&'a Surface<'b>>;
     |          ^^^^^^^^^^^^^^^^^^^^^ --  --
help: add missing lifetime argument
     |
1394 | static_assertions::assert_impl_all!(RequestAdapterOptions<'_, '_>: Send, Sync);
     |                                                             ++++

error[E0107]: struct takes 2 lifetime arguments but 1 lifetime argument was supplied
    --> C:\Users\Zageron\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-0.20.0\src\lib.rs:1618:37
     |
1618 | static_assertions::assert_impl_all!(RenderPassDescriptor<'_>: Send, Sync);
     |                                     ^^^^^^^^^^^^^^^^^^^^ -- supplied 1 lifetime argument
     |                                     |
     |                                     expected 2 lifetime arguments
     |
note: struct defined here, with 2 lifetime parameters: `'tex`, `'desc`
    --> C:\Users\Zageron\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-0.20.0\src\lib.rs:1603:12
     |
1603 | pub struct RenderPassDescriptor<'tex, 'desc> {
     |            ^^^^^^^^^^^^^^^^^^^^ ----  -----
help: add missing lifetime argument
     |
1618 | static_assertions::assert_impl_all!(RenderPassDescriptor<'_, '_>: Send, Sync);
     |                                                            ++++

For more information about this error, try `rustc --explain E0107`.
error: could not compile `wgpu` (lib) due to 3 previous errors

Example:
image

Platform
wgpu 0.20.0
rustc 1.80.0-nightly (faefc618c 2024-05-07)
nightly-x86_64-pc-windows-msvc
rust-analyzer v0.3.1950

static_assertions::assert_impl_all!(RequestAdapterOptions<'_, '_>: Send, Sync);

Extremely strange is something happening with my sync? Why on earth are these missing a lifetime specifier locally?

Alright, posting here allowed me to rubber duck so I solved it with this command from cargo cache.

cargo install cargo-cache
cargo cache --remove-dir all trim --limit 6B

Hopefully someone else finds this helpful in the future.