Skip to content

resolver = "2" is not the default in workspaces #9996

@jamen

Description

@jamen

Problem

Prior to Rust 2021, when building wgpu on windows without resolver = "2", I get this error:

error: Metal API enabled on non-Apple OS. If your project is not using resolver="2" in Cargo.toml, it should.
  --> C:\Users\me\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-hal-0.11.3\src\lib.rs:49:1
   |
49 | compile_error!("Metal API enabled on non-Apple OS. If your project is not using resolver=\"2\" in Cargo.toml, it should.");  
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 

Now with Rust 2021, this is fixed for crates, but it doesn't seem to be fixed in workspaces.

Steps

  1. Create a workspace with
[workspace]
members = [ "foo" ]
  1. cargo new foo and use this config
[package]
name = "foo"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
wgpu = "0.11.0"
  1. Run cargo build and get wgpu's resolver error.
  2. Repeat the above without a workspace, and see there is no resolver error.

Possible Solution(s)

After searching the code, I found

resolve_behavior: ResolveBehavior::V1,

which might be the problem.

Notes

No response

Version

cargo 1.56.0 (4ed5d137b 2021-10-04)
release: 1.56.0
commit-hash: 4ed5d137baff5eccf1bae5a7b2ae4b57efad4a7d
commit-date: 2021-10-04

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions