Stream: t-compiler/rust-analyzer

Topic: rustc bootstrap is confusing


simulacrum (May 13 2020 at 14:49, on Zulip):

check should not need a stage argument, it's ignored entirely to my knowledge

Santiago Pastorino (May 13 2020 at 14:54, on Zulip):

@simulacrum to be honest I have no idea how check differs from build

Santiago Pastorino (May 13 2020 at 14:54, on Zulip):

I meant, other than the obvious thing that it just checks :)

simulacrum (May 13 2020 at 14:54, on Zulip):

cargo check vs. cargo build, really, except because we can't produce binaries from cargo check you are limited entirely to stage 0 basically

Santiago Pastorino (May 13 2020 at 14:54, on Zulip):

but talking about stages and params

Santiago Pastorino (May 13 2020 at 14:55, on Zulip):

for instance if I do ./x.py build --stage 1 src/libstd, edit a fail to make the compilation fail and then do ./x.py check --stage 1 src/libstd check does nothing

simulacrum (May 13 2020 at 14:56, on Zulip):

hm that rather sounds like a bug, to be honest

simulacrum (May 13 2020 at 14:56, on Zulip):

(or maybe I misunderstood you)

Santiago Pastorino (May 13 2020 at 14:57, on Zulip):

try that out :)

Santiago Pastorino (May 13 2020 at 14:57, on Zulip):

run ./x.py build --stage 1 src/libstd

simulacrum (May 13 2020 at 14:57, on Zulip):

I don't really have the time to wait that long

Santiago Pastorino (May 13 2020 at 14:57, on Zulip):

:P

simulacrum (May 13 2020 at 14:57, on Zulip):

if you post logs somewhere I can take a look later

Santiago Pastorino (May 13 2020 at 14:57, on Zulip):

but in any case, if you run that, edit a fail and then run check it doesn't file

simulacrum (May 13 2020 at 14:58, on Zulip):

is check compiling though?

simulacrum (May 13 2020 at 14:58, on Zulip):

it might also be that your rust-analyzer check is running check already

simulacrum (May 13 2020 at 14:58, on Zulip):

so when you run it manually it goes "hey everything seems to have passed"

simulacrum (May 13 2020 at 14:58, on Zulip):

though iirc cargo should print the error in that case

Santiago Pastorino (May 13 2020 at 14:58, on Zulip):

no no, this is different than the editor thing I'm talking about

Santiago Pastorino (May 13 2020 at 14:58, on Zulip):

the editor is even closed

Santiago Pastorino (May 13 2020 at 14:59, on Zulip):

let me show you because I have a build just opened

Santiago Pastorino (May 13 2020 at 14:59, on Zulip):

going to edit the file with Rust unconfigured

simulacrum (May 13 2020 at 14:59, on Zulip):

I kicked off x.py build locally at least

Santiago Pastorino (May 13 2020 at 14:59, on Zulip):

I've seen this in the past

Santiago Pastorino (May 13 2020 at 15:00, on Zulip):

this is why I never use check

simulacrum (May 13 2020 at 15:00, on Zulip):

what file did you edit?

Santiago Pastorino (May 13 2020 at 15:02, on Zulip):
[santiago@galago rust3 (master)]$ RUST_BACKTRACE=1 ./x.py build --stage 1 src/libstd
Updating only changed submodules
Submodules updated in 0.02 seconds
    Finished dev [unoptimized] target(s) in 0.16s
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized + debuginfo] target(s) in 0.15s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized + debuginfo] target(s) in 0.18s
Copying stage0 rustc from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Assembling stage1 compiler (x86_64-unknown-linux-gnu)
Building stage1 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized + debuginfo] target(s) in 0.15s
Copying stage1 std from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Build completed successfully in 0:00:01
[santiago@galago rust3 (master)]$ vim src/librustc_driver/lib.rs
[santiago@galago rust3 (master)]$ git diff
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 913ccf8e680..26416ca7713 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -15,7 +15,6 @@ extern crate lazy_static;

 pub extern crate rustc_plugin_impl as plugin;

-use rustc_ast::ast;
 use rustc_codegen_ssa::{traits::CodegenBackend, CodegenResults};
 use rustc_data_structures::profiling::print_time_passes_entry;
 use rustc_data_structures::sync::SeqCst;
[santiago@galago rust3 (master)]$ RUST_BACKTRACE=1 ./x.py check --stage 1 src/libstd
Updating only changed submodules
Submodules updated in 0.02 seconds
    Finished dev [unoptimized] target(s) in 0.14s
Checking std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized + debuginfo] target(s) in 0.17s
Build completed successfully in 0:00:01
[santiago@galago rust3 (master)]$ RUST_BACKTRACE=1 ./x.py build --stage 1 src/libstd
Updating only changed submodules
Submodules updated in 0.01 seconds
    Finished dev [unoptimized] target(s) in 0.12s
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized + debuginfo] target(s) in 0.13s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling rustc_driver v0.0.0 (/home/santiago/src/oss/rust3/src/librustc_driver)
error[E0433]: failed to resolve: use of undeclared type or module `ast`
    --> src/librustc_driver/lib.rs:1076:79
     |
1076 | fn parse_crate_attrs<'a>(sess: &'a Session, input: &Input) -> PResult<'a, Vec<ast::Attribute>> {
     |                                                                               ^^^ use of undeclared type or module `ast`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0433`.
error: could not compile `rustc_driver`.

To learn more, run the command again with --verbose.
command did not execute successfully: "/home/santiago/src/oss/rust3/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "8" "--release" "--features" " llvm" "--manifest-path" "/home/santiago/src/oss/rust3/src/rustc/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit code: 101
failed to run: /home/santiago/src/oss/rust3/build/bootstrap/debug/bootstrap build --stage 1 src/libstd
Build completed unsuccessfully in 0:00:01
Santiago Pastorino (May 13 2020 at 15:03, on Zulip):

maybe related https://github.com/rust-lang/rust/issues/69337

simulacrum (May 13 2020 at 15:06, on Zulip):

and you run x.py check?

simulacrum (May 13 2020 at 15:06, on Zulip):

or some arguments?

simulacrum (May 13 2020 at 15:06, on Zulip):

@Santiago Pastorino I have a theory -- you ran x.py check --stage 1 src/libstd

simulacrum (May 13 2020 at 15:07, on Zulip):

but that only checks libstd

simulacrum (May 13 2020 at 15:07, on Zulip):

because stage 1 is ignored

simulacrum (May 13 2020 at 15:07, on Zulip):

so you've essentially done the same as x.py build --stage 0 src/libstd

simulacrum (May 13 2020 at 15:07, on Zulip):

(except with a check)

simulacrum (May 13 2020 at 15:07, on Zulip):

I should file a PR banning --stage to check, I guess

Santiago Pastorino (May 13 2020 at 15:07, on Zulip):

:+1:

Santiago Pastorino (May 13 2020 at 15:08, on Zulip):

is there a reason why --stage doesn't work with check?

simulacrum (May 13 2020 at 15:08, on Zulip):

as I mentioned you can't produce binaries with check

simulacrum (May 13 2020 at 15:09, on Zulip):

so if you actually did do --stage 1 src/libstd we'd need to do basically x.py build --stage 0 src/rustc && x.py check --stage 1 src/libstd but that's not usually helpful and I didn't want to spend development time making it work

Santiago Pastorino (May 13 2020 at 15:09, on Zulip):

ahh I see

Santiago Pastorino (May 13 2020 at 15:09, on Zulip):

makes sense

Last update: Jul 29 2021 at 22:00UTC