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

x doc compiler/rustc panics #95447

Closed
jyn514 opened this issue Mar 29, 2022 · 2 comments · Fixed by #95502
Closed

x doc compiler/rustc panics #95447

jyn514 opened this issue Mar 29, 2022 · 2 comments · Fixed by #95502
Labels
C-bug Category: This is a bug. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jyn514
Copy link
Member

jyn514 commented Mar 29, 2022

I tried this code: x doc compiler/rustc --stage 0

I expected to see this happen: bootstrap documents the whole compiler, like it does for x doc compiler.

Instead, this happened:

thread 'main' panicked at 'no entry found for key', src/bootstrap/lib.rs:1324:26

The problem is that impl Step for Rustc is too naive and expects the name of each crate to match its file path on disk:

rust/src/bootstrap/doc.rs

Lines 625 to 633 in 05d2221

if !builder.src.join("compiler").join(&root_crate).exists() {
builder.info(&format!(
"\tskipping - compiler/{} (unknown compiler crate)",
root_crate
));
} else {
compiler_crates.extend(
builder
.in_tree_crates(root_crate, Some(target))

rust/src/bootstrap/lib.rs

Lines 1319 to 1324 in 05d2221

fn in_tree_crates(&self, root: &str, target: Option<TargetSelection>) -> Vec<&Crate> {
let mut ret = Vec::new();
let mut list = vec![INTERNER.intern_str(root)];
let mut visited = HashSet::new();
while let Some(krate) = list.pop() {
let krate = &self.crates[&krate];

It needs to map from the path to the name somehow. There's already a way to go from the name to the path:

rust/src/bootstrap/lib.rs

Lines 320 to 322 in 05d2221

impl Crate {
fn local_path(&self, build: &Build) -> PathBuf {
self.path.strip_prefix(&build.config.src).unwrap().into()

but I don't think there's a way to do the reverse.

Meta

HEAD is 11909e3.

@rustbot label +A-bootstrap

@jyn514 jyn514 added the C-bug Category: This is a bug. label Mar 29, 2022
@jyn514
Copy link
Member Author

jyn514 commented Mar 29, 2022

@rustbot label: +A-bootstrap

@jyn514
Copy link
Member Author

jyn514 commented Mar 30, 2022

@rustbot label: +E-mentor +A-rustbuild

@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Mar 30, 2022
@bors bors closed this as completed in 341883d Apr 10, 2022
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. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants