rust-lang / book

The Rust Programming Language
https://doc.rust-lang.org/book/
Other
15.17k stars 3.41k forks source link

Mention the turbofish in the generics chapter #385

Closed QuietMisdreavus closed 6 years ago

QuietMisdreavus commented 7 years ago

The beloved turbofish is a bit of a hidden gem in terms of Rust syntax. Right now it's only mentioned next to the discussion of collect, in v1 as part of the Iterators chapter and a little more concisely in the documentation for collect itself. But this leaves out an important feature of it: you can keep going in a path when you add a turbofish. This caused confusion for someone today in #rust-beginners, so it'd be nice to have a discussion of this syntax next to generics, where I'd expect to see it a little more than just surrounding collect.

carols10cents commented 7 years ago

Hmm I've never used the turbofish in this context before! Do you think this is common enough to work into the generics chapter @steveklabnik ? Or potentially somewhere more advanced?

nodakai commented 7 years ago

See also #479

carols10cents commented 6 years ago

I am of the opinion that this use of turbofish isn't common enough to merit inclusion in chapter 10. Thank you for the feedback though!