Skip to content

home does not compile on wasm #12297

Open
@lorepozo

Description

Problem

The home crate does not build for wasm32-unknown-unknown. I encountered this through a transitive dependency from another crate.

Steps

$ cargo new bugreport
$ cd bugreport
$ echo 'home = "0.5"' >> Cargo.toml
$ cargo build --target wasm32-unknown-unknown

results in error:

error[E0425]: cannot find function `home_dir_inner` in the crate root
  --> .cargo/registry/src/index.crates.io-6f17d22bba15001f/home-0.5.5/src/env.rs:33:16
   |
33 |         crate::home_dir_inner()
   |                ^^^^^^^^^^^^^^ not found in the crate root

Possible Solution(s)

Home has no obvious place in wasm, so I suggest adding the following (and I'm happy to add this myself, along with CI test on wasm target)

#[cfg(target_arch = "wasm32")]
fn home_dir_inner() -> Option<PathBuf> {
    None
}

Notes

No response

Version

No response

Metadata

Assignees

No one assigned

    Labels

    A-homeArea: the `home` crateC-bugCategory: bugO-wasmOS: WASM target released issuesS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.T-cargoTeam: Cargo

    Type

    No type

    Projects

    • Status

      FCP blocked

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions