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

Support more cfg() in Cargo.toml #499

Closed
kdy1 opened this issue Aug 30, 2022 · 6 comments · Fixed by #504
Closed

Support more cfg() in Cargo.toml #499

kdy1 opened this issue Aug 30, 2022 · 6 comments · Fixed by #504
Labels
question Further information is requested

Comments

@kdy1
Copy link
Contributor

kdy1 commented Aug 30, 2022

https://github.com/swc-project/swc/runs/8088642008?check_suite_focus=true

I tried using nextest for swc (https://swc.rs) but it failed with an error

  Downloaded aho-corasick v0.7.18
  Downloaded ahash v0.7.6
  Downloaded stdweb v0.4.20
  Downloaded subtle v2.4.1
  Downloaded stdweb-internal-runtime v0.1.5
  Downloaded terminal_size v0.1.17
  Downloaded url v2.2.2
  Downloaded unicode-normalization v0.1.19
error: error parsing Cargo metadata

Caused by:
  failed to construct package graph: for package 'browserslist-rs 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)': for dependency 'chrono', parsing target 'cfg(not(target = "wasm32-unknown-unknown"))' failed: cfg() expression has unknown predicate: target
Error: Process completed with exit code 96.
@sunshowers
Copy link
Member

Thanks for the report! I've never seen the target predicate before, and it's not documented at https://doc.rust-lang.org/reference/conditional-compilation.html. Does it actually work?

@kdy1
Copy link
Contributor Author

kdy1 commented Aug 30, 2022

Yeap, cargo test works without any problem.
(I didn't even notice this because cargo test has no problem with it)

@sunshowers
Copy link
Member

I checked and target is definitely not supported by Cargo -- it always evaluates to false. Guess we should do the same instead, but as it currently exists, the conditionals in https://github.com/browserslist/browserslist-rs/blob/main/Cargo.toml#L54-L61 do not work. The first one always evaluates to false and the second one always evaluates to true.

@sunshowers sunshowers added the question Further information is requested label Aug 30, 2022
@kdy1
Copy link
Contributor Author

kdy1 commented Aug 31, 2022

Oh.. I didn't know it, thanks! I'll file an issue on browserslist-rs instead

@kdy1
Copy link
Contributor Author

kdy1 commented Aug 31, 2022

Opened browserslist/browserslist-rs#12, but seems like cargo support target-specific dependencies

https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies

Nevermind, I'm trying to use nextest for swc again

@sunshowers
Copy link
Member

sunshowers commented Aug 31, 2022

Ah yeah, looks like browserlist has fixed its issue!

The next version of nextest will silently evaluate incorrect predicates to false to match Cargo's behavior, though I'm tempted to add a warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants