nomicon icon indicating copy to clipboard operation
nomicon copied to clipboard

Move the (duplicate) lists of rules to the reference

Open JohnTitor opened this issue 4 years ago • 4 comments

As noted in https://github.com/rust-lang/nomicon/issues/230#issuecomment-858248008, we have some duplicate lists of the rules between the nomicon and the reference, and Eric and I would like to defer them to the reference.

So, we should:

  • Collects the current lists
  • Checks if the reference has it
    • If not, prepares a PR for it
  • Removes it from the nomicon and adds a link to the reference

@ehuss is the above what you meant?

cc @rust-lang/lang-docs feel free to drop your thoughts, any suggestions are welcome!

JohnTitor avatar Jun 16 '21 21:06 JohnTitor

Yea, that's probably reasonable, though I'm uncertain. I don't think it's terribly bad if there is some duplication, the main concern is that we don't have the resources to keep things in sync, and in general that is a hassle for people contributing. Unfortunately, removing it from the nomicon can make reading it a little harder since you would need to head over to the reference to find the actual information.

I would suggest if removing stuff to do it carefully. Make sure the information is complete in the reference, and that it doesn't gut the nomicon too much. For example, the coercions page could remove the list of rules, but keep a high-level discussion and a good suite of examples. A rule of thumb is that the reference generally doesn't explain the "why" of anything in the language. It doesn't explain why you would want to coerce, or when it is useful or important or necessary. That seems like a better fit for the nomicon.

Some of the duplication I see is:

  • The list of unsafe operations in https://doc.rust-lang.org/nightly/nomicon/what-unsafe-does.html
  • Coercions https://doc.rust-lang.org/nightly/nomicon/coercions.html
  • Casting https://doc.rust-lang.org/nightly/nomicon/casts.html

ehuss avatar Jun 17 '21 15:06 ehuss

Yeah, I agree with removing may overdo cleanup. So, adding a note saying "this list may be outdated, see the reference for a more accurate list" is enough here?

JohnTitor avatar Jun 21 '21 02:06 JohnTitor

Coercions and Casting were both originally written in the context of "the reference is dead, I need to be the reference", so they can be happily moved to the reference. The list of unsafe/UB things I think is definitely worth mirroring in the nomicon, since it's kind of a fundamental pretext for everything we're doing, although that page is getting a bit unwieldy as we more precisely define things.

Gankra avatar Jun 22 '21 16:06 Gankra

Another one about lifetime elision: https://github.com/rust-lang/nomicon/pull/306#issuecomment-908685816

JohnTitor avatar Aug 30 '21 22:08 JohnTitor