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

cargo udeps panic #62

Closed
Sherlock-Holo opened this issue Mar 14, 2020 · 5 comments · Fixed by #63
Closed

cargo udeps panic #62

Sherlock-Holo opened this issue Mar 14, 2020 · 5 comments · Fixed by #63
Labels
bug Something isn't working

Comments

@Sherlock-Holo
Copy link

when I run cargo udeps for my project, the udeps panic, it panic at

errorthread '<unnamed>' panicked at 'invalid format for extern arg: proc_macro', /home/sherlock/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/cargo-udeps-0.1.9/src/lib.rs:580:25: worker panicked

image

however I run cargo check, it runs successfully.

@est31
Copy link
Owner

est31 commented Mar 14, 2020

Do you have a minimally reproducible example?

@Sherlock-Holo
Copy link
Author

my project is a littile big, link

I will try to find a minimally reproducible example, and you can download my project to find out why panic. Sorry for I can't find a minimally reproducible example at first time

@est31
Copy link
Owner

est31 commented Mar 14, 2020

Nevermind I have found an example. It seems to occur in cargo-udeps 0.1.9 first. Thanks for the report.

To reproduce one needs to clone https://github.com/dtolnay/proc-macro-hack and then run cargo +nightly udeps -p demo-hack in it.

@est31 est31 added the bug Something isn't working label Mar 14, 2020
@qryxip
Copy link
Collaborator

qryxip commented Mar 14, 2020

Probably because of this.

this change will mean that you can delete the extern crate proc_macro; line

$ rustc +1.35.0 --help -v | rg -- --extern
        --extern NAME=PATH
        --extern-private NAME=PATH
$ rustc +stable --help -v | rg -- --extern
        --extern NAME[=PATH]
$ touch src/lib.rs && cargo +nightly check -v
       Fresh unicode-xid v0.2.0
       Fresh proc-macro2 v1.0.9
       Fresh quote v1.0.3
       Fresh syn v1.0.16
    Checking proc-macro-hack v0.5.11 (/home/ryo/src/github.com/dtolnay/proc-macro-hack)
     Running `rustc --crate-name proc_macro_hack --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type proc-macro --emit=dep-info,metadata -C prefer-dynamic -C debuginfo=2 -C metadata=60734e183005d2f3 -C extra-filename=-60734e183005d2f3 --out-dir /home/ryo/src/github.com/dtolnay/proc-macro-hack/target/debug/deps -C incremental=/home/ryo/src/github.com/dtolnay/proc-macro-hack/target/debug/incremental -L dependency=/home/ryo/src/github.com/dtolnay/proc-macro-hack/target/debug/deps --extern proc_macro2=/home/ryo/src/github.com/dtolnay/proc-macro-hack/target/debug/deps/libproc_macro2-4610c0a0f83155c0.rmeta --extern quote=/home/ryo/src/github.com/dtolnay/proc-macro-hack/target/debug/deps/libquote-68ac4f6b444e17b8.rmeta --extern syn=/home/ryo/src/github.com/dtolnay/proc-macro-hack/target/debug/deps/libsyn-5ffea411d71f0934.rmeta --extern proc_macro`
    Finished dev [unoptimized + debuginfo] target(s) in 0.21s

cargo-udeps/src/lib.rs

Lines 576 to 581 in 80b1060

let mut splitter = a.split("=");
if let (Some(n), Some(p)) = (splitter.next(), splitter.next()) {
(n.to_owned(), p.to_owned())
} else {
panic!("invalid format for extern arg: {}", a);
}

@est31
Copy link
Owner

est31 commented Mar 14, 2020

Thanks @qryxip for the quick fix. I've released 0.1.10 because of the large impact of the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants