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 --open no longer opens any documentation #112440

Closed
BoxyUwU opened this issue Jun 8, 2023 · 11 comments · Fixed by #112467
Closed

x doc compiler --open no longer opens any documentation #112440

BoxyUwU opened this issue Jun 8, 2023 · 11 comments · Fixed by #112467
Assignees
Labels
C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@BoxyUwU
Copy link
Member

BoxyUwU commented Jun 8, 2023

title. I ran x doc compiler --open and nothing opened, cc #111955 @jyn514 (havent actually checked that PR caused this). x doc rustc_middle --open still works

@BoxyUwU BoxyUwU 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 Jun 8, 2023
@jyn514
Copy link
Member

jyn514 commented Jun 8, 2023

whoops yeah this is definitely my fault 😅

if let Some(krate) = to_open {
needs to be let krate = to_open.unwrap_or(rustc_driver);

@jyn514 jyn514 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Jun 8, 2023
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jun 8, 2023
@sigaloid
Copy link
Contributor

sigaloid commented Jun 9, 2023

@rustbot claim

@sigaloid
Copy link
Contributor

sigaloid commented Jun 9, 2023

@jyn514 What is rustc_driver in this context? Looks like it wants a &String and "rustc_driver" doesn't seem to do the trick.

@jyn514
Copy link
Member

jyn514 commented Jun 9, 2023

@sigaloid you might need to add a temporary let binding in a higher scope so you can assign a String to it

@sigaloid
Copy link
Contributor

sigaloid commented Jun 9, 2023

        builder.run(&mut cargo.into());
        // Let's open the first crate documentation page:
        let rustc_driver = String::from("rustc_driver");
        let krate = to_open.unwrap_or(&rustc_driver);
        let index = out.join(krate).join("index.html");
        builder.open_in_browser(index);

That gives me a panic over at

t!(symlink_dir_force(&builder.config, &out, &out_dir));

Documenting compiler (stage0 -> stage1, x86_64-unknown-linux-gnu)
thread 'main' panicked at 'symlink_dir_force(&builder.config, &out, &out_dir) failed with No such file or directory (os error 2)', doc.rs:697:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/eff24c06d8f4397802b546aa2e52450e1022fc02/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/eff24c06d8f4397802b546aa2e52450e1022fc02/library/core/src/panicking.rs:67:14
   2: <bootstrap::doc::Rustc as bootstrap::builder::Step>::run
             at ./src/bootstrap/doc.rs:697:9
   3: bootstrap::builder::Builder::ensure
             at ./src/bootstrap/builder.rs:2081:23
   4: <bootstrap::doc::Rustc as bootstrap::builder::Step>::make_run
             at ./src/bootstrap/doc.rs:657:9
   5: bootstrap::builder::StepDescription::maybe_run
             at ./src/bootstrap/builder.rs:305:13
   6: bootstrap::builder::StepDescription::run
             at ./src/bootstrap/builder.rs:371:17
   7: bootstrap::builder::Builder::run_step_descriptions
             at ./src/bootstrap/builder.rs:960:9
   8: bootstrap::builder::Builder::execute_cli
             at ./src/bootstrap/builder.rs:941:9
   9: bootstrap::Build::build
             at ./src/bootstrap/lib.rs:695:13
  10: bootstrap::main
             at ./src/bootstrap/bin/main.rs:60:5
  11: core::ops::function::FnOnce::call_once
             at /rustc/eff24c06d8f4397802b546aa2e52450e1022fc02/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@jyn514
Copy link
Member

jyn514 commented Jun 9, 2023

@sigaloid does d613134 fix it?

@sigaloid
Copy link
Contributor

sigaloid commented Jun 9, 2023

It fixes the panic, but it doesn't fix the main issue (nothing opens).

@jyn514
Copy link
Member

jyn514 commented Jun 9, 2023

ok, you'll have to figure out why that didn't work and what the proper fix is.

@sigaloid
Copy link
Contributor

sigaloid commented Jun 9, 2023

Ok, some more investigation: the builder wants to open index which is "rust/build/x86_64-unknown-linux-gnu/compiler-doc/rustc_driver/index.html" but this file doesn't exist.

x doc compiler --open builds that file, except under rustc_main, however. That's not much help.

Is the idea behind your suggested fix, to compile rustc_driver if nothing else is provided, or to open the (assumedly compiled) rustc_driver docs if nothing else is provided? Currently in that run function, self.crates = []. If the former is true, then the fix would be to check for if self.crates == [] and pass the arg to cargo that way. If the latter is true, then there's a further bug in that rustc_driver isn't being compiled when it's supposed to be.

Forgive the newcomer questions! If anyone wants to fix this before me, feel free - I see the prioritize label :)

@jyn514
Copy link
Member

jyn514 commented Jun 9, 2023

If self.crates == [], that means we should build all the compiler crates. Maybe we need to add back the logic that was there before, to treat rustc_driver as the root? I guess since they're all part of the larger workspace cargo doc doesn't do the right thing by default like it does elsewhere.

@sigaloid
Copy link
Contributor

sigaloid commented Jun 9, 2023

Just to be sure: It should open this?
image

@bors bors closed this as completed in 4d36c84 Jun 10, 2023
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jun 12, 2023
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-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. 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.

5 participants