Skip to content

Unable to compile 0.2.1 with rust 1.90 (unresolved fs and mutable borrow in cpu.rs, missing functions in tpu.rs) #3

@tetraf

Description

@tetraf

I just added this crate to my project with cargo add hardware-query -F gpu-all -F monitoring which add this line in my Cargo.toml: hardware-query = { version = "0.2.1", features = ["gpu-all", "monitoring"] }. Then I try to compile with cargo using rustc 1.90.

$ rustc --version
rustc 1.90.0-nightly (11ad40bb8 2025-06-28)

But I got some errors:

  1. unresolved crate fs in cpu.rs
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `fs`
   --> hardware-query/src/cpu.rs:412:34
    |
412 |             if let Ok(content) = fs::read_to_string("/proc/cpuinfo") {
    |                                  ^^ use of unresolved module or unlinked crate `fs`
    |
    = help: if you wanted to use a crate named `fs`, use `cargo add fs` to add it to your `Cargo.toml`
help: consider importing one of these modules
    |
1   + use std::fs;
    |
1   + use tokio::fs;

(same error repeated multiple times, because fs is used multiple times in cpu.rs)

  1. mutable borrow in cpu.rs
error[E0596]: cannot borrow `vulnerabilities` as mutable, as it is not declared as mutable
   --> hardware-query/src/cpu.rs:487:33
    |
487 | ...                   vulnerabilities.push(format!("{}: {}", name, status));
    |                       ^^^^^^^^^^^^^^^ cannot borrow as mutable
    |
help: consider changing this to be mutable
    |
475 |         let mut vulnerabilities = Vec::new();
  1. missing function get_edge_tpu_driver_version in tpu.rs
error[E0599]: no function or associated item named `get_edge_tpu_driver_version` found for struct `TPUInfo` in the current scope
   --> hardware-query/src/tpu.rs:207:51
    |
59  | pub struct TPUInfo {
    | ------------------ function or associated item `get_edge_tpu_driver_version` not found for this struct
...
207 |                             driver_version: Self::get_edge_tpu_driver_version(),
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `TPUInfo`
    |
help: there is an associated function `get_tpu_driver_version` with a similar name
    |
207 -                             driver_version: Self::get_edge_tpu_driver_version(),
207 +                             driver_version: Self::get_tpu_driver_version(),
    |

(another same error after that)

  1. missing function get_habana_driver_version in tpu.rs
error[E0599]: no function or associated item named `get_habana_driver_version` found for struct `TPUInfo` in the current scope
   --> hardware-query/src/tpu.rs:306:71
    |
59  | pub struct TPUInfo {
    | ------------------ function or associated item `get_habana_driver_version` not found for this struct
...
306 |                                                 driver_version: Self::get_habana_driver_version(),
    |                                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `TPUInfo`
    |
help: there is an associated function `get_tpu_driver_version` with a similar name
    |
306 -                                                 driver_version: Self::get_habana_driver_version(),
306 +                                                 driver_version: Self::get_tpu_driver_version(),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions