rust-lang / nomicon

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

Include elided lifetime in sub-typing example #398

Closed sgasse closed 1 year ago

sgasse commented 1 year ago

One step required to understand the argumenation is that the lifetime of the &mut T is different from any lifetime that may be part of a reference forming the type T. By mentioning the elided lifetime explictly, the paragraph should be easier to understand.

Minor other changes are highlighting types with backticks.

sgasse commented 1 year ago

@Gankra I think you were the last person to thoroughly (re)write the sub-typing part. Thanks a lot for it, I really like the examples with the meowing dog :grin:

Would you have time to take a quick glance at the proposed change?

MPvHarmelen commented 1 year ago

My 2ct as a first-time reader of these sections:

I don't think adding explicit lifetimes is an improvement here: the elided lifetimes weren't necessary to understand what was going on for me. Introducing explicit lifetimes, however, would add quite a bit of visual and textual clutter, distracting me from the lifetimes that matter most.

JohnTitor commented 1 year ago

Thanks for the PR! I, however, agree with @MPvHarmelen, this doesn't seem to improve its meaning much. Closing as rejected.