Skip to content

Cleanup rust-src remapping and real dir #142318

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

Merged
merged 1 commit into from
Jun 12, 2025

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Jun 10, 2025

When remapping, bootstrap sets CFG_VIRTUAL_RUST_SOURCE_BASE_DIR to indicate what the base build dir (/ of this repo) was remapped to, ie. /rustc/....

It is therefore impossible when stripping /rustc/... from a remapped path to be inside the our library/ directory, nevertheless we have code that assumed it was possible and helpfully tried to correct it. I don't why this was done, but it's not necessary.

The normalization in compiletest of $SRC_DIR_REAL was also slightly wrong, it ate the library part for no reason. EDIT: there is a reason, it affects too much tests otherwise

r? @jieyouxu

@rustbot
Copy link
Collaborator

rustbot commented Jun 10, 2025

jieyouxu is not on the review rotation at the moment.
They may take a while to respond.

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 10, 2025

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rust-log-analyzer

This comment has been minimized.

@Urgau Urgau force-pushed the cleanup-rust-src-remap branch from 3679077 to 1861535 Compare June 11, 2025 05:33
@Urgau Urgau force-pushed the cleanup-rust-src-remap branch from 1861535 to 208f2e4 Compare June 11, 2025 05:43
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm yeah, that seems reasonable. Thanks

@jieyouxu
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 11, 2025

📌 Commit 208f2e4 has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 11, 2025
@jieyouxu jieyouxu added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. A-path-remapping Area: path remapping, --remap-path-prefix, --remap-cwd-prefix, --remap-diagnostics-scope etc. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. A-compiletest Area: The compiletest test runner labels Jun 11, 2025
bors added a commit that referenced this pull request Jun 12, 2025
Rollup of 10 pull requests

Successful merges:

 - #141307 (Add method to retrieve body of closure in stable-mir)
 - #142040 (transmutability: shift abstraction boundary)
 - #142066 (More simple 2015 edition test decoupling)
 - #142157 (rustc_resolve: Improve `resolve_const_param_in_non_trivial_anon_const` wording)
 - #142217 (`tests/ui`: A New Order [10/N])
 - #142219 (`tests/ui`: A New Order [11/N])
 - #142261 (use correct edition when warning for unsafe attributes)
 - #142303 (Assorted bootstrap cleanups (step 1))
 - #142318 (Cleanup `rust-src` remapping and real dir)
 - #142352 (compiler: Make `c_int_width` an integer)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 78d8395 into rust-lang:master Jun 12, 2025
10 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 12, 2025
rust-timer added a commit that referenced this pull request Jun 12, 2025
Rollup merge of #142318 - Urgau:cleanup-rust-src-remap, r=jieyouxu

Cleanup `rust-src` remapping and real dir

When remapping, `bootstrap` sets `CFG_VIRTUAL_RUST_SOURCE_BASE_DIR` to indicate what the base build dir (`/` of this repo) was remapped to, ie. `/rustc/...`.

It is therefore impossible when stripping `/rustc/...` from a remapped path to be inside the our `library/` directory, nevertheless we have code that assumed it was possible and helpfully tried to correct it. I don't why this was done, but it's not necessary.

~~The normalization in compiletest of `$SRC_DIR_REAL` was also slightly wrong, it ate the `library` part for no reason.~~ EDIT: there is a reason, it affects too much tests otherwise

r? `@jieyouxu`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-path-remapping Area: path remapping, --remap-path-prefix, --remap-cwd-prefix, --remap-diagnostics-scope etc. A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants