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 clean -p does not clean documentation #8790

Open
jyn514 opened this issue Oct 16, 2020 · 5 comments
Open

cargo clean -p does not clean documentation #8790

jyn514 opened this issue Oct 16, 2020 · 5 comments
Labels

Comments

@jyn514
Copy link
Member

jyn514 commented Oct 16, 2020

Problem

cargo clean -p package should remove target/doc/package, but does not.

Steps

$ cargo new test-doc
     Created binary (application) `test-doc` package
$ cd test-doc
Cargo.toml  src
$ cargo doc
 Documenting test-doc v0.1.0 (/home/joshua/src/rust/test-doc)
    Finished dev [unoptimized + debuginfo] target(s) in 0.70s
$ ls target/doc
ayu.css                main.js                      source-files.js
brush.svg              normalize.css                source-script.js
COPYRIGHT.txt          noscript.css                 SourceSerifPro-Bold.ttf.woff
dark.css               rustdoc.css                  SourceSerifPro-It.ttf.woff
down-arrow.svg         rust-logo.png                SourceSerifPro-LICENSE.md
favicon.ico            search-index.js              SourceSerifPro-Regular.ttf.woff
FiraSans-LICENSE.txt   settings.css                 src
FiraSans-Medium.woff   settings.html                storage.js
FiraSans-Regular.woff  settings.js                  test_doc
LICENSE-APACHE.txt     SourceCodePro-LICENSE.txt    theme.js
LICENSE-MIT.txt        SourceCodePro-Regular.woff   wheel.svg
light.css              SourceCodePro-Semibold.woff
$ cargo clean -p test-doc
$ ls target/doc
ayu.css                main.js                      source-files.js
brush.svg              normalize.css                source-script.js
COPYRIGHT.txt          noscript.css                 SourceSerifPro-Bold.ttf.woff
dark.css               rustdoc.css                  SourceSerifPro-It.ttf.woff
down-arrow.svg         rust-logo.png                SourceSerifPro-LICENSE.md
favicon.ico            search-index.js              SourceSerifPro-Regular.ttf.woff
FiraSans-LICENSE.txt   settings.css                 src
FiraSans-Medium.woff   settings.html                storage.js
FiraSans-Regular.woff  settings.js                  test_doc
LICENSE-APACHE.txt     SourceCodePro-LICENSE.txt    theme.js
LICENSE-MIT.txt        SourceCodePro-Regular.woff   wheel.svg
light.css              SourceCodePro-Semibold.woff
$ cargo clean
$ ls target/doc
ls: cannot access 'target/doc': No such file or directory

Possible Solution(s)

Notes

Output of cargo version:

cargo 1.47.0 (f3c7e06 2020-08-28), but the bug is also present in cargo 1.48.0-nightly (9d1a4863a 2020-10-05).

@jyn514 jyn514 added the C-bug Category: bug label Oct 16, 2020
@ehuss
Copy link
Contributor

ehuss commented Oct 20, 2020

I think part of the problem is that the search index would be broken since it would contain references to the now missing package.

@jyn514
Copy link
Member Author

jyn514 commented Oct 20, 2020

🤷 that seems like a reasonable tradeoff if the user explicitly opted-in to removing the documentation. This isn't specific to the search index, there could also be links in the downstream docs that are now broken.

@heisen-li
Copy link
Contributor

heisen-li commented Aug 24, 2021

Hello, because you may be busy, do not have time to do such simple things.
I'm getting familiar with the cargo source code, which is interesting to me. Does this issue need to be fixed? Or have you guys not figured it out yet?

@ehuss
Copy link
Contributor

ehuss commented Aug 24, 2021

I think it would probably be fine to support this. I still think it could be confusing since things like the index won't be updated, but I also don't expect this to be needed too often.

@heisen-li
Copy link
Contributor

@rustbot claim

ehuss added a commit to ehuss/cargo that referenced this issue Sep 7, 2023
Currently the `-p` is ignored. This should help with any confusion
about the interaction of different flags.
rust-lang#8790 is tracking to fix this.
ehuss added a commit to ehuss/cargo that referenced this issue Sep 7, 2023
Currently the `-p` is ignored. This should help with any confusion
about the interaction of different flags.
rust-lang#8790 is tracking to fix this.
ehuss added a commit to ehuss/cargo that referenced this issue Sep 7, 2023
Currently the `-p` is ignored. This should help with any confusion
about the interaction of different flags.
rust-lang#8790 is tracking to fix this.
bors added a commit that referenced this issue Sep 7, 2023
Error out if `cargo clean --doc` is mixed with `-p`.

This changes `cargo clean --doc -p foo` to generate an error instead of ignoring the `-p` flag. There is still an outstanding issue #8790 tracking this. It *should* support `-p`, but until it is supported, I think cargo should tell you that the flag is ignored. This is also in preparation for some code changes in #12634 which needs to handle any combination of various different clean flags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants