Stream: t-compiler/help

Topic: components for custom rustc


eddyb (Apr 18 2020 at 20:48, on Zulip):

you have to build it

eddyb (Apr 18 2020 at 20:48, on Zulip):

or, wait hmm

eddyb (Apr 18 2020 at 20:49, on Zulip):

@Tshepang Lekhonkhobe you may need to make the default nightly and then use cargo +dev fmt

eddyb (Apr 18 2020 at 20:49, on Zulip):

that way, if it doesn't exist for the local toolchain, it will use the default. that's what it does for Cargo, anyway

eddyb (Apr 18 2020 at 20:49, on Zulip):

I might be confusing this though

Tshepang Lekhonkhobe (Apr 18 2020 at 23:22, on Zulip):

using cargo +stable fmt works, but I wanted to use the rustfmt I built

eddyb (Apr 19 2020 at 04:29, on Zulip):

@Tshepang Lekhonkhobe how did you build rustfmt?

eddyb (Apr 19 2020 at 04:30, on Zulip):

you shouldn't be getting that error if you did build it

eddyb (Apr 19 2020 at 04:30, on Zulip):

oh also how did you create the dev toolchain? what rustup link command did you use?

Tshepang Lekhonkhobe (Apr 19 2020 at 04:36, on Zulip):

I used this in config.toml

[build]
extended = true

I created toolchain with

./x.py build --incremental --stage 1 [--keep-stage 1]

I also used this

rustup toolchain link dev ~/rust/rustc/build/x86_64-unknown-linux-gnu/stage1
eddyb (Apr 19 2020 at 04:52, on Zulip):

@Tshepang Lekhonkhobe okay, what does ls ~/rust/rustc/build/x86_64-unknown-linux-gnu/stage1/bin show?

eddyb (Apr 19 2020 at 04:53, on Zulip):

also, you can put incremental = true into config.toml and then you never have to add it manually to commands

Tshepang Lekhonkhobe (Apr 19 2020 at 04:55, on Zulip):

eddyb said:

Tshepang Lekhonkhobe okay, what does ls ~/rust/rustc/build/x86_64-unknown-linux-gnu/stage1/bin show?

it's just rustc and rustdoc in there

eddyb (Apr 19 2020 at 04:55, on Zulip):

I suspected as much

eddyb (Apr 19 2020 at 04:55, on Zulip):

I think you have to do ./x.py build

eddyb (Apr 19 2020 at 04:55, on Zulip):

no --stage and no --keep-stage

eddyb (Apr 19 2020 at 04:55, on Zulip):

maybe --keep-stage 1 but I don't recommend it, it will likely break your build

eddyb (Apr 19 2020 at 04:55, on Zulip):

and then link stage2 not stage1

eddyb (Apr 19 2020 at 04:56, on Zulip):

that is, I don't think we build any tools at stage2, only stage1

eddyb (Apr 19 2020 at 04:56, on Zulip):

@Tshepang Lekhonkhobe oh wait there might be a way to force it

eddyb (Apr 19 2020 at 04:56, on Zulip):

try ./x.py build --stage 1 src/tools/rustfmt

eddyb (Apr 19 2020 at 04:57, on Zulip):

wait, no, ./x.py build --stage 0 src/tools/rustfmt

eddyb (Apr 19 2020 at 04:57, on Zulip):

god I hate the stage numbering, maybe one day we can just remove it

Tshepang Lekhonkhobe (Apr 19 2020 at 05:02, on Zulip):

/me I need a more strong machine

eddyb (Apr 19 2020 at 05:03, on Zulip):

try my last command

eddyb (Apr 19 2020 at 05:03, on Zulip):

it shouldn't be as bad as a full build

eddyb (Apr 19 2020 at 05:03, on Zulip):

sorry for not realizing this earlier

Tshepang Lekhonkhobe (Apr 19 2020 at 05:04, on Zulip):

command is done... what should I see

eddyb (Apr 19 2020 at 05:05, on Zulip):

check that directory again

eddyb (Apr 19 2020 at 05:05, on Zulip):

does it have rustfmt and cargo-fmt now?

eddyb (Apr 19 2020 at 05:05, on Zulip):

(assuming it did something)

Tshepang Lekhonkhobe (Apr 19 2020 at 05:05, on Zulip):

it doesn't... just rustc and rustdoc

eddyb (Apr 19 2020 at 05:05, on Zulip):

okay what did the build --stage 0 src/tools/rustfmt print?

Tshepang Lekhonkhobe (Apr 19 2020 at 05:07, on Zulip):
❯ ./x.py build --incremental --stage 0 src/tools/rustfmt
Updating only changed submodules
Submodules updated in 0.02 seconds
    Finished dev [unoptimized] target(s) in 0.11s
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.14s
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] target(s) in 0.17s
Copying stage0 rustc from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 tool rustfmt (x86_64-unknown-linux-gnu)
   Compiling syn v0.15.35
   Compiling proc-macro2 v1.0.3
...
eddyb (Apr 19 2020 at 05:08, on Zulip):

okay how did it end?

eddyb (Apr 19 2020 at 05:08, on Zulip):

the last 5 lines or so

Tshepang Lekhonkhobe (Apr 19 2020 at 05:08, on Zulip):
...
   Compiling rustc-ap-rustc_errors v654.0.0
   Compiling rustc-ap-rustc_ast_pretty v654.0.0
   Compiling rustc-ap-rustc_session v654.0.0
   Compiling rustc-ap-rustc_parse v654.0.0
   Compiling rustc-ap-rustc_attr v654.0.0
   Compiling rustc-ap-rustc_ast_passes v654.0.0
   Compiling rustc-ap-rustc_expand v654.0.0
    Finished release [optimized] target(s) in 4m 43s
Build completed successfully in 0:04:44
eddyb (Apr 19 2020 at 05:09, on Zulip):

hmmmmm

Tshepang Lekhonkhobe (Apr 19 2020 at 05:09, on Zulip):

doing --stage 1 now, in case

eddyb (Apr 19 2020 at 05:10, on Zulip):

does stage0-tools or stage0-tools-bin exist? in build/ x86_64-unknown-linux-gnu?

eddyb (Apr 19 2020 at 05:10, on Zulip):

it might just not be copying it to stage1/bin

eddyb (Apr 19 2020 at 05:10, on Zulip):

cc @simulacrum

Tshepang Lekhonkhobe (Apr 19 2020 at 05:10, on Zulip):

what does specifying a stage mean in this case?

eddyb (Apr 19 2020 at 05:10, on Zulip):

I assume the same thing it does for build src/rustc

eddyb (Apr 19 2020 at 05:11, on Zulip):

build --stage 0 src/rustc is what build --stage 1 src/libstd does before copying the rustc binary it creates to stage1/bin/rustc and using it to build std

Tshepang Lekhonkhobe (Apr 19 2020 at 05:11, on Zulip):

hm, I see rustfmt in ~/rust/rustc/build/x86_64-unknown-linux-gnu/stage1-tools-bin/

Tshepang Lekhonkhobe (Apr 19 2020 at 05:12, on Zulip):

but that's from earlier today

eddyb (Apr 19 2020 at 05:12, on Zulip):

no, stage0

Tshepang Lekhonkhobe (Apr 19 2020 at 05:12, on Zulip):

ah, there is actually

eddyb (Apr 19 2020 at 05:12, on Zulip):

stage0-rustc/.../rustc gets copied (or hardlinked, rather) into stage1/bin/rustc

eddyb (Apr 19 2020 at 05:13, on Zulip):

you can do the same for the rustfmt and cargo-fmt I guess

Tshepang Lekhonkhobe (Apr 19 2020 at 05:13, on Zulip):

what I just build (with --stage 0 command you gave) ended up in ~/rust/rustc/build/x86_64-unknown-linux-gnu/stage0-tools-bin/

eddyb (Apr 19 2020 at 05:14, on Zulip):

makes sense

eddyb (Apr 19 2020 at 05:14, on Zulip):

ln build/x86_64-unknown-linux-gnu/stage0-tools-bin/* build/x86_64-unknown-linux-gnu/stage1/bin/

eddyb (Apr 19 2020 at 05:14, on Zulip):

this might just work

Tshepang Lekhonkhobe (Apr 19 2020 at 05:56, on Zulip):

it did not work...

error: 'cargo-fmt' is not installed for the toolchain 'dev'

eddyb (Apr 19 2020 at 06:12, on Zulip):

is there no cargo-fmt in there?

eddyb (Apr 19 2020 at 06:12, on Zulip):

I'm out of ideas

eddyb (Apr 19 2020 at 06:12, on Zulip):

you probably need @simulacrum

Tshepang Lekhonkhobe (Apr 19 2020 at 06:15, on Zulip):

yeah, there is... maybe extra steps are needed

Last update: Sep 27 2020 at 14:00UTC