Skip to content

Conversation

yotamofek
Copy link
Contributor

@yotamofek yotamofek commented Sep 27, 2025

Now that #137122 has landed, we can replace stuff that looks like:

let a: &[T];
let b: &[T];
let eq = a.len() == b.len() && a.iter().zip(b).all(|(a,b)| a == b)

with the much simpler a.iter().eq(b), without losing the perf benefit of the different-length-fast-path.
Also dogfooded Iterator::eq_by (cc #64295 ) while I'm at it.

First commit (4d1b6fa) should be very straightforward to review, second one (049a460) is slightly more creative, but IMHO a nice cleanup.

@rustbot
Copy link
Collaborator

rustbot commented Sep 27, 2025

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

Some changes occurred in compiler/rustc_builtin_macros/src/autodiff.rs

cc @ZuseZ4

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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 Sep 27, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 27, 2025

r? @fee1-dead

rustbot has assigned @fee1-dead.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

@rustbot

This comment has been minimized.

@jdonszelmann
Copy link
Contributor

r? jdonszelmann

@rustbot rustbot assigned jdonszelmann and unassigned fee1-dead Sep 27, 2025
/// `self` may contain more segments than the number matched against.
pub fn starts_with(&self, segments: &[Symbol]) -> bool {
segments.len() < self.len() && self.segments().zip(segments).all(|(a, b)| a.name == *b)
segments.len() < self.len()
Copy link
Contributor

Choose a reason for hiding this comment

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

is this really better than what was there before? you still need to take() after the less-than check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure which version I like more, but it's definitely not a clear-cut improvement so I undid this change.

@jdonszelmann
Copy link
Contributor

@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 28, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 28, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot

This comment has been minimized.

@yotamofek
Copy link
Contributor Author

@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 Sep 28, 2025
@jdonszelmann
Copy link
Contributor

r=me if you squash the two commits, don't quite see why the 2nd commit is separate from the first

@jdonszelmann
Copy link
Contributor

@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 28, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 29, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@yotamofek
Copy link
Contributor Author

r=me if you squash the two commits, don't quite see why the 2nd commit is separate from the first

The separation was just to make reviewing slightly easier :)
Squashed, thanks!
@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 Sep 29, 2025
@jdonszelmann
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Sep 29, 2025

📌 Commit 68a7c25 has been approved by jdonszelmann

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 Sep 29, 2025
bors added a commit that referenced this pull request Sep 29, 2025
Rollup of 5 pull requests

Successful merges:

 - #146653 (improve diagnostics for empty attributes)
 - #146987 (impl Ord for params and use unstable sort)
 - #147101 (Use `Iterator::eq` and (dogfood) `eq_by` in compiler and library )
 - #147123 (Fix removed version numbers of `doc_auto_cfg` and `doc_cfg_hide`)
 - #147149 (add joboet to library review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 08616a1 into rust-lang:master Sep 29, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Sep 29, 2025
rust-timer added a commit that referenced this pull request Sep 29, 2025
Rollup merge of #147101 - yotamofek:pr/iter-eq-and-eq-by, r=jdonszelmann

Use `Iterator::eq` and (dogfood) `eq_by` in compiler and library

Now that #137122 has landed, we can replace stuff that looks like:
```rust
let a: &[T];
let b: &[T];
let eq = a.len() == b.len() && a.iter().zip(b).all(|(a,b)| a == b)
```
with the much simpler `a.iter().eq(b)`, without losing the perf benefit of the different-length-fast-path.
Also dogfooded `Iterator::eq_by` (cc #64295 ) while I'm at it.

First commit (4d1b6fa) should be very straightforward to review, second one (049a460) is slightly more creative, but IMHO a nice cleanup.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Sep 30, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#146653 (improve diagnostics for empty attributes)
 - rust-lang/rust#146987 (impl Ord for params and use unstable sort)
 - rust-lang/rust#147101 (Use `Iterator::eq` and (dogfood) `eq_by` in compiler and library )
 - rust-lang/rust#147123 (Fix removed version numbers of `doc_auto_cfg` and `doc_cfg_hide`)
 - rust-lang/rust#147149 (add joboet to library review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
github-actions bot pushed a commit to rust-lang/rust-analyzer that referenced this pull request Oct 2, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#146653 (improve diagnostics for empty attributes)
 - rust-lang/rust#146987 (impl Ord for params and use unstable sort)
 - rust-lang/rust#147101 (Use `Iterator::eq` and (dogfood) `eq_by` in compiler and library )
 - rust-lang/rust#147123 (Fix removed version numbers of `doc_auto_cfg` and `doc_cfg_hide`)
 - rust-lang/rust#147149 (add joboet to library review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Oct 9, 2025
…jdonszelmann

Use `Iterator::eq` and (dogfood) `eq_by` in compiler and library

Now that rust-lang#137122 has landed, we can replace stuff that looks like:
```rust
let a: &[T];
let b: &[T];
let eq = a.len() == b.len() && a.iter().zip(b).all(|(a,b)| a == b)
```
with the much simpler `a.iter().eq(b)`, without losing the perf benefit of the different-length-fast-path.
Also dogfooded `Iterator::eq_by` (cc rust-lang#64295 ) while I'm at it.

First commit (4d1b6fa) should be very straightforward to review, second one (049a460) is slightly more creative, but IMHO a nice cleanup.
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Oct 18, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#146653 (improve diagnostics for empty attributes)
 - rust-lang/rust#146987 (impl Ord for params and use unstable sort)
 - rust-lang/rust#147101 (Use `Iterator::eq` and (dogfood) `eq_by` in compiler and library )
 - rust-lang/rust#147123 (Fix removed version numbers of `doc_auto_cfg` and `doc_cfg_hide`)
 - rust-lang/rust#147149 (add joboet to library review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

6 participants