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

rust-analyzer went into the wrong dir (maybe?) #137526

Closed
chenzhuoyu opened this issue Feb 24, 2025 · 8 comments
Closed

rust-analyzer went into the wrong dir (maybe?) #137526

chenzhuoyu opened this issue Feb 24, 2025 · 8 comments
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@chenzhuoyu
Copy link

Summary

Building the HEAD version (e0be1a02626abef2878cb7f4aaef7ae409477112 as I'm writing this issue) with:

./x.py build --stage 2 library rustfmt clippy rust-analyzer

causes the rust-analyzer binary goes into stage1-tools-bin rather than stage2-tools-bin

Command used

./x.py build --stage 2 library rustfmt clippy rust-analyzer

Then find the rust-analyzer

find . -type f -name 'rust-analyzer'

Expected behaviour

According to rustc-dev-guide, the rust-analyzer should be built with the stage2 compiler, thus we should find it in stage2-tools-bin

Image

Actual behaviour

The rust-analyzer is found in stage1-tools-bin

Image

Bootstrap configuration (config.toml)

profile = "compiler"
change-id = 137215

[llvm]
assertions = true
release-debuginfo = true
download-ci-llvm = false

Operating system

ArchLinux x86_64

HEAD

e0be1a02626abef2878cb7f4aaef7ae409477112

Additional context

Yes, we do have custom patches, but not within the build system, so we think it's irrelevant for this issue.

This issue does not occure until recent days, the rust-analyzer binary was always found in stage2-tools-bin, but it suddenly moved to stage1-tools-bin, is this the expected behavior?

@chenzhuoyu chenzhuoyu added C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Feb 24, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 24, 2025
@onur-ozkan
Copy link
Member

This issue does not occure until recent days, the rust-analyzer binary was always found in stage2-tools-bin, but it suddenly moved to stage1-tools-bin, is this the expected behavior?

It is the expected behavior. Previously, it was unnecessarily building an extra stage. #137215 fixed that incorrect logic. You should look in the stageN/bin directory not stageN-tools-bin. In your case, you can find the binaries under stage2/bin.

@onur-ozkan onur-ozkan added C-discussion Category: Discussion or questions that doesn't represent real issues. and removed C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 24, 2025
@chenzhuoyu
Copy link
Author

@onur-ozkan But rust-analyzer is only found in stage1-tools-bin, not in stage2/bin. So what is the intended way to get a custom-built rust-analyzer?

Image

@onur-ozkan
Copy link
Member

I see it looks like you are only building rust-analyzer. rust-analyzer is a compiler tool and its staging logic is very similar to how we build rustc. When you build stage1 rustc it's first built in stage0 artifacts and then copied to the stage1 directory. The same applies to rustc tools. The stage1-bin-tool/rust-analyzer is actually the stage2 rust-analyzer. (I know the naming is confusing but that's how it works for now).

@chenzhuoyu
Copy link
Author

@onur-ozkan Oh, that makes sense. Thanks so much 😊

@chenzhuoyu
Copy link
Author

@onur-ozkan It looks like that I also get a wrong clippy ....

Image

@chenzhuoyu
Copy link
Author

chenzhuoyu commented Feb 24, 2025

@onur-ozkan This is clippy-driver, not clippy ... Which causes cargo clippy to fail after rustup toolchain link ...

$ cargo clippy
error: couldn't read `clippy`: No such file or directory (os error 2)

error: aborting due to 1 previous error

@onur-ozkan
Copy link
Member

That was a bug and thanks for reporting it. #137541 should fix that.

@onur-ozkan
Copy link
Member

Closing this issue as it's not related with the problem we are talking about. Feel free to open another one if needed.

@onur-ozkan onur-ozkan closed this as not planned Won't fix, can't repro, duplicate, stale Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

3 participants