rust-lang / nomicon

The Dark Arts of Advanced and Unsafe Rust Programming
https://doc.rust-lang.org/nomicon/
Apache License 2.0
1.85k stars 268 forks source link

Are the HRTB really needed in the given example ? #216

Open shika-blyat opened 4 years ago

shika-blyat commented 4 years ago

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.

Gankra commented 4 years ago

hmm yea, i think the new borrowchecker and/or some new sugar was added since this section was written which makes this not actually a good example anymore. Will have to think...

shika-blyat commented 4 years ago

There should probably be some kind of disclaimer, explaining that the example(and the whole subchapterl) is outdated no ? I can make a PR for that