Skip to content

Rust nightly warning about dead code #3096

Closed
@kennykerr

Description

@kennykerr

The latest Rust nightly compiler raises a new warning about dead code.

D:\git\windows-rs> cargo check -p windows --features Foundation      
warning: struct `IReference` is never constructed
    --> crates\libs\windows\src\Windows\Foundation\mod.rs:1024:12
     |
1024 | pub struct IReference<T>(windows_core::IUnknown, core::marker::PhantomData<T>)
     |            ^^^^^^^^^^
     |
     = note: `#[warn(dead_code)]` on by default

warning: struct `IReferenceArray` is never constructed
    --> crates\libs\windows\src\Windows\Foundation\mod.rs:1281:12
     |
1281 | pub struct IReferenceArray<T>(windows_core::IUnknown, core::marker::PhantomData<T>)
     |            ^^^^^^^^^^^^^^^

warning: `windows` (lib) generated 2 warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s

This seems like a Rust nightly bug. I don't see what's wrong with this code.

Originally noticed here: https://github.com/microsoft/windows-rs/actions/runs/9501067497/job/26185702630

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions