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

bootstrap: show diagnostics relative to rustc src dir #132390

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Oct 31, 2024

Fixes #128726

Depends on rust-lang/cargo#14752 propagating to bootstrap cargo

@rustbot
Copy link
Collaborator

rustbot commented Oct 31, 2024

r? @albertlarsan68

rustbot has assigned @albertlarsan68.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Oct 31, 2024
@jieyouxu jieyouxu added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 31, 2024
@jieyouxu jieyouxu added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Oct 31, 2024
@jieyouxu
Copy link
Member

@RalfJung by "Depends on rust-lang/cargo#14752" do you mean this PR is blocked on the cargo PR being merged and synced first?

@rust-log-analyzer

This comment has been minimized.

@RalfJung
Copy link
Member Author

RalfJung commented Oct 31, 2024

@RalfJung by "Depends on rust-lang/cargo#14752" do you mean this PR is blocked on the cargo PR being merged and synced first?

That PR needs to propagate to bootstrap cargo.

bors added a commit to rust-lang/cargo that referenced this pull request Oct 31, 2024
add unstable -Zroot-dir flag to configure the path from which rustc should be invoked

This implements the proposal described [here](#9887 (comment)): we add a new flag, for now called `-Zroot-dir`, that configures the directory relative to which rustc is given the crate root filenames to build. (Files outside this directory are passed absolutely.)

This is necessary to be able to fix (no github don't close that issue yet) rust-lang/rust#128726: in multi-workspace repositories that use scripts to manage a whole bunch of cargo invocations, currently the output cargo+rustc produce is often hard or even impossible to interpret for both human and machine consumption. This is because directories in the output are always relative to the workspace root, but when cargo is invoked many times for different workspaces, it is quite unclear what the workspace root is for the invocation that failed.

So I suggest we should have a new flag that the build script in such a repo can set to the consistent "root dir" that the user would recognize as such (e.g., the root of the rustc source tree), and all paths emitted by cargo and rustc should be relative to that directory.

I don't know all the places that cargo itself emits paths (if any), but this PR changes the way we invoke rustc to honor the new flag, so all paths emitted by rustc will be relative to the `-Zroot-dir`.

See rust-lang/rust#132390 for the changes needed in rustc bootstrap to wire this up; together, that suffices to finally properly show errors in RA for all parts of the rustc src tree. :)
@RalfJung RalfJung added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 2, 2024
@albertlarsan68 albertlarsan68 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Nov 2, 2024
@albertlarsan68
Copy link
Member

@RalfJung the cargo side has been synced, r=me when CI is green after a rebase :)

@bjorn3
Copy link
Member

bjorn3 commented Nov 2, 2024

We need to wait until the cargo PR is part of the bootstrap toolchain, right?

@RalfJung
Copy link
Member Author

RalfJung commented Nov 2, 2024 via email

@jieyouxu jieyouxu added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 2, 2024
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#16 2.919 Building wheels for collected packages: reuse
#16 2.920   Building wheel for reuse (pyproject.toml): started
#16 3.163   Building wheel for reuse (pyproject.toml): finished with status 'done'
#16 3.164   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132720 sha256=026f3bb0f1aa8090b861fd0a0939cb1a782396d84c8aab7875096557d637a0f6
#16 3.164   Stored in directory: /tmp/pip-ephem-wheel-cache-2ajybnzr/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#16 3.167 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#16 3.560 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#16 3.560 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#16 DONE 3.7s
---
extracting /checkout/obj/build/cache/2024-10-16/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz
extracting /checkout/obj/build/cache/2024-10-16/rustc-beta-x86_64-unknown-linux-gnu.tar.xz
extracting /checkout/obj/build/cache/2024-10-16/cargo-beta-x86_64-unknown-linux-gnu.tar.xz
##[group]Building bootstrap
error: unknown `-Z` flag specified: root-dir
For available unstable features, see https://doc.rust-lang.org/nightly/cargo/reference/unstable.html
For available unstable features, see https://doc.rust-lang.org/nightly/cargo/reference/unstable.html
If you intended to use an unstable rustc feature, try setting `RUSTFLAGS="-Zroot-dir"`
failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml -Zroot-dir=/checkout --locked
make: *** [Makefile:98: prepare] Error 1
Command failed. Attempt 2/5:
##[group]Building bootstrap
##[group]Building bootstrap
error: unknown `-Z` flag specified: root-dir
For available unstable features, see https://doc.rust-lang.org/nightly/cargo/reference/unstable.html
For available unstable features, see https://doc.rust-lang.org/nightly/cargo/reference/unstable.html
If you intended to use an unstable rustc feature, try setting `RUSTFLAGS="-Zroot-dir"`
failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml -Zroot-dir=/checkout --locked
make: *** [Makefile:98: prepare] Error 1
Command failed. Attempt 3/5:
##[group]Building bootstrap
##[group]Building bootstrap
error: unknown `-Z` flag specified: root-dir
For available unstable features, see https://doc.rust-lang.org/nightly/cargo/reference/unstable.html
For available unstable features, see https://doc.rust-lang.org/nightly/cargo/reference/unstable.html
If you intended to use an unstable rustc feature, try setting `RUSTFLAGS="-Zroot-dir"`
failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml -Zroot-dir=/checkout --locked
make: *** [Makefile:98: prepare] Error 1
Command failed. Attempt 4/5:
##[group]Building bootstrap
##[group]Building bootstrap
error: unknown `-Z` flag specified: root-dir
For available unstable features, see https://doc.rust-lang.org/nightly/cargo/reference/unstable.html
For available unstable features, see https://doc.rust-lang.org/nightly/cargo/reference/unstable.html
If you intended to use an unstable rustc feature, try setting `RUSTFLAGS="-Zroot-dir"`
failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml -Zroot-dir=/checkout --locked
make: *** [Makefile:98: prepare] Error 1
Command failed. Attempt 5/5:
##[group]Building bootstrap
##[group]Building bootstrap
error: unknown `-Z` flag specified: root-dir
For available unstable features, see https://doc.rust-lang.org/nightly/cargo/reference/unstable.html
For available unstable features, see https://doc.rust-lang.org/nightly/cargo/reference/unstable.html
If you intended to use an unstable rustc feature, try setting `RUSTFLAGS="-Zroot-dir"`
failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml -Zroot-dir=/checkout --locked
make: *** [Makefile:98: prepare] Error 1
The command has failed after 5 attempts.
  local time: Sat Nov  2 16:05:16 UTC 2024
  network time: Sat, 02 Nov 2024 16:05:16 GMT

@RalfJung
Copy link
Member Author

The next beta branches on November 22, so I guess the bootstrap bump will be shortly after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rust-analyzer + rustc repo: build failures in the standard library are not shown in the editor any more
6 participants