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 cargo add with --offline flag #10814

Closed
TheNeikos opened this issue Jul 2, 2022 · 3 comments · Fixed by #10817
Closed

Panic on cargo add with --offline flag #10814

TheNeikos opened this issue Jul 2, 2022 · 3 comments · Fixed by #10817
Labels
A-offline Area: offline mode C-bug Category: bug

Comments

@TheNeikos
Copy link
Contributor

Problem

Running cargo add nom-supreme --offline causes cargo to panic with:

✦ ❯ cargo add nom-supreme --offline
thread 'main' panicked at 'Mismatch between definition and access: Could not downcast to TypeId { t: 11046744883169582909 }, need to downcast to TypeId { t: 3179235821501706961 }
', src/tools/cargo/src/cargo/util/command_prelude.rs:736:9
stack backtrace:
   0:     0x55b4fcbcabcd - std::backtrace_rs::backtrace::libunwind::trace::h8f9ba895f18b09d0
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x55b4fcbcabcd - std::backtrace_rs::backtrace::trace_unsynchronized::hc6a14c0ffe629597
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55b4fcbcabcd - std::sys_common::backtrace::_print_fmt::h0bced23525216d79
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x55b4fcbcabcd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::heb53bc5f6fd72de1
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x55b4fcbf3f6c - core::fmt::write::h9eead92cdcbde24c
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/core/src/fmt/mod.rs:1198:17
   5:     0x55b4fcbc2f41 - std::io::Write::write_fmt::h4b47f879edc26800
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/io/mod.rs:1672:15
   6:     0x55b4fcbccb95 - std::sys_common::backtrace::_print::hdda4f6fb9c1bea83
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x55b4fcbccb95 - std::sys_common::backtrace::print::h1334fdcbaa6ee9eb
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x55b4fcbccb95 - std::panicking::default_hook::{{closure}}::h4527c1ef3d428396
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/panicking.rs:295:22
   9:     0x55b4fcbcc8b6 - std::panicking::default_hook::hf30182a640d582ac
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/panicking.rs:314:9
  10:     0x55b4fcbcd126 - std::panicking::rust_panic_with_hook::h068be8eb179d2d55
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/panicking.rs:698:17
  11:     0x55b4fcbcd017 - std::panicking::begin_panic_handler::{{closure}}::h85625522130dfde4
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/panicking.rs:588:13
  12:     0x55b4fcbcb084 - std::sys_common::backtrace::__rust_end_short_backtrace::hff27c063627d1102
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/sys_common/backtrace.rs:138:18
  13:     0x55b4fcbccd49 - rust_begin_unwind
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/panicking.rs:584:5
  14:     0x55b4fc190943 - core::panicking::panic_fmt::hd728e2e35c66173a
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/core/src/panicking.rs:142:14
  15:     0x55b4fc419fac - <clap[77a589a9571e64bb]::parser::matches::arg_matches::ArgMatches as cargo[2ef4b5b64bd408ee]::util::command_prelude::ArgMatchesExt>::flag
  16:     0x55b4fc1d5732 - cargo[ca8b6ced5f41cdff]::cli::config_configure
  17:     0x55b4fc1d2b7d - cargo[ca8b6ced5f41cdff]::cli::main
  18:     0x55b4fc1a43fe - cargo[ca8b6ced5f41cdff]::main
  19:     0x55b4fc1e8863 - std[ef529dfce24d46d7]::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
  20:     0x55b4fc201649 - std[ef529dfce24d46d7]::rt::lang_start::<()>::{closure#0}
  21:     0x55b4fcbbb57e - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hcfe9c7d52c619978
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/core/src/ops/function.rs:280:13
  22:     0x55b4fcbbb57e - std::panicking::try::do_call::h8c4b802eb6e4184d
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/panicking.rs:492:40
  23:     0x55b4fcbbb57e - std::panicking::try::h21616baf87e7165e
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/panicking.rs:456:19
  24:     0x55b4fcbbb57e - std::panic::catch_unwind::h9080cdb55f15d458
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/panic.rs:137:14
  25:     0x55b4fcbbb57e - std::rt::lang_start_internal::{{closure}}::hafbde1270c26291b
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/rt.rs:128:48
  26:     0x55b4fcbbb57e - std::panicking::try::do_call::h9d136e710d805d87
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/panicking.rs:492:40
  27:     0x55b4fcbbb57e - std::panicking::try::h98e01b141a9fc81b
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/panicking.rs:456:19
  28:     0x55b4fcbbb57e - std::panic::catch_unwind::h3ce8852ba8102f96
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/panic.rs:137:14
  29:     0x55b4fcbbb57e - std::rt::lang_start_internal::hf9507c4da6858514
                               at /rustc/7425fb293f510a6f138e82a963a3bc599a5b9e1c/library/std/src/rt.rs:128:20
  30:     0x55b4fc1a6482 - main
  31:     0x7f4dc6cb1237 - __libc_start_call_main
  32:     0x7f4dc6cb12f5 - __libc_start_main_impl
  33:     0x55b4fc190ce9 - <unknown>

Steps

  1. Run command
  2. See panic

Possible Solution(s)

Not running with --offline doesn't make the error occur.

Notes

Running cargo clean doesn't fix the issue

Version

✦ ❯ cargo version --verbose
cargo 1.64.0-nightly (dbff32b27 2022-06-24)
release: 1.64.0-nightly
commit-hash: dbff32b27893b899ae2397f3d56d1be111041d56
commit-date: 2022-06-24
host: x86_64-unknown-linux-gnu
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.83.1-DEV (sys:0.4.55+curl-7.83.1 vendored ssl:OpenSSL/1.1.1n)
os: NixOS 22.5.0 [64-bit]
@TheNeikos TheNeikos added the C-bug Category: bug label Jul 2, 2022
@TheNeikos
Copy link
Contributor Author

TheNeikos commented Jul 2, 2022

Maybe the Cargo.toml is also interesting:

[package]
name = "cloudmqtt"
version = "0.1.0"
edition = "2021"
authors = ["Marcel Müller <neikos@neikos.email>"]

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

[workspace]
members = ["mqtt-format"]

[[bin]]
name = "cloudmqtt-client"
required-features = ["bin"]

[features]
bin = ["clap", "tokio/rt-multi-thread", "tokio/macros"]

[dependencies]
bytes = "1.1.0"
clap = { version = "3.2.6", optional = true, features = ["derive"] }
dashmap = "5.3.4"
futures = "0.3.21"
mqtt-format = { version = "0.1.0", path = "mqtt-format" }
nom = { version = "7.1.1" }
nom-supreme = "0.8.0"
thiserror = "1.0.31"
tokio = { version = "1.19.2", default-features = false, features = [
    "net",
    "time",
    "sync",
    "macros"
] }
tokio-util = { version = "0.7.3", features = [
    "futures-io",
    "io",
    "io-util",
    "compat",
] }

[dev-dependencies]
static_assertions = "1.1.0"

@epage
Copy link
Contributor

epage commented Jul 3, 2022

Thanks for reporting this!

A fix is posted but in the mean time, cargo --offline add nom-supreme should work

bors added a commit that referenced this issue Jul 3, 2022
fix(add): Don't panic with `--offline`

For some reason, I defined my own `--offline` flag and it didn't get
updated with the global `--offline` flag, so it started failing.

The new test previously paniced and now it doesn't.

Fixes #10814
@TheNeikos
Copy link
Contributor Author

Great! Thanks for the quick fix

@bors bors closed this as completed in 18f7dfe Jul 3, 2022
Hezuikn pushed a commit to Hezuikn/cargo that referenced this issue Sep 22, 2022
For some reason, I defined my own `--offline` flag and it didn't get
updated with the global `--offline` flag, so it started failing.

Fixes rust-lang#10814
Hezuikn pushed a commit to Hezuikn/cargo that referenced this issue Sep 22, 2022
For some reason, I defined my own `--offline` flag and it didn't get
updated with the global `--offline` flag, so it started failing.

Fixes rust-lang#10814
@ehuss ehuss added the A-offline Area: offline mode label Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-offline Area: offline mode C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants