Skip to content

Rollup of 6 pull requests #142719

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

Closed
wants to merge 20 commits into from
Closed

Rollup of 6 pull requests #142719

wants to merge 20 commits into from

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented Jun 19, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

deven and others added 20 commits June 11, 2025 00:27
Implements `trim_prefix` and `trim_suffix` methods for both `slice` and
`str` types which remove at most one occurrence of a prefix/suffix while
always returning a string/slice (rather than Option), enabling easy
method chaining.
A lot of these are large! Lots of room for improvement in the future.
A path without generic args, like `Reader`, currently has JSON produced
like this:
```
{"path":"Reader","id":286,"args":{"angle_bracketed":{"args":[],"constraints":[]}}}
```
Even though `types::Path::args` is `Option` and allows for "no args",
instead it gets represented as "empty args". (More like `Reader<>` than
`Reader`.)

This is due to a problem in `clean::Path::from_clean`. It only produces
`None` if the path is an empty string. This commit changes it to also
produce `None` if there are no generic args. The example above becomes:
```
{"path":"Reader","id":286,"args":null}
```
I looked at a few examples and saw this reduce the size of the JSON
output by 3-9%.

The commit also adds an assertion that non-final segments don't have any
generics; something the old code was implicitly relying on.

Note: the original sin here is that `clean::PathSegment::args` is not an
`Option`, unlike `{ast,hir}::PathSegment::args`. I want to fix that, but
it can be done separately.
As per the previous commit, generic args here can only appear on the
final segment. So make the comments obey that constraint.
They show up in three places: once as `Option<Box<GenericArgs>>`, once
as `Box<GenericArgs>`, and once as `GenericArgs`. The first option is
best. It is more compact because generic args are often missing. This
commit changes the latter two to the former.

Example output, before and after, for the `AssocItemConstraint` change:
```
{"name":"Offset","args":{"angle_bracketed":{"args":[],"constraints":[]}},"binding":{...}}
{"name":"Offset","args":null,"binding":{...}}
```
Example output, before and after, for the `Type::QualifiedPath` change:
```
{"qualified_path":{"name":"Offset","args":{"angle_bracketed":{"args":[],"constraints":[]}}, ...}}
{"qualified_path":{"name":"Offset","args":null, ...}}
```
This reduces JSON output size, but not by much (e.g. 0.5%), because
`AssocItemConstraint` and `Type::QualifiedPath` are uncommon.
…r=ChrisDenton,tgross35

Implement send_signal for unix child processes

Tracking issue: rust-lang#141975

There are two main differences between my implementation and the Public API section of the tracking issue. ~First, `send_signal` requires a mutable reference, like `Child::kill`.~ Second, `ChildExt` has `Sealed` as a supertrait, bringing it more in line with other extension traits like `CommandExt`.

try-job: `dist-various*`
try-job: `test-various*`
Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.

Implements `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types, which remove at most one occurrence of a prefix/suffix while always returning a string/slice (rather than Option), enabling easy method chaining.

## Tracking issue
rust-lang#142312

## API
```rust
impl str {
    pub fn trim_prefix<P: Pattern>(&self, prefix: P) -> &str;
    pub fn trim_suffix<P: Pattern>(&self, suffix: P) -> &str
    where
        for<'a> P::Searcher<'a>: ReverseSearcher<'a>;
}

impl<T> [T] {
    pub fn trim_prefix<P: SlicePattern<Item = T> + ?Sized>(&self, prefix: &P) -> &[T]
    where
        T: PartialEq;
    pub fn trim_suffix<P: SlicePattern<Item = T> + ?Sized>(&self, suffix: &P) -> &[T]
    where
        T: PartialEq;
}
```

## Examples
```rust
// Method chaining
assert_eq!(" <https://example.com/> ".trim().trim_prefix('<').trim_suffix('>').trim(), "https://example.com/");

// Slices
let v = &[10, 40, 30];
assert_eq!(v.trim_prefix(&[10]), &[40, 30][..]);
```

## ACP
Originally proposed in rust-lang/libs-team#597
…gs, r=aDotInTheVoid

rustdoc_json: improve handling of generic args

This PR fixes some inconsistencies and inefficiencies in how generic args are handled by rustdoc-json-types.

r? `@aDotInTheVoid`
…jieyouxu,Shourya742

Add config builder for bootstrap tests

I started writing a bunch of snapshot tests for build/check steps, and quickly realized that the current interface for defining them won't be enough, so I created a simple builder, which can scale to pretty much any kind of configuration in the future.
Reduce uses of `hir_crate`.

I tried rebasing my old incremental-HIR branch. This is a by-product, which is required if we want to get rid of `hir_crate` entirely.

The second commit is a drive-by cleanup. It can be pulled into its own PR.

r? `@oli-obk`
…r, r=Kobzol

add comment to `src/bootstrap/build.rs`

I attempted to remove this build script but it's apparently needed. Add a comment for why.
@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend O-unix Operating system: Unix-like 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. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jun 19, 2025
@Kobzol
Copy link
Contributor Author

Kobzol commented Jun 19, 2025

@bors r+ rollup=never p=5

@rustbot rustbot added the rollup A PR which is a rollup label Jun 19, 2025
@bors
Copy link
Collaborator

bors commented Jun 19, 2025

📌 Commit a8bc0f4 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 Jun 19, 2025
bors added a commit that referenced this pull request Jun 19, 2025
Rollup of 6 pull requests

Successful merges:

 - #141990 (Implement send_signal for unix child processes)
 - #142331 (Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.)
 - #142502 (rustdoc_json: improve handling of generic args)
 - #142629 (Add config builder for bootstrap tests)
 - #142687 (Reduce uses of `hir_crate`.)
 - #142714 (add comment to `src/bootstrap/build.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented Jun 19, 2025

⌛ Testing commit a8bc0f4 with merge bde41d9...

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-apple failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

thread 'main' panicked at src/bootstrap/src/bin/rustc.rs:278:37:

Failed to run:
DYLD_LIBRARY_PATH="/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1/lib" "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1/bin/rustc" "--crate-name" "build_script_build" "--edition=2021" "/Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.172/build.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts,future-incompat" "--crate-type" "bin" "--emit=dep-info,link" "-C" "embed-bitcode=no" "-C" "debug-assertions=off" "--cfg" "feature=\"default\"" "--cfg" "feature=\"std\"" "--check-cfg" "cfg(docsrs,test)" "--check-cfg" "cfg(feature, values(\"align\", \"const-extern-fn\", \"default\", \"extra_traits\", \"rustc-dep-of-std\", \"rustc-std-workspace-core\", \"std\", \"use_std\"))" "-C" "metadata=d64f1e34ec212474" "-C" "extra-filename=-028f8650bbcf6ecd" "--out-dir" "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1-tools/release/build/libc-028f8650bbcf6ecd" "-L" "dependency=/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1-tools/release/deps" "--cap-lints" "allow" "-Z" "binary-dep-depinfo" "--check-cfg=cfg(bootstrap)"
-------------: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread 'main' panicked at src/bootstrap/src/bin/rustc.rs:278:37:

Failed to run:
DYLD_LIBRARY_PATH="/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1/lib" "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1/bin/rustc" "--crate-name" "build_script_build" "--edition=2021" "/Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/proc-macro2-1.0.95/build.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts,future-incompat" "--crate-type" "bin" "--emit=dep-info,link" "-C" "embed-bitcode=no" "-C" "debug-assertions=off" "--cfg" "feature=\"default\"" "--cfg" "feature=\"proc-macro\"" "--check-cfg" "cfg(docsrs,test)" "--check-cfg" "cfg(feature, values(\"default\", \"nightly\", \"proc-macro\", \"span-locations\"))" "-C" "metadata=96c1846ce26f45da" "-C" "extra-filename=-1f9ba794885f5d35" "--out-dir" "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1-tools/release/build/proc-macro2-1f9ba794885f5d35" "-L" "dependency=/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1-tools/release/deps" "--cap-lints" "allow" "-Z" "binary-dep-depinfo" "--check-cfg=cfg(bootstrap)"
-------------: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: could not compile `libc` (build script)

Caused by:
  process didn't exit successfully: `/Users/runner/work/rust/rust/build/bootstrap/debug/rustc /Users/runner/work/rust/rust/build/bootstrap/debug/rustc --crate-name build_script_build --edition=2021 /Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.172/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="std"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("align", "const-extern-fn", "default", "extra_traits", "rustc-dep-of-std", "rustc-std-workspace-core", "std", "use_std"))' -C metadata=d64f1e34ec212474 -C extra-filename=-028f8650bbcf6ecd --out-dir /Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1-tools/release/build/libc-028f8650bbcf6ecd -L dependency=/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1-tools/release/deps --cap-lints allow -Z binary-dep-depinfo` (exit status: 101)
warning: build failed, waiting for other jobs to finish...
error: could not compile `proc-macro2` (build script)

Caused by:
  process didn't exit successfully: `/Users/runner/work/rust/rust/build/bootstrap/debug/rustc /Users/runner/work/rust/rust/build/bootstrap/debug/rustc --crate-name build_script_build --edition=2021 /Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/proc-macro2-1.0.95/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="proc-macro"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("default", "nightly", "proc-macro", "span-locations"))' -C metadata=96c1846ce26f45da -C extra-filename=-1f9ba794885f5d35 --out-dir /Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1-tools/release/build/proc-macro2-1f9ba794885f5d35 -L dependency=/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1-tools/release/deps --cap-lints allow -Z binary-dep-depinfo` (exit status: 101)

thread 'main' panicked at src/bootstrap/src/bin/rustc.rs:278:37:

Failed to run:
DYLD_LIBRARY_PATH="/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1/lib" "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1/bin/rustc" "--crate-name" "unicode_ident" "--edition=2018" "/Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/unicode-ident-1.0.18/src/lib.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts,future-incompat" "--crate-type" "lib" "--emit=dep-info,metadata,link" "-C" "embed-bitcode=no" "-C" "debug-assertions=off" "--check-cfg" "cfg(docsrs,test)" "--check-cfg" "cfg(feature, values())" "-C" "metadata=d38e8e13b5499f68" "-C" "extra-filename=-299c105385b37d18" "--out-dir" "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1-tools/release/deps" "-L" "dependency=/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1-tools/release/deps" "--cap-lints" "allow" "-Z" "binary-dep-depinfo" "--check-cfg=cfg(bootstrap)"
-------------: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: could not compile `unicode-ident` (lib)

Caused by:
  process didn't exit successfully: `/Users/runner/work/rust/rust/build/bootstrap/debug/rustc /Users/runner/work/rust/rust/build/bootstrap/debug/rustc --crate-name unicode_ident --edition=2018 /Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/unicode-ident-1.0.18/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=d38e8e13b5499f68 -C extra-filename=-299c105385b37d18 --out-dir /Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1-tools/release/deps -L dependency=/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage1-tools/release/deps --cap-lints allow -Z binary-dep-depinfo` (exit status: 101)
Build completed unsuccessfully in 1:06:17
  local time: Thu Jun 19 19:11:06 UTC 2025
  network time: Thu, 19 Jun 2025 19:11:06 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

@bors
Copy link
Collaborator

bors commented Jun 19, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 19, 2025
@Kobzol Kobzol closed this Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend O-unix Operating system: Unix-like rollup A PR which is a rollup 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. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants