Migrate `incr-add-rust-src-component` to rmake by jieyouxu · Pull Request #134656 · rust-lang/rust

@rustbot added A-run-make

Area: port run-make Makefiles to rmake.rs

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

Dec 22, 2024

@rustbot rustbot 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

Dec 22, 2024

bors added a commit to rust-lang-ci/rust that referenced this pull request

Dec 22, 2024
…omponent, r=<try>

Migrate `incr-add-rust-src-component` to rmake

**BLOCKED: this PR depends on rust-lang#134659**
**TODO: actually write some useful PR description**

r? `@ghost`

try-job: i686-msvc
try-job: x86_64-mingw-1
try-job: x86_64-msvc
try-job: aarch64-apple

bors added a commit to rust-lang-ci/rust that referenced this pull request

Dec 22, 2024
…omponent, r=<try>

Migrate `incr-add-rust-src-component` to rmake

**BLOCKED: this PR depends on rust-lang#134659**
**TODO: actually write some useful PR description**

r? `@ghost`

try-job: i686-msvc
try-job: x86_64-mingw-1
try-job: x86_64-msvc
try-job: aarch64-apple

tgross35 added a commit to tgross35/rust that referenced this pull request

Dec 23, 2024
…Denton

test-infra: improve compiletest and run-make-support symlink handling

I was trying to implement rust-lang#134656 to port `tests/run-make/incr-add-rust-src-component.rs`, but found some blockers related to symlink handling, so in this PR I tried to resolve them by improving symlink handling in compiletest and run-make-support (particularly for native windows msvc environment).

Key changes:

- I needed to copy symlinks (duplicate a symlink pointing to the same file), so I pulled out the copy symlink logic and re-exposed it as `run_make_support::rfs::copy_symlink`. This helper correctly accounts for the Windows symlink-to-file vs symlink-to-dir distinction (hereafter "Windows symlinks") when copying symlinks.
- `recursive_remove`:
    - I needed a way to remove symlinks themselves (no symlink traversal). `std::fs::remove_dir_all` handles them, but only if the root path is a directory. So I wrapped `std::fs::remove_dir_all` to also handle when the root path is a non-directory entity (e.g. file or symlink). Again, this properly accounts for Windows symlinks.
    - I wanted to use this for both compiletest and run-make-support, so I put the implementation and accompanying tests in `build_helper`.
    - In this sense, it's a reland of rust-lang#129302 with proper test coverage.
    - It's a thin wrapper around `std::fs::remove_dir_all` (`remove_dir_all` correctly handles read-only entries on Windows). The helper has additional permission-setting logic for when the root path is a non-dir entry on Windows to handle read-only non-dir entry.

Fixes rust-lang#126334.

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Dec 23, 2024
Rollup merge of rust-lang#134659 - jieyouxu:recursive-remove, r=ChrisDenton

test-infra: improve compiletest and run-make-support symlink handling

I was trying to implement rust-lang#134656 to port `tests/run-make/incr-add-rust-src-component.rs`, but found some blockers related to symlink handling, so in this PR I tried to resolve them by improving symlink handling in compiletest and run-make-support (particularly for native windows msvc environment).

Key changes:

- I needed to copy symlinks (duplicate a symlink pointing to the same file), so I pulled out the copy symlink logic and re-exposed it as `run_make_support::rfs::copy_symlink`. This helper correctly accounts for the Windows symlink-to-file vs symlink-to-dir distinction (hereafter "Windows symlinks") when copying symlinks.
- `recursive_remove`:
    - I needed a way to remove symlinks themselves (no symlink traversal). `std::fs::remove_dir_all` handles them, but only if the root path is a directory. So I wrapped `std::fs::remove_dir_all` to also handle when the root path is a non-directory entity (e.g. file or symlink). Again, this properly accounts for Windows symlinks.
    - I wanted to use this for both compiletest and run-make-support, so I put the implementation and accompanying tests in `build_helper`.
    - In this sense, it's a reland of rust-lang#129302 with proper test coverage.
    - It's a thin wrapper around `std::fs::remove_dir_all` (`remove_dir_all` correctly handles read-only entries on Windows). The helper has additional permission-setting logic for when the root path is a non-dir entry on Windows to handle read-only non-dir entry.

Fixes rust-lang#126334.

@jieyouxu @Oneirical

The Makefile version seems to contain a bug. Over the years, the
directory structure of the `rust-src` component changed as the source
tree directory structure changed. `libstd` is no longer a thing directly
under `root/lib/rustlib/src/rust/src/`, it is moved to
`root/lib/rustlib/src/rust/library/std`.

Co-authored-by: Oneirical <manchot@videotron.ca>

@jieyouxu jieyouxu removed the S-blocked

Status: Blocked on something else such as an RFC or other implementation work.

label

Dec 23, 2024

@jieyouxu jieyouxu added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

S-blocked

Status: Blocked on something else such as an RFC or other implementation work.

labels

Dec 23, 2024

@jieyouxu jieyouxu marked this pull request as ready for review

December 23, 2024 14:07

jieyouxu

jieyouxu

@jieyouxu jieyouxu removed the S-blocked

Status: Blocked on something else such as an RFC or other implementation work.

label

Dec 23, 2024

This was referenced

Dec 23, 2024

wesleywiser

@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

Dec 26, 2024

bors added a commit to rust-lang-ci/rust that referenced this pull request

Dec 26, 2024
…llaumeGomez

Rollup of 4 pull requests

Successful merges:

 - rust-lang#134656 (Migrate `incr-add-rust-src-component` to rmake)
 - rust-lang#134664 (Account for removal of multiline span in suggestion)
 - rust-lang#134772 (Improve/cleanup rustdoc code)
 - rust-lang#134781 (Add more `begin_panic` normalizations to panic backtrace tests)

r? `@ghost`
`@rustbot` modify labels: rollup

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Dec 26, 2024
Rollup merge of rust-lang#134656 - jieyouxu:migrate-incr-add-rust-src-component, r=wesleywiser

Migrate `incr-add-rust-src-component` to rmake

This PR partially supersedes rust-lang#128562, and ports the Makefile-based `tests/run-make/incr-add-rust-src-component` to use rmake.rs infra.

Part of rust-lang#121876.

This run-make test is a regression test for rust-lang#70924. It (tries to) checks that if we add the `rust-src` component in between two incremental compiles, that the compiler doesn't ICE on the second invocation.

- Original issue:rust-lang#70924
- Fix PR: rust-lang#72767
- PR adding this regression test: rust-lang#72952

However, the Makefile version of this used `$SYSROOT/lib/rustlib/src/rust/src/libstd/lib.rs`, but that actually got moved around and reorganized over the years. As of Dec 2024, the `rust-src` component is more like (specific for our purposes):

```
$SYSROOT/lib/rustlib/src/rust/
    library/std/src/lib.rs
    src/
```

However, this run-make test is ancient and it exercises incr-comp system logic. I'm not sure if this test would actually catch the original regression.

This PR was co-authored with `@Oneirical.`

r? incremental

try-job: i686-msvc
try-job: x86_64-mingw-1
try-job: x86_64-msvc
try-job: aarch64-apple

@jieyouxu jieyouxu deleted the migrate-incr-add-rust-src-component branch

December 27, 2024 09:55

poliorcetics pushed a commit to poliorcetics/rust that referenced this pull request

Dec 28, 2024
…-component, r=wesleywiser

Migrate `incr-add-rust-src-component` to rmake

This PR partially supersedes rust-lang#128562, and ports the Makefile-based `tests/run-make/incr-add-rust-src-component` to use rmake.rs infra.

Part of rust-lang#121876.

This run-make test is a regression test for rust-lang#70924. It (tries to) checks that if we add the `rust-src` component in between two incremental compiles, that the compiler doesn't ICE on the second invocation.

- Original issue:rust-lang#70924
- Fix PR: rust-lang#72767
- PR adding this regression test: rust-lang#72952

However, the Makefile version of this used `$SYSROOT/lib/rustlib/src/rust/src/libstd/lib.rs`, but that actually got moved around and reorganized over the years. As of Dec 2024, the `rust-src` component is more like (specific for our purposes):

```
$SYSROOT/lib/rustlib/src/rust/
    library/std/src/lib.rs
    src/
```

However, this run-make test is ancient and it exercises incr-comp system logic. I'm not sure if this test would actually catch the original regression.

This PR was co-authored with `@Oneirical.`

r? incremental

try-job: i686-msvc
try-job: x86_64-mingw-1
try-job: x86_64-msvc
try-job: aarch64-apple

poliorcetics pushed a commit to poliorcetics/rust that referenced this pull request

Dec 28, 2024
…llaumeGomez

Rollup of 4 pull requests

Successful merges:

 - rust-lang#134656 (Migrate `incr-add-rust-src-component` to rmake)
 - rust-lang#134664 (Account for removal of multiline span in suggestion)
 - rust-lang#134772 (Improve/cleanup rustdoc code)
 - rust-lang#134781 (Add more `begin_panic` normalizations to panic backtrace tests)

r? `@ghost`
`@rustbot` modify labels: rollup