Skip to content

x doc compiler/rustc panics #95447

Closed
@jyn514

Description

@jyn514

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions