Skip to content

Conversation

@hkBst
Copy link
Member

@hkBst hkBst commented Oct 17, 2025

No description provided.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 17, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 17, 2025

r? @ibraheemdev

rustbot has assigned @ibraheemdev.
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.

@rust-cloud-vms rust-cloud-vms bot force-pushed the btree-3 branch 2 times, most recently from 8e45e8f to 87755a7 Compare October 17, 2025 13:18
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Oct 17, 2025
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@joboet joboet left a comment

Choose a reason for hiding this comment

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

Yeah, this is much cleaner, thank you!

View changes since this review

Copy link
Member

Choose a reason for hiding this comment

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

Please omit the changes not related to alloc from this PR – if something breaks here, doing them in a batch makes bisecting really difficult.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure.

Comment on lines 697 to 706
match self_min.cmp(other_min) {
Less => return false,
Equal => self_iter.next(),
Greater => None,
};
let (other_min, other_max) =
if let (Some(other_min), Some(other_max)) = (other.first(), other.last()) {
(other_min, other_max)
} else {
return false; // other is empty
match self_max.cmp(other_max) {
Greater => return false,
Equal => self_iter.next_back(),
Less => None,
};
Copy link
Member

Choose a reason for hiding this comment

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

Since these values are never used, I find the None arms very confusing, so I wouldn't change this. But a comment on the next calls explaining that they remove self_min/self_max from the iteration wouldn't hurt.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Comment on lines 716 to 717
// skip over elements that are smaller
// happens up to `ITER_PERFORMANCE_TIPPING_SIZE_DIFF * self.len() - 1` times
Copy link
Member

Choose a reason for hiding this comment

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

I don't find the "happens n times" notes to be particularly helpful – it'd be better to have the comments explain why the action chosen is the right one.

Copy link
Member Author

Choose a reason for hiding this comment

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

The comments explain why this ordering is used (from most frequent to least frequent), but I'll see about adding some comments explaining correctness.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added those comments.

Greater => (),
}
}
self.is_empty()
Copy link
Member

Choose a reason for hiding this comment

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

I think it'd be better to preserve the old control flow, but express it using let-else statements. I.e.:

let (Some(self_min), Some(self_max)) = (self.first(), self.last()) else {
    // This set is empty, and the empty set is a subset of all sets.
    return true;
};

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that could work too. I'll give it a try.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is pretty nice actually! Good catch.

@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 Nov 1, 2025
@joboet joboet assigned joboet and unassigned ibraheemdev Nov 1, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 4, 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.

@hkBst
Copy link
Member Author

hkBst commented Nov 4, 2025

@joboet Thanks for your thorough review! I think I addressed all your concerns.

@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 Nov 4, 2025
@hkBst
Copy link
Member Author

hkBst commented Nov 4, 2025

@joboet BTW Are there any performance tests for BTree? I could not immediately find them...

@joboet
Copy link
Member

joboet commented Nov 6, 2025

@joboet BTW Are there any performance tests for BTree? I could not immediately find them...

There in library/alloctests/benches/btree.

Copy link
Member

@joboet joboet left a comment

Choose a reason for hiding this comment

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

This looks fine to me! I'd be interested in the benchmark results, but don't mind merging this as–is even without them – there aren't really any control-flow changes here.

View changes since this review

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 6, 2025
run-make tests: use edition 2024

Bump run-make tests to edition 2024 to prevent test failures when using 2024 idioms in included code, such as I ran into here: rust-lang#147808.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 6, 2025
run-make tests: use edition 2024

Bump run-make tests to edition 2024 to prevent test failures when using 2024 idioms in included code, such as I ran into here: rust-lang#147808.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 6, 2025
run-make tests: use edition 2024

Bump run-make tests to edition 2024 to prevent test failures when using 2024 idioms in included code, such as I ran into here: rust-lang#147808.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Nov 6, 2025
run-make tests: use edition 2024

Bump run-make tests to edition 2024 to prevent test failures when using 2024 idioms in included code, such as I ran into here: rust-lang#147808.
@hkBst
Copy link
Member Author

hkBst commented Nov 6, 2025

From running benchmarks locally I believe there is no perf impact of these changes.

@joboet
Copy link
Member

joboet commented Nov 6, 2025

All right! Then
@bors r+

@bors
Copy link
Collaborator

bors commented Nov 6, 2025

📌 Commit acd0294 has been approved by joboet

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 Nov 6, 2025
rust-timer added a commit that referenced this pull request Nov 6, 2025
Rollup merge of #148528 - hkBst:run-make-tests-1, r=jieyouxu

run-make tests: use edition 2024

Bump run-make tests to edition 2024 to prevent test failures when using 2024 idioms in included code, such as I ran into here: #147808.
bors added a commit that referenced this pull request Nov 7, 2025
Rollup of 12 pull requests

Successful merges:

 - #145768 (Offload device)
 - #145992 (Stabilize `vec_deque_pop_if`)
 - #147416 (Early return if span is from expansion so we dont get empty span and ice later on)
 - #147808 (btree: cleanup difference, intersection, is_subset)
 - #148520 (style: Use binary literals instead of hex literals in doctests for `highest_one` and `lowest_one`)
 - #148559 (Add typo suggestion for a misspelt Cargo environment variable)
 - #148567 (Fix incorrect precedence caused by range expression)
 - #148570 (Fix mismatched brackets in generated .dir-locals.el)
 - #148575 (fix dev guide link in rustc_query_system/dep_graph/README.md)
 - #148578 (core docs: add notes about availability of `Atomic*::from_mut_slice`)
 - #148603 (Backport 1.91.1 relnotes to main)
 - #148609 (Sync str::rsplit_once example with str::split_once)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4ad5a39 into rust-lang:master Nov 7, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 7, 2025
rust-timer added a commit that referenced this pull request Nov 7, 2025
Rollup merge of #147808 - hkBst:btree-3, r=joboet

btree: cleanup difference, intersection, is_subset
@hkBst hkBst deleted the btree-3 branch November 7, 2025 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library 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