-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Rollup of 6 pull requests #115940
Rollup of 6 pull requests #115940
Conversation
Add `minmax{,_by,_by_key}` functions to `core::cmp` This PR adds the following functions: ```rust // mod core::cmp #![unstable(feature = "cmp_minmax")] pub fn minmax<T>(v1: T, v2: T) -> [T; 2] where T: Ord; pub fn minmax_by<T, F>(v1: T, v2: T, compare: F) -> [T; 2] where F: FnOnce(&T, &T) -> Ordering; pub fn minmax_by_key<T, F, K>(v1: T, v2: T, mut f: F) -> [T; 2] where F: FnMut(&T) -> K, K: Ord; ``` (they are also `const` under `#[feature(const_cmp)]`, I've omitted `const` stuff for simplicity/readability) ---- Semantically these functions are equivalent to `{ let mut arr = [v1, v2]; arr.sort(); arr }`, but since they operate on 2 elements only, they are implemented as a single comparison. Even though that's basically a sort, I think "sort 2 elements" operation is useful on it's own in many cases. Namely, it's a common pattern when you have 2 things, and need to know which one is smaller/bigger to operate on them differently. I've wanted such functions countless times, most recently in rust-lang#109402, so I thought I'd propose them. ---- r? libs-api
…mulacrum get rid of duplicate primitive_docs Having this duplicate makes editing that file very annoying. And at least locally the generated docs still look perfectly fine...
…action, r=Mark-Simulacrum ci: actions/checkout@v3 to actions/checkout@v4 - Bump `actions/checkout` from v3 to v4 since v3 uses Node v16 whose support lasts until `11 Sep 2023` [Ref](https://endoflife.date/nodejs) - https://github.com/actions/checkout/releases/tag/v4.0.0
…compiler-errors Explain revealing of opaque types in layout_of ParamEnv r? `@compiler-errors` ~~I feel like `layout_of` is doing too many things at once, and I don't really know why. It could allow us to if callers could decide whether to reveal opaque types.~~ Looks like this also exists as a performance optimization. While we could probably figure out a way to do this, all the ones I came up with are fragile as `layout_of` callers now suddenly need to be careful what ParamEnv they pass in.
…r=nnethercote simplify inject_impl_of_structural_trait There's a comment at `inject_impl_of_structural_trait` saying we cannot use `TraitDef`, but that comment is outdated -- we *can* use `TraitDef` nowadays since it has the `skip_path_as_bound` flag. (The flag needed some fixing, though.)
…obzol Expand infra-ci reviewer list r? `@Kobzol`
@bors r+ rollup=never p=6 |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#109409 (Add `minmax{,_by,_by_key}` functions to `core::cmp`) - rust-lang#115494 (get rid of duplicate primitive_docs) - rust-lang#115663 (ci: actions/checkout@v3 to actions/checkout@v4) - rust-lang#115762 (Explain revealing of opaque types in layout_of ParamEnv) - rust-lang#115891 (simplify inject_impl_of_structural_trait) - rust-lang#115932 (Expand infra-ci reviewer list) r? `@ghost` `@rustbot` modify labels: rollup
@bors r+ |
💡 This pull request was already approved, no need to approve it again.
|
☀️ Test successful - checks-actions |
📌 Perf builds for each rolled up PR:
previous master: cebb9cfd4f In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
Finished benchmarking commit (65ea825): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 631.896s -> 632.986s (0.17%) |
Successful merges:
minmax{,_by,_by_key}
functions tocore::cmp
#109409 (Addminmax{,_by,_by_key}
functions tocore::cmp
)r? @ghost
@rustbot modify labels: rollup
Create a similar rollup