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

Add the ability to overide the out-dir settings passed to rust-doc #14791

Open
NovaliX-Dev opened this issue Nov 7, 2024 · 3 comments
Open
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-doc S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

Comments

@NovaliX-Dev
Copy link

NovaliX-Dev commented Nov 7, 2024

Problem

Quick definitions :

  • "Rustdoc command" means the command which doesn't involve cargo, rustdoc only.
  • "Cargo command" means the command which involve cargo, cargo rustdoc.

If we want to get the output of rustdoc to a certain location (to process them, for example), we can use the out-dir option on the rustdoc command to specify that location.

If we use the cargo command, cargo will set that option for us. That's a very good behavior in general, but that also means we can't override it with our value if we wanted to.

If we try (using for example the command cargo rustdoc -- --out-dir=<dir>), we will get that error :

error: Option 'out-dir' given more than once

If one want to override out-dir, he will have to use the rustdoc command directly, which means he will have to do all the work cargo can do. For example, handling all the source code, all the dependencies, etc. That adds a lot of overhead, especially since the rustdoc command is not obvious to set up correctly (at least that's my opinion).

Proposed Solution

Cargo should detect if the out-dir option is already present, and only fill it when it's not there.

Notes

If that feature is accepted, I'm willing to implement it myself.

@NovaliX-Dev NovaliX-Dev added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Nov 7, 2024
@epage
Copy link
Contributor

epage commented Nov 7, 2024

If we did this, we should probably tie this into #6790.

@epage epage added S-needs-team-input Status: Needs input from team on whether/how to proceed. and removed S-triage Status: This issue is waiting on initial triage. labels Nov 7, 2024
@NovaliX-Dev
Copy link
Author

NovaliX-Dev commented Nov 20, 2024

@epage do you think -w - (writing to stdout) will be supported by the issue you're mentioning ?

That would be my end goal with that feature request

@epage
Copy link
Contributor

epage commented Nov 20, 2024

I pointed out that issue for considering alignment on how the directory should work and be named. That and this issue as reported are independent of stdout support. stdout is a bit odd as this parameter is about emitting a directory of content which is at odds with stdout. If this is just about json support and if json is only about emitting a single file, we might want to consider other ways of handling that.

@epage epage added S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. and removed S-needs-team-input Status: Needs input from team on whether/how to proceed. labels Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-doc S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Projects
None yet
Development

No branches or pull requests

2 participants