Skip to content

rustdoc: error[E0463]: can't find crate for std #96177

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

Closed
GuillaumeGomez opened this issue Apr 18, 2022 · 4 comments
Closed

rustdoc: error[E0463]: can't find crate for std #96177

GuillaumeGomez opened this issue Apr 18, 2022 · 4 comments
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@GuillaumeGomez
Copy link
Member

With the last upstream rust, whenever I build rustdoc (with x.py doc std --stage 1) and try to use it on this code:

pub struct Foo(u8);

I get the following output:

$ ./build/x86_64-unknown-linux-gnu/stage1/bin/rustdoc foo.rs 
error[E0463]: can't find crate for `std`

error: Compilation failed, aborting rustdoc

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0463`.

I tried with stage 2 but got the same error as well. Anyone has an idea what's going on?

@GuillaumeGomez GuillaumeGomez added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. labels Apr 18, 2022
@Mark-Simulacrum
Copy link
Member

Cc @jyn514

I suspect that this is related to some of the recent changes in this area - it's not clear to me that the command above should put std in the sysroot, but I can see how it might be expected too.

@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented Apr 18, 2022

I've been using it for years so it was quite surprising. @jyn514 wrote that to build std sysroot, you now need to run x.py build --stage 1 library/std src/tools/rustdoc.

So the question I guess now is: should x.py doc std put std in the sysroot? Also I'm curious why it was changed.

@jyn514
Copy link
Member

jyn514 commented Apr 19, 2022

So the question I guess now is: should x.py doc std put std in the sysroot? Also I'm curious why it was changed.

This is caused by #95450; it was intentional not to add these to the sysroot because it requires fully building the artifacts instead of only checking them. I don't think doc should add these to the sysroot, no, it's a separate thing conceptually than building the artifacts. The fact that it happened to work for so long is just an accident.

@jyn514 wrote that to build std sysroot, you now need to run x.py build --stage 1 library/std src/tools/rustdoc.

that's the long form - you can also just use x build and it will do the same.

@GuillaumeGomez
Copy link
Member Author

Thanks for the explanations!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

3 participants