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

Upgrade hashbrown to 0.12.3 #99372

Closed
wants to merge 1,641 commits into from
Closed

Conversation

Amanieu
Copy link
Member

@Amanieu Amanieu commented Jul 17, 2022

This fixes a double-free in the clone_from function if dropping an existing element in the table panics. See rust-lang/hashbrown#348 for more details.

The indexmap crate is also updated to use the latest hashbrown version.

RalfJung and others added 30 commits July 11, 2022 22:50
Moves our projection handling code into a common file, and avoids the use of a
general mplace-based fallback function by have more specialized implementations.

mplace_index (and the other slice-related functions) could be more efficient by
copy-pasting the body of operand_index. Or we could do some trait magic to share
the code between them. But for now this is probably fine.
rustc_target: Flip the default for `TargetOptions::executables` to true

This flag is true for most targets and the remaining targets may be mistakes.
…stebank

Fix last `let_chains` blocker

In order to forbid things like `let x = (let y = 1);` or `if let a = 1 && { let x = let y = 1; } {}`, the parser **HAS** to know the context of `let`.

This context thing is not a surprise in the parser because you can see **a lot** of ad hoc fixes mixing parsing logic with validation logic creating code that looks more like spaghetti with tomato sauce.

To make things even greater, a new ad hoc fix was added to only allow `let`s in a valid `let_chains` context by checking the previously processed token. This was the only solution I could think of and believe me, I thought about it for a long time 👍

In the long term, it should be preferable to segregate different responsibilities or create a more robust and cleaner parser framework.

cc rust-lang#94927
cc rust-lang#53667
…-to-floating-point-number, r=compiler-errors

Suggest adding a missing zero to a floating point number

fixes rust-lang#98836
Some more `EarlyBinder` cleanups

First commit has a couple unrelated cleanups, but otherwise each commit is self-explanatory

r? rust-lang/types
use PlaceRef::iter_projections to fix old FIXME

I added this function in 53481a5
…x, r=Dylan-DPC

Put back UI test regex

I just realized I overwrote these two commits in rust-lang#99055 when force pushing to fix the stdout output...

r? `@Dylan-DPC`
Rollup of 6 pull requests

Successful merges:

 - rust-lang#98622 (rustc_target: Flip the default for `TargetOptions::executables` to true)
 - rust-lang#98633 (Fix last `let_chains` blocker)
 - rust-lang#98972 (Suggest adding a missing zero to a floating point number)
 - rust-lang#99038 (Some more `EarlyBinder` cleanups)
 - rust-lang#99154 (use PlaceRef::iter_projections to fix old FIXME)
 - rust-lang#99171 (Put back UI test regex)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This is first step in implementing RFC 3216.
- Parse `for<'a>` before closures in ast
  - Error in lowering
- Add `closure_lifetime_binder` feature
Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 17, 2022
@Amanieu Amanieu added the relnotes Marks issues that should be documented in the release notes of the next release. label Jul 17, 2022
@Amanieu
Copy link
Member Author

Amanieu commented Jul 17, 2022

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 17, 2022
@bors
Copy link
Contributor

bors commented Jul 17, 2022

⌛ Trying commit 00fd613 with merge 1fac82ed6617ac867b303131b861b2de537b6f6e...

@Mark-Simulacrum Mark-Simulacrum added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jul 17, 2022
@Mark-Simulacrum
Copy link
Member

r=me on the bump itself

We should consider a beta backport, too, I think.

Can you say more about the relnotes label? Just that it's a soundness fix?

@klensy
Copy link
Contributor

klensy commented Jul 17, 2022

#99251 related, as it removes hashbrown 0.11 version entirely.

@Amanieu
Copy link
Member Author

Amanieu commented Jul 17, 2022

Yes the relnotes was just for the soundness fix. It can be removed if it's not appropriate.

#99251 is likely going to conflict with this PR.

@Amanieu
Copy link
Member Author

Amanieu commented Jul 17, 2022

It might be easier to fold the version upgrade into #99251. cc @cuviper

@bors
Copy link
Contributor

bors commented Jul 17, 2022

☀️ Try build successful - checks-actions
Build commit: 1fac82ed6617ac867b303131b861b2de537b6f6e (1fac82ed6617ac867b303131b861b2de537b6f6e)

@rust-timer
Copy link
Collaborator

Queued 1fac82ed6617ac867b303131b861b2de537b6f6e with parent 1cd72b7, future comparison URL.

@cuviper
Copy link
Member

cuviper commented Jul 17, 2022

This fixes a double-free in the clone_from function if dropping an existing element in the table panics. See rust-lang/hashbrown#348 for more details.

The indexmap crate is also updated to use the latest hashbrown version.

FWIW, I think that bug is irrelevant to indexmap, since it only uses RawTable<usize>. I would have rather seen the perf numbers of the hashmap upgrade alone, especially since that affects std.

It might be easier to fold the version upgrade into #99251.

I've added it.

Note that rustc_codegen_cranelift and rust-analyzer also use independent Cargo.lock files -- I took the liberty of updating it for cranelift as well, but we can't directly do that for rust-analyzer since it's a submodule. But as far as backports are concerned, 1.63-beta doesn't enable rust-analyzer yet anyway.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1fac82ed6617ac867b303131b861b2de537b6f6e): comparison url.

Instruction count

  • Primary benchmarks: mixed results
  • Secondary benchmarks: 🎉 relevant improvements found
mean1 max count2
Regressions 😿
(primary)
2.0% 2.0% 1
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
-0.3% -0.4% 2
Improvements 🎉
(secondary)
-0.6% -1.5% 8
All 😿🎉 (primary) 0.5% 2.0% 3

Max RSS (memory usage)

Results
  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
2.9% 2.9% 1
Improvements 🎉
(primary)
-8.2% -8.2% 1
Improvements 🎉
(secondary)
-0.9% -0.9% 1
All 😿🎉 (primary) -8.2% -8.2% 1

Cycles

Results
  • Primary benchmarks: mixed results
  • Secondary benchmarks: 🎉 relevant improvements found
mean1 max count2
Regressions 😿
(primary)
5.0% 6.9% 2
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
-2.2% -2.2% 2
Improvements 🎉
(secondary)
-2.9% -3.7% 13
All 😿🎉 (primary) 1.4% 6.9% 4

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf +perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 17, 2022
@apiraino apiraino added the T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. label Jul 21, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 24, 2022
…crum

Upgrade indexmap and thorin-dwp to use hashbrown 0.12

This removes the last dependencies on hashbrown 0.11.

This also upgrades to hashbrown 0.12.3 to fix a double-free (rust-lang#99372).
@Mark-Simulacrum Mark-Simulacrum changed the base branch from master to beta July 24, 2022 16:30
@bors
Copy link
Contributor

bors commented Jul 24, 2022

⚠️ The base branch changed to beta, and the PR will need to be re-approved.

@bors bors 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 Jul 24, 2022
@Mark-Simulacrum
Copy link
Member

Hm. I think it may make sense to re-target this to beta -- looks like doing that via github UI isn't going to work.

@bors
Copy link
Contributor

bors commented Jul 24, 2022

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout hashbrown-0.12.3 (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self hashbrown-0.12.3 --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Failed to merge submodule src/tools/rls (not checked out)
Auto-merging src/tools/rls
CONFLICT (submodule): Merge conflict in src/tools/rls
Removing src/tools/clippy/clippy_lints/src/self_assignment.rs
Removing src/tools/clippy/clippy_lints/src/ptr_eq.rs
Removing src/tools/clippy/clippy_lints/src/numeric_arithmetic.rs
Removing src/tools/clippy/clippy_lints/src/needless_bitwise_bool.rs
Removing src/tools/clippy/clippy_lints/src/integer_division.rs
Removing src/tools/clippy/clippy_lints/src/float_equality_without_abs.rs
Removing src/tools/clippy/clippy_lints/src/erasing_op.rs
Removing src/tools/clippy/clippy_lints/src/eq_op.rs
Removing src/tools/clippy/clippy_lints/src/duration_subsec.rs
Removing src/tools/clippy/clippy_lints/src/double_comparison.rs
Removing src/tools/clippy/clippy_lints/src/assign_ops.rs
Failed to merge submodule src/tools/cargo (not checked out)
Auto-merging src/tools/cargo
CONFLICT (submodule): Merge conflict in src/tools/cargo
Removing src/test/ui/union/union-custom-drop.stderr
Removing src/test/ui/union/union-custom-drop.rs
CONFLICT (add/add): Merge conflict in src/test/ui/type-alias-impl-trait/issue-98608.stderr
Auto-merging src/test/ui/type-alias-impl-trait/issue-98608.stderr
CONFLICT (add/add): Merge conflict in src/test/ui/type-alias-impl-trait/issue-98604.stderr
Auto-merging src/test/ui/type-alias-impl-trait/issue-98604.stderr
Removing src/test/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.stderr
Removing src/test/ui/type-alias-impl-trait/cross_inference_pattern_bug.stderr
Removing src/test/ui/trait-bounds/select-param-env-instead-of-blanket.stderr
Removing src/test/ui/trait-bounds/select-param-env-instead-of-blanket.rs
Removing src/test/ui/terminal-width/flag-json.rs
Removing src/test/ui/terminal-width/flag-human.rs
Removing src/test/ui/rfc-2497-if-let-chains/feature-gate.stderr
Removing src/test/ui/rfc-2497-if-let-chains/feature-gate.rs
Removing src/test/ui/repr/repr-no-niche.rs
Removing src/test/ui/repr/repr-no-niche-inapplicable-to-unions.stderr
Removing src/test/ui/repr/repr-no-niche-inapplicable-to-unions.rs
Removing src/test/ui/repr/feature-gate-no-niche.stderr
Removing src/test/ui/repr/feature-gate-no-niche.rs
Removing src/test/ui/macros/rfc-2011-nicer-assert-messages/codegen.stdout
Removing src/test/ui/macros/rfc-2011-nicer-assert-messages/codegen.rs
Removing src/test/ui/lazy-type-alias-impl-trait/recursion2.stderr
Auto-merging src/test/ui/issues/issue-3044.stderr
Auto-merging src/test/ui/issues/issue-3044.rs
CONFLICT (content): Merge conflict in src/test/ui/issues/issue-3044.rs
Removing src/test/ui/feature-gates/feature-gate-untagged_unions.stderr
Removing src/test/ui/feature-gates/feature-gate-untagged_unions.rs
CONFLICT (add/add): Merge conflict in src/test/rustdoc/issue-98697.rs
Auto-merging src/test/rustdoc/issue-98697.rs
CONFLICT (add/add): Merge conflict in src/test/rustdoc/auxiliary/issue-98697-reexport-with-anonymous-lifetime.rs
Auto-merging src/test/rustdoc/auxiliary/issue-98697-reexport-with-anonymous-lifetime.rs
Auto-merging src/stage0.json
CONFLICT (content): Merge conflict in src/stage0.json
Failed to merge submodule src/llvm-project (not checked out)
Auto-merging src/llvm-project
CONFLICT (submodule): Merge conflict in src/llvm-project
Auto-merging src/librustdoc/clean/mod.rs
Removing src/ci/init_repo.sh
Auto-merging src/bootstrap/bootstrap.py
Auto-merging library/std/src/thread/mod.rs
Auto-merging compiler/rustc_typeck/src/check/intrinsicck.rs
CONFLICT (content): Merge conflict in compiler/rustc_typeck/src/check/intrinsicck.rs
Auto-merging compiler/rustc_typeck/src/check/fn_ctxt/checks.rs
CONFLICT (content): Merge conflict in compiler/rustc_typeck/src/check/fn_ctxt/checks.rs
Auto-merging compiler/rustc_type_ir/src/lib.rs
Auto-merging compiler/rustc_trait_selection/src/traits/select/mod.rs
Auto-merging compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Removing compiler/rustc_trait_selection/src/opaque_types.rs
Auto-merging compiler/rustc_resolve/src/late/lifetimes.rs
Auto-merging compiler/rustc_resolve/src/late.rs
Auto-merging compiler/rustc_middle/src/ty/mod.rs
Auto-merging compiler/rustc_middle/src/traits/select.rs
Removing compiler/rustc_middle/src/thir/abstract_const.rs
Auto-merging compiler/rustc_middle/src/query/mod.rs
Auto-merging compiler/rustc_infer/src/traits/project.rs
Auto-merging compiler/rustc_infer/src/infer/opaque_types.rs
Auto-merging compiler/rustc_infer/src/infer/mod.rs
Removing compiler/rustc_hir/src/itemlikevisit.rs
Auto-merging compiler/rustc_borrowck/src/region_infer/mod.rs
CONFLICT (content): Merge conflict in compiler/rustc_borrowck/src/region_infer/mod.rs
Auto-merging compiler/rustc_ast_lowering/src/lib.rs
Auto-merging Cargo.toml
Auto-merging Cargo.lock
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your merge.renamelimit variable to at least 31707 and retry the command.
Automatic merge failed; fix conflicts and then commit the result.

JohnTitor pushed a commit to JohnTitor/rust that referenced this pull request Jul 26, 2022
…crum

Upgrade indexmap and thorin-dwp to use hashbrown 0.12

This removes the last dependencies on hashbrown 0.11.

This also upgrades to hashbrown 0.12.3 to fix a double-free (rust-lang#99372).
@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.