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

Panic on curious [patch] combination #8745

Open
bjorn3 opened this issue Oct 1, 2020 · 2 comments
Open

Panic on curious [patch] combination #8745

bjorn3 opened this issue Oct 1, 2020 · 2 comments
Labels
A-patch Area: [patch] table override C-bug Category: bug

Comments

@bjorn3
Copy link
Member

bjorn3 commented Oct 1, 2020

Problem

$ cargo build
thread 'main' panicked at 'not currently active!?', src/tools/cargo/src/cargo/core/resolver/mod.rs:825:36
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fc2daaae610b5515438b551a2f3706196a997f35/library/std/src/panicking.rs:483
   1: core::panicking::panic_fmt
             at /rustc/fc2daaae610b5515438b551a2f3706196a997f35/library/core/src/panicking.rs:85
   2: core::option::expect_failed
             at /rustc/fc2daaae610b5515438b551a2f3706196a997f35/library/core/src/option.rs:1226
   3: cargo::core::resolver::activate_deps_loop
   4: cargo::core::resolver::resolve
   5: cargo::ops::resolve::resolve_with_previous
   6: cargo::ops::resolve::resolve_with_registry
   7: cargo::ops::resolve::resolve_ws_with_opts
   8: cargo::ops::cargo_compile::create_bcx
   9: cargo::ops::cargo_compile::compile_ws
  10: cargo::ops::cargo_compile::compile
  11: cargo::commands::build::exec
  12: cargo::cli::main
  13: cargo::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Steps

Try to build the following crate structure using Cargo.toml where ../wasmtime is a checkout of https://github.com/bytecodealliance/wasmtime.

# Cargo.toml
[package]
name = "headcrab"
version = "0.2.0"

[target.'cfg(target_os = "linux")'.dev-dependencies]
headcrab_inject = { path = "./headcrab_inject" }

[dev-dependencies]
rustc_codegen_cranelift = { path = "./cg_clif" }

[workspace]
exclude = ["./cg_clif"]

[patch.crates-io]
"cranelift-codegen" = { git = 'https://github.com/bytecodealliance/wasmtime/', branch = "main" }

[patch."https://github.com/bytecodealliance/wasmtime/"]
cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
# headcrab_inject/Cargo.toml
[package]
name = "headcrab_inject"
version = "0.2.0"

[dependencies]
headcrab = { version = "0.2.0", path = "../" }
cranelift-codegen = "0.67.0"
# cg_clif/Cargo.toml
[package]
name = "rustc_codegen_cranelift"
version = "0.1.0"

[dependencies]
# These have to be in sync with each other
cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", features = ["unwind"] }

Notes

Output of cargo version: cargo 1.48.0-nightly (05c611ae3 2020-09-23)

@bjorn3 bjorn3 added the C-bug Category: bug label Oct 1, 2020
@Eh2406
Copy link
Contributor

Eh2406 commented Oct 1, 2020

Same odd problem as #7463. As I recall this is do to to [patch] being implemented as "just lie to the resolver". In this case the resolver notices that thinks don't make sense and panics. The relevant optimization could just get skipped, but it involves threading the error path through several closures.

@ehuss ehuss added the A-patch Area: [patch] table override label Oct 20, 2020
@kdy1
Copy link

kdy1 commented Dec 20, 2020

Found the cause.

I depended on swc_common = 0.10.7 by mistake where other crates depends on swc_common = "0.10.6" and it is patched to point https://github.com/kdy1/swc/tree/tsc of which version is 0.10.6

Seems like resolve wants 0.10.7, but failed to find matching package because of patch.

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

No branches or pull requests

4 participants