rust-lang / rust-lang/hashbrown

Lifetime of input (key) to HashMap::get() gets entanged w/ that of its output (value)

Open
#220 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3k
Forks
358
Avg merge
11h 57m
Merged PRs (30d)
2

Description

This issue I filed against std also applies to hashbrown::HashMap. You can use the exact same code in there, replacing the HashMap use line and reproduce the issue. The problem is likely that lifetimes are not specified for HashMap::get arguments so rustc thinks the passed key's lifetime is somehow associated with that of self.

If that's the correct diagnoses, I'll hopefully provide a PR for both hashbrown and std soon.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with rust-lang/rust issue #80389 and reproduce its example in hashbrown by replacing the HashMap use line. Investigate HashMap::get and determine whether the input key lifetime is incorrectly coupled to the output value or the map reference; done means confirming the behavior and identifying the required lifetime correction.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.