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

Prevent rmake.rs from using unstable features, and fix 3 run-make tests that currently do #137537

Merged
merged 7 commits into from
Mar 8, 2025

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Feb 24, 2025

Addresses (mostly) #137532.
Follow-up to #137373.

Summary

  • Fix 3 run-make tests that currently use unstable features:

    1. tests/run-make/issue-107495-archive-permissions/rmake.rs uses #![feature(rustc_private)] for libc on unix, but run_make_support already exports libc, so just use that.
    2. tests/run-make/cross-lang-lto/rmake.rs uses #![feature(path_file_prefix)] for convenience, replaced with similar filename prefix logic.
    3. tests/run-make/broken-pipe-no-ice/rmake.rs uses #![feature(anonymous_pipe)] for anonymous pipes. This is more complicated1, and I decided to temporarily introduce a dependency on os_pipe before std's anonymous_pipe library feature is stabilized2. I left a FIXME tracked by Prevent run-make test recipes (rmake.rs) from using *any* unstable features #137532 to make the switch once anonymous_pipe stabilizes and reaches beta.
  • Use RUSTC_BOOTSTRAP=-1 when building rmake.rs to have the stage 0 rustc reject any unstable features used in rmake.rs.

  • The requirement that rmake.rs may not use any unstable features is now documented in rustc-dev-guide.

  • This PR does not impose RUSTC_BOOTSTRAP=-1 when building run-make-support, but I suppose we could.

r? @Kobzol

try-job: x86_64-msvc-1
try-job: x86_64-mingw-1

Footnotes

  1. We can't just try to spawn rustc and immediate close the stderr handle because of race condition, as there's no guarantee rustc will not try to print to stderr before the handle gets closed.

  2. In-progress stabilization PR over at https://github.com/rust-lang/rust/pull/135822.

@jieyouxu
Copy link
Member Author

@rustbot blocked (on #137373)

@rustbot rustbot added the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Feb 24, 2025
Copy link
Contributor

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

Thanks! I think that we should do the same for run-make-support (disable unstable features), but it's probably not trivial given it is now defined by a macro. Let me know once this is rebased after my PR is merged.

@jieyouxu jieyouxu added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Feb 28, 2025
@Kobzol
Copy link
Contributor

Kobzol commented Mar 6, 2025

@rustbot label -S-blocked

@rustbot rustbot removed the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Mar 6, 2025
@jieyouxu jieyouxu added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 6, 2025
@rustbot rustbot added A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc labels Mar 6, 2025
@rustbot
Copy link
Collaborator

rustbot commented Mar 6, 2025

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes.

cc @BoxyUwU, @jieyouxu, @Kobzol

@BoxyUwU
Copy link
Member

BoxyUwU commented Mar 6, 2025

TIP: you can start your PR title with the word "wipe" and then it wont be merged, that way you can ensure it isn't merged while its still based on top of another PR

@jieyouxu
Copy link
Member Author

jieyouxu commented Mar 6, 2025

TIP: you can start your PR title with the word "wipe" and then it wont be merged, that way you can ensure it isn't merged while its still based on top of another PR

Fair. It's mostly a remark for myself though for the backlinks 😆

@jieyouxu
Copy link
Member Author

jieyouxu commented Mar 6, 2025

I think that we should do the same for run-make-support (disable unstable features), but it's probably not trivial given it is now defined by a macro.

I briefly looked at this, doesn't seem worth it to add a special hack to the ToolBuild step or add yet another thing to the macro.

So only rebased, no functional changes.
@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 6, 2025
@Kobzol
Copy link
Contributor

Kobzol commented Mar 6, 2025

Thanks, looks good! You can r=me once CI is green.

@jieyouxu
Copy link
Member Author

jieyouxu commented Mar 6, 2025

@bors r=Kobzol rollup=maybe

@bors
Copy link
Contributor

bors commented Mar 6, 2025

📌 Commit dcc4c6c has been approved by Kobzol

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 Mar 6, 2025
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Mar 7, 2025
Prevent `rmake.rs` from using unstable features, and fix 3 run-make tests that currently do

Addresses (mostly) rust-lang#137532.
Follow-up to rust-lang#137373.

### Summary

- Fix 3 run-make tests that currently use unstable features:
    1. `tests/run-make/issue-107495-archive-permissions/rmake.rs` uses `#![feature(rustc_private)]` for `libc` on `unix`, but `run_make_support` already exports `libc`, so just use that.
    2. `tests/run-make/cross-lang-lto/rmake.rs` uses `#![feature(path_file_prefix)]` for convenience, replaced with similar filename prefix logic.
    3. `tests/run-make/broken-pipe-no-ice/rmake.rs` uses `#![feature(anonymous_pipe)]` for anonymous pipes. This is more complicated[^race-condition], and I decided to temporarily introduce a dependency on [`os_pipe`] before std's `anonymous_pipe` library feature is stabilized[^pipe-stab]. I left a FIXME tracked by rust-lang#137532 to make the switch once `anonymous_pipe` stabilizes and reaches beta.
- Use `RUSTC_BOOTSTRAP=-1` when building `rmake.rs` to have the stage 0 rustc reject any unstable features used in `rmake.rs`.

- The requirement that `rmake.rs` may not use any unstable features is now documented in rustc-dev-guide.
- This PR does not impose `RUSTC_BOOTSTRAP=-1` when building `run-make-support`, but I suppose we could.

r? `@Kobzol`

[`os_pipe`]: https://github.com/oconnor663/os_pipe.rs

[^race-condition]: We can't just try to spawn `rustc` and immediate close the stderr handle because of race condition, as there's no guarantee `rustc` will not try to print to stderr before the handle gets closed.
[^pipe-stab]: In-progress stabilization PR over at rust-lang#135822.
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 7, 2025
…kingjubilee

Rollup of 12 pull requests

Successful merges:

 - rust-lang#136667 (Revert vita's c_char back to i8)
 - rust-lang#136780 (std: move stdio to `sys`)
 - rust-lang#137107 (Override default `Write` methods for cursor-like types)
 - rust-lang#137363 (compiler: factor Windows x86-32 ABI impl into its own file)
 - rust-lang#137528 (Windows: Fix error in `fs::rename` on Windows 1607)
 - rust-lang#137537 (Prevent `rmake.rs` from using unstable features, and fix 3 run-make tests that currently do)
 - rust-lang#137777 (Specialize `OsString::push` and `OsString as From` for UTF-8)
 - rust-lang#137832 (Fix crash in BufReader::peek())
 - rust-lang#137904 (Improve the generic MIR in the default `PartialOrd::le` and friends)
 - rust-lang#138115 (Suggest typo fix for static lifetime)
 - rust-lang#138125 (Simplify `printf` and shell format suggestions)
 - rust-lang#138129 (Stabilize const_char_classify, const_sockaddr_setters)

r? `@ghost`
`@rustbot` modify labels: rollup
@jhpratt
Copy link
Member

jhpratt commented Mar 7, 2025

@bors r-

#138146 (comment)

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 7, 2025
checksum = "5ffd2b0a5634335b135d5728d84c5e0fd726954b87111f7506a61c502280d982"
dependencies = [
"libc",
"windows-sys 0.59.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

Remark [RAW_DYLIB 1/2]: os_pipe depends on windows-sys which tries to link in windows.0.52.0.lib unless you pass a --cfg windows_raw_dylib. This is already what rustc / rustc tool cargo uses. I.e. the comment

// By default, windows-rs depends on a native library that doesn't get copied into the
// sysroot. Passing this cfg enables raw-dylib support instead, which makes the native
// library unnecessary. This can be removed when windows-rs enables raw-dylib
// unconditionally.

applies here.

Comment on lines +600 to 602
if let Mode::Rustc | Mode::ToolRustc | Mode::ToolBootstrap = mode {
rustflags.arg("--cfg=windows_raw_dylib");
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Remark [RAW_DYLIB 2/2]: here.

Comment on lines +418 to +420
`rmake.rs` and `run-make-support` may *not* use any nightly/unstable features,
as they must be compilable by a stage 0 rustc that may be a beta or even stable
rustc.
Copy link
Member Author

Choose a reason for hiding this comment

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

Remark: adjusted this to also say that run-make-support may not depend on nightly/unstable features.

@jieyouxu
Copy link
Member Author

jieyouxu commented Mar 7, 2025

Introducing os_pipe transitively depended on windows-sys, where the usual --cfg windows_raw_dylib workaround is needed.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 7, 2025
@jieyouxu
Copy link
Member Author

jieyouxu commented Mar 7, 2025

This passes on msvc locally, but let's try anyway.
@bors try

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 7, 2025
Prevent `rmake.rs` from using unstable features, and fix 3 run-make tests that currently do

Addresses (mostly) rust-lang#137532.
Follow-up to rust-lang#137373.

### Summary

- Fix 3 run-make tests that currently use unstable features:
    1. `tests/run-make/issue-107495-archive-permissions/rmake.rs` uses `#![feature(rustc_private)]` for `libc` on `unix`, but `run_make_support` already exports `libc`, so just use that.
    2. `tests/run-make/cross-lang-lto/rmake.rs` uses `#![feature(path_file_prefix)]` for convenience, replaced with similar filename prefix logic.
    3. `tests/run-make/broken-pipe-no-ice/rmake.rs` uses `#![feature(anonymous_pipe)]` for anonymous pipes. This is more complicated[^race-condition], and I decided to temporarily introduce a dependency on [`os_pipe`] before std's `anonymous_pipe` library feature is stabilized[^pipe-stab]. I left a FIXME tracked by rust-lang#137532 to make the switch once `anonymous_pipe` stabilizes and reaches beta.
- Use `RUSTC_BOOTSTRAP=-1` when building `rmake.rs` to have the stage 0 rustc reject any unstable features used in `rmake.rs`.

- The requirement that `rmake.rs` may not use any unstable features is now documented in rustc-dev-guide.
- This PR does not impose `RUSTC_BOOTSTRAP=-1` when building `run-make-support`, but I suppose we could.

r? `@Kobzol`

try-job: x86_64-msvc-1
try-job: x86_64-mingw-1

[`os_pipe`]: https://github.com/oconnor663/os_pipe.rs

[^race-condition]: We can't just try to spawn `rustc` and immediate close the stderr handle because of race condition, as there's no guarantee `rustc` will not try to print to stderr before the handle gets closed.
[^pipe-stab]: In-progress stabilization PR over at rust-lang#135822.
@bors
Copy link
Contributor

bors commented Mar 7, 2025

⌛ Trying commit c9c572c with merge 486bfd6...

@Kobzol
Copy link
Contributor

Kobzol commented Mar 7, 2025

You can r=me if the try job passes.

@bors
Copy link
Contributor

bors commented Mar 7, 2025

☀️ Try build successful - checks-actions
Build commit: 486bfd6 (486bfd6307b46a8c375b80de379e0f1df3440659)

@jieyouxu
Copy link
Member Author

jieyouxu commented Mar 7, 2025

@bors r=Kobzol

@bors
Copy link
Contributor

bors commented Mar 7, 2025

📌 Commit c9c572c has been approved by Kobzol

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 Mar 7, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 8, 2025
Rollup of 12 pull requests

Successful merges:

 - rust-lang#137337 (Add verbatim linker to AIXLinker)
 - rust-lang#137363 (compiler: factor Windows x86-32 ABI impl into its own file)
 - rust-lang#137537 (Prevent `rmake.rs` from using unstable features, and fix 3 run-make tests that currently do)
 - rust-lang#137606 (add a "future" edition)
 - rust-lang#137957 (Remove i586-pc-windows-msvc)
 - rust-lang#138000 (atomic: clarify that failing conditional RMW operations are not 'writes')
 - rust-lang#138013 (Add post-merge analysis CI workflow)
 - rust-lang#138033 (rustdoc: Add attribute-related tests for rustdoc JSON.)
 - rust-lang#138137 (setTargetTriple now accepts Triple rather than string)
 - rust-lang#138173 (Delay bug for negative auto trait rather than ICEing)
 - rust-lang#138184 (Allow anyone to relabel `CI-spurious-*`)
 - rust-lang#138187 (remove clones)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9c82eaf into rust-lang:master Mar 8, 2025
7 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 8, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 8, 2025
Rollup merge of rust-lang#137537 - jieyouxu:daily-rmake, r=Kobzol

Prevent `rmake.rs` from using unstable features, and fix 3 run-make tests that currently do

Addresses (mostly) rust-lang#137532.
Follow-up to rust-lang#137373.

### Summary

- Fix 3 run-make tests that currently use unstable features:
    1. `tests/run-make/issue-107495-archive-permissions/rmake.rs` uses `#![feature(rustc_private)]` for `libc` on `unix`, but `run_make_support` already exports `libc`, so just use that.
    2. `tests/run-make/cross-lang-lto/rmake.rs` uses `#![feature(path_file_prefix)]` for convenience, replaced with similar filename prefix logic.
    3. `tests/run-make/broken-pipe-no-ice/rmake.rs` uses `#![feature(anonymous_pipe)]` for anonymous pipes. This is more complicated[^race-condition], and I decided to temporarily introduce a dependency on [`os_pipe`] before std's `anonymous_pipe` library feature is stabilized[^pipe-stab]. I left a FIXME tracked by rust-lang#137532 to make the switch once `anonymous_pipe` stabilizes and reaches beta.
- Use `RUSTC_BOOTSTRAP=-1` when building `rmake.rs` to have the stage 0 rustc reject any unstable features used in `rmake.rs`.

- The requirement that `rmake.rs` may not use any unstable features is now documented in rustc-dev-guide.
- This PR does not impose `RUSTC_BOOTSTRAP=-1` when building `run-make-support`, but I suppose we could.

r? `@Kobzol`

try-job: x86_64-msvc-1
try-job: x86_64-mingw-1

[`os_pipe`]: https://github.com/oconnor663/os_pipe.rs

[^race-condition]: We can't just try to spawn `rustc` and immediate close the stderr handle because of race condition, as there's no guarantee `rustc` will not try to print to stderr before the handle gets closed.
[^pipe-stab]: In-progress stabilization PR over at rust-lang#135822.
@jieyouxu jieyouxu deleted the daily-rmake branch March 8, 2025 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs A-rustc-dev-guide Area: rustc-dev-guide 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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants