Skip to content

Conversation

@logiclrd
Copy link

@logiclrd logiclrd commented Nov 1, 2025

This PR contains (hopefully) trivial changes to eliminate build warnings.

Before:

C:\code\scrap>cargo build 2>&1 | find "warning"
warning: no edition set: defaulting to the 2015 edition while the latest is 2024
warning: unexpected `cfg` condition name: `quartz`
warning: unexpected `cfg` condition name: `quartz`
warning: unexpected `cfg` condition name: `x11`
warning: unexpected `cfg` condition name: `dxgi`
warning: unexpected `cfg` condition name: `dxgi`
warning: unexpected `cfg` condition name: `quartz`
warning: unexpected `cfg` condition name: `x11`
warning: unexpected `cfg` condition name: `dxgi`
warning: use of deprecated function `std::mem::uninitialized`: use `mem::MaybeUninit` instead
warning: use of deprecated function `std::mem::uninitialized`: use `mem::MaybeUninit` instead
warning: use of deprecated function `std::mem::uninitialized`: use `mem::MaybeUninit` instead
warning: use of deprecated function `std::mem::uninitialized`: use `mem::MaybeUninit` instead
warning: use of deprecated function `std::mem::uninitialized`: use `mem::MaybeUninit` instead
warning: use of deprecated function `std::mem::uninitialized`: use `mem::MaybeUninit` instead
warning: type annotations needed
    = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
warning: taking a mutable reference to a `const` item
   = note: this warning originates in the macro `ENUM` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: the type `DXGI_OUTDUPL_DESC` does not permit being left uninitialized
warning: the type `DXGI_OUTDUPL_FRAME_INFO` does not permit being left uninitialized
warning: the type `DXGI_MAPPED_RECT` does not permit being left uninitialized
warning: the type `DXGI_MAPPED_RECT` does not permit being left uninitialized
warning: the type `D3D11_TEXTURE2D_DESC` does not permit being left uninitialized
warning: the type `DXGI_OUTPUT_DESC` does not permit being left uninitialized
warning: `scrap` (lib) generated 22 warnings

C:\code\scrap>

After:

C:\code\scrap>cargo build 2>&1 | find "warning"
warning: no edition set: defaulting to the 2015 edition while the latest is 2024

C:\code\scrap>

Please be gentle and check that I haven't made any mistakes. I have experience with lots of languages but Rust isn't one of them. 😛

… configurations.

Updated uses of mem::uninitialized in dxgi/mod.rs and quartz/display.rs to use mem::zeroed instead.
Added a local copy of D3D_FEATURE_LEVEL_9_1 in Capturer::new in dxgi/mod.rs so that it can be passed in to D3D11CreateDevice as mutable.
Added a type annotation for the IDXGIOutput1 pointer used in Displays::read_and_invalidate in dxgi/mod.rs.
@logiclrd
Copy link
Author

logiclrd commented Nov 1, 2025

That final warning goes away with

edition = "2015"

...in Cargo.toml. I don't know enough about Rust to know if this is a safe change or not, though.

@logiclrd
Copy link
Author

logiclrd commented Nov 1, 2025

I guess it must be because the code doesn't compile at all with any of the other possible values. 😁

@logiclrd
Copy link
Author

logiclrd commented Nov 1, 2025

C:\code\scrap>cargo clean -p scrap
     Removed 67 files, 9.0MiB total

C:\code\scrap>cargo build
   Compiling scrap v0.5.0 (C:\code\scrap)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.68s

C:\code\scrap>

@logiclrd
Copy link
Author

logiclrd commented Nov 1, 2025

Oh wow, I was working on another project that uses Scrap and didn't realize it was using its own embedded copy of the code with many modifications and extensions, and when I came here to the source repo, I didn't notice that this project hasn't been updated in 6 years. 😛

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant