rust-lang / rust-lang/nomicon

Are the HRTB really needed in the given example ?

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

Nobody has claimed this yet.

Dominant language
CSS
Stars
2.3k
Forks
325
PR merge metrics
No merged PRs in 30d

Description

https://doc.rust-lang.org/nomicon/hrtb.html
I was wondering about why the HRTB were needed here, so i tried to implement this myself, by specifying manually the lifetime, and well, it worked:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7f8c86e91966c70165c1989f9034b4ef

I believe this is either a mistake (the given example doesn't require HRTB) or the explanation is unclear, in which case this issue should be considered as a request to rephrase it.

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 the HRTB example on the linked Rustonomicon page, then compare it with the linked Rust Playground implementation. Determine whether the example actually requires higher-ranked trait bounds or whether the explanation needs clarification. Done means the page's example and explanation accurately describe the lifetime requirements.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.