Clarify that `{self}` imports require a module parent

The `self` keyword in a use brace (e.g., `use m::{self}`) creates a
binding for the parent entity.  The note in `items.use.self.intro`
says that `self` "means the current module of the parent segment", but
there's no rule restricting what the parent can be.

The parent path must resolve to a module, enumeration, or trait --
i.e., entities that act as modules for name resolution.  Using `self`
with other entities such as structs or unions is rejected by the
compiler (as of rust-lang/rust#152996).

Let's add a rule to make this restriction explicit.
1 file changed
tree: a8259e551e2e0245aacf45aad7c673221d591dae
  1. .cargo/
  2. .github/
  3. dev-guide/
  4. docs/
  5. src/
  6. theme/
  7. tools/
  8. .gitattributes
  9. .gitignore
  10. book.toml
  11. Cargo.lock
  12. Cargo.toml
  13. CONTRIBUTING.md
  14. LICENSE-APACHE
  15. LICENSE-MIT
  16. README.md
  17. reference.md
  18. rust-toolchain.toml
  19. rustfmt.toml
  20. triagebot.toml
README.md

The Rust Language Reference

This document is the primary reference for the Rust programming language.

Contributor docs

See the Reference Developer Guide for information on contributing to the Reference.