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

Update hashbrown to version 0.15, with changes that were blocked by that release #131178

Closed
wants to merge 1 commit into from

Conversation

clarfonthey
Copy link
Contributor

Going over the changes:

The obvious

hashbrown has been set to version 0.15 in library/std/Cargo.toml, and a cargo update for the std crate has been performed. This also bumps the version of the cc crate in Cargo.lock, but I didn't think it was worth removing this change by hand, since it's just a bugfix release.

map_entry_replace

There was an FCP that decided to remove these unstable methods, but no PR was actually submitted to do so: #44286 (comment)

Since hashbrown has removed these methods, they are removed with the update as well.

map_many_mut

The unstable APIs for HashMap::get_many_mut and HashMap::get_many_unchecked_mut have been transposed from returning Option<[&mut V; N]> to returning [Option<&mut V>; N].

This was based upon a libs-api decision here: #97601 (comment)

hash_set_entry

The unstable HashSet::get_or_insert_owned API was removed in favour of the also-unstable HashSet::get_or_insert_with. There wasn't much discussion here that I could find, but essentially, both of these methods have the same problem of having to verify that the keys are equivalent after the fact, and the owned variant was removed from hashbrown, which seems to indicate some kind of consensus.

Since this API is unstable, it doesn't need an FCP, but since I don't think there was any official consensus on it, someone from libs-api should probably sign this off. If you'd prefer to retain the owned variant of the method, it can easily be reimplemented on top of the hashbrown API which only offers a with variant.

default_iters_hash

These are instantly-stable, but already passed FCP here: #128711 (comment)

They were blocked by a hashbrown release containing the necessary impls, so, that's why they're included in this PR.

r? libs-api

@rustbot
Copy link
Collaborator

rustbot commented Oct 3, 2024

Some changes occurred in cfg and check-cfg configuration

cc @Urgau

These commits modify the library/Cargo.lock file. Unintentional changes to library/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.

@rustbot rustbot added 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. labels Oct 3, 2024
@@ -413,7 +413,7 @@ impl CheckCfg {
] = self
.expecteds
.get_many_mut(VALUES)
.expect("unable to get all the check-cfg values buckets");
.map(|x| x.expect("unable to get all the check-cfg values buckets"));
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 tried updating this code in a few different ways but ultimately, this felt like the least-invasive way to make the change. I don't fully understand what this code is doing (and didn't really bother to figure out), so, someone else can change this code later if they find a better way of doing it.

Plus, a panic is an ICE anyway, so, if this causes any noticeable difference in behaviour it was a bug anyway.

@clarfonthey
Copy link
Contributor Author

Just kidding, I had searched for an existing PR and hadn't found one. Will close this and just reopen my other PR. ><

@clarfonthey clarfonthey closed this Oct 3, 2024
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#16 2.946 Building wheels for collected packages: reuse
#16 2.947   Building wheel for reuse (pyproject.toml): started
#16 3.197   Building wheel for reuse (pyproject.toml): finished with status 'done'
#16 3.199   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132715 sha256=dfa09868353292d98f811d3efdb0d54d07389e808efc71d68e3b93c514bf8bec
#16 3.199   Stored in directory: /tmp/pip-ephem-wheel-cache-idadvfrr/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#16 3.202 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#16 3.597 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#16 3.598 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#16 DONE 3.7s
---

failures:

---- std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S>::get_many_mut (line 917) stdout ----
error[E0277]: can't compare `[Option<&mut {integer}>; 2]` with `Option<[&mut {integer}; 2]>`
   |
17 | / assert_eq!(
18 | |     got,
19 | |     Some([
19 | |     Some([
20 | |         &mut 1807,
21 | |         &mut 1800,
22 | |     ]),
23 | | );
   | |_^ no implementation for `[Option<&mut {integer}>; 2] == Option<[&mut {integer}; 2]>`
   |
   = help: the trait `PartialEq<Option<[&mut {integer}; 2]>>` is not implemented for `[Option<&mut {integer}>; 2]`
   = help: the following other types implement trait `PartialEq<Rhs>`:
             `&[T]` implements `PartialEq<Vec<U, A>>`
             `&[T]` implements `PartialEq<[U; N]>`
             `&mut [T]` implements `PartialEq<Vec<U, A>>`
             `&mut [T]` implements `PartialEq<[U; N]>`
             `[T; N]` implements `PartialEq<&[U]>`
             `[T; N]` implements `PartialEq<&mut [U]>`
             `[T; N]` implements `PartialEq<[U; N]>`
             `[T; N]` implements `PartialEq<[U]>`
   = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0277]: can't compare `[Option<&mut {integer}>; 2]` with `Option<_>`
   |
   |
30 | assert_eq!(got, None);
   | ^^^^^^^^^^^^^^^^^^^^^ no implementation for `[Option<&mut {integer}>; 2] == Option<_>`
   |
   = help: the trait `PartialEq<Option<_>>` is not implemented for `[Option<&mut {integer}>; 2]`
   = help: the following other types implement trait `PartialEq<Rhs>`:
             `&[T]` implements `PartialEq<Vec<U, A>>`
             `&[T]` implements `PartialEq<[U; N]>`
             `&mut [T]` implements `PartialEq<Vec<U, A>>`
             `&mut [T]` implements `PartialEq<[U; N]>`
             `[T; N]` implements `PartialEq<&[U]>`
             `[T; N]` implements `PartialEq<&mut [U]>`
             `[T; N]` implements `PartialEq<[U; N]>`
             `[T; N]` implements `PartialEq<[U]>`
   = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0277]: can't compare `[Option<&mut {integer}>; 2]` with `Option<_>`
   |
   |
37 | assert_eq!(got, None);
   | ^^^^^^^^^^^^^^^^^^^^^ no implementation for `[Option<&mut {integer}>; 2] == Option<_>`
   |
   = help: the trait `PartialEq<Option<_>>` is not implemented for `[Option<&mut {integer}>; 2]`
   = help: the following other types implement trait `PartialEq<Rhs>`:
             `&[T]` implements `PartialEq<Vec<U, A>>`
             `&[T]` implements `PartialEq<[U; N]>`
             `&mut [T]` implements `PartialEq<Vec<U, A>>`
             `&mut [T]` implements `PartialEq<[U; N]>`
             `[T; N]` implements `PartialEq<&[U]>`
             `[T; N]` implements `PartialEq<&mut [U]>`
             `[T; N]` implements `PartialEq<[U; N]>`
             `[T; N]` implements `PartialEq<[U]>`
   = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 3 previous errors


For more information about this error, try `rustc --explain E0277`.
Couldn't compile the test.
---- std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S>::get_many_unchecked_mut (line 980) stdout ----
error[E0277]: can't compare `[Option<&mut {integer}>; 2]` with `Option<[&mut {integer}; 2]>`
   |
17 | / assert_eq!(
18 | |     got,
19 | |     Some([
19 | |     Some([
20 | |         &mut 1807,
21 | |         &mut 1800,
22 | |     ]),
23 | | );
   | |_^ no implementation for `[Option<&mut {integer}>; 2] == Option<[&mut {integer}; 2]>`
   |
   = help: the trait `PartialEq<Option<[&mut {integer}; 2]>>` is not implemented for `[Option<&mut {integer}>; 2]`
   = help: the following other types implement trait `PartialEq<Rhs>`:
             `&[T]` implements `PartialEq<Vec<U, A>>`
             `&[T]` implements `PartialEq<[U; N]>`
             `&mut [T]` implements `PartialEq<Vec<U, A>>`
             `&mut [T]` implements `PartialEq<[U; N]>`
             `[T; N]` implements `PartialEq<&[U]>`
             `[T; N]` implements `PartialEq<&mut [U]>`
             `[T; N]` implements `PartialEq<[U; N]>`
             `[T; N]` implements `PartialEq<[U]>`
   = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0277]: can't compare `[Option<&mut {integer}>; 2]` with `Option<_>`
   |
   |
30 | assert_eq!(got, None);
   | ^^^^^^^^^^^^^^^^^^^^^ no implementation for `[Option<&mut {integer}>; 2] == Option<_>`
   |
   = help: the trait `PartialEq<Option<_>>` is not implemented for `[Option<&mut {integer}>; 2]`
   = help: the following other types implement trait `PartialEq<Rhs>`:
             `&[T]` implements `PartialEq<Vec<U, A>>`
             `&[T]` implements `PartialEq<[U; N]>`
             `&mut [T]` implements `PartialEq<Vec<U, A>>`
             `&mut [T]` implements `PartialEq<[U; N]>`
             `[T; N]` implements `PartialEq<&[U]>`
             `[T; N]` implements `PartialEq<&mut [U]>`
             `[T; N]` implements `PartialEq<[U; N]>`
             `[T; N]` implements `PartialEq<[U]>`
   = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 2 previous errors

---
    std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S>::get_many_unchecked_mut (line 980)

test result: FAILED. 1276 passed; 2 failed; 17 ignored; 0 measured; 0 filtered out; finished in 42.64s

error: doctest failed, to rerun pass `-p std --doc`
  local time: Thu Oct  3 00:49:45 UTC 2024
  network time: Thu, 03 Oct 2024 00:49:45 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants