Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add details on how names are introduced. #1052

Merged
merged 12 commits into from
Jul 30, 2024

Commits on Jul 25, 2024

  1. Specify how names are introduced.

    This is just a first pass to specifying how each thing introduces
    a name, and where it is introduced. This is missing `use` and `Self`.
    (And a few things I don't feel like need elaboration, like loop labels,
    but those can be added if desired.)
    ehuss committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    2aadaad View commit details
    Browse the repository at this point in the history
  2. Clean up a few uses of the word "namespace".

    Since "namespace" has a specific meaning in Rust, I feel like it would
    be good not to overload it too much with the sense of a scope container
    like a C++ namespace.
    ehuss committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    5de59db View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    528b1a2 View commit details
    Browse the repository at this point in the history
  4. Update use chapter with more detail.

    This attempts to update the `use` chapter to explain the kinds of paths
    and syntax it supports in more detail. This is not an exhaustive
    explanation of resolution, and there are several things it does not
    cover.
    ehuss committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    9fbd6f0 View commit details
    Browse the repository at this point in the history
  5. Fixes from review.

    ehuss committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    94cce75 View commit details
    Browse the repository at this point in the history
  6. Fix mistake in Self.

    ehuss committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    30d7bfc View commit details
    Browse the repository at this point in the history
  7. Remove ambiguity error removed in Rust 1.72.

    This was changed in rust-lang/rust#56414
    to favor in-scope items.
    ehuss committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    127e560 View commit details
    Browse the repository at this point in the history
  8. Make some editorial improvements

    We've merged PR rust-lang#1040, so we can remove the TODO and update the link
    to point to the specific section.
    
    We replace some commas with semicolons where that's the right thing to
    do grammatically.
    
    Where we have "an X is... they are...", we replace that with "an X
    is... Xs are..." for reasons of avoiding a mismatch between the
    plurality of the pronoun and its referent.
    
    We replace "implementing type" and "defining type" with "type being
    implemented" and "type being defined", since there is in general a
    difference (e.g. "the driving force" vs "the force being driven"), and
    these seem more like the latter than the former.
    
    There's a place where we had said, "glob imports are allowed to import
    conflicting names into the same *namespaces*" (emphasis added).  It
    makes sense what this is trying to say by using the plural there.  But
    it just reads better to use the singular, and if it's true for the
    singular, it's clearly also true to the plural, so we make that
    change.
    traviscross authored and ehuss committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    163f7bc View commit details
    Browse the repository at this point in the history
  9. Note a redundantly imported name is allowed to be used

    We had mentioned and demonstrated that a name is allowed to be
    redundantly imported by multiple glob imports, but we hadn't said
    that it is allowed to then be *used*.
    
    Given the example that directly proceeds this, it seems important to
    make a note of that, so let's do that, and let's extend the example to
    demonstrate this.
    traviscross authored and ehuss committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    9ec720b View commit details
    Browse the repository at this point in the history
  10. Remove "or shadowed" caveat

    The claim here was that:
    
    > Glob imports are allowed to import conflicting names in the same
    > namespace as long as the name is not used *or shadowed*.
    
    It's true that the name being used will cause an error.  But it's not
    true that the name being shadowed will cause one, so let's remove
    that part.
    traviscross authored and ehuss committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    da25835 View commit details
    Browse the repository at this point in the history
  11. Replace "Example:" with "For example:"

    It's a bit more common throughout the Reference, including even within
    this PR, to say "For example:" rather than just "Example:", and it's
    more grammatically regular, so let's fix up the ones that went the
    other way in this branch.
    traviscross authored and ehuss committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    65c20b1 View commit details
    Browse the repository at this point in the history

Commits on Jul 26, 2024

  1. Remove struct-like enum variant values.

    These were removed in rust-lang/rust#103578.
    ehuss committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    585407f View commit details
    Browse the repository at this point in the history