Skip to content

Commit

Permalink
Update 0000-packages-as-optional-namespaces.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth authored Jul 23, 2023
1 parent 56fae2e commit 482fae8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions text/0000-packages-as-optional-namespaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,20 @@ Only the owners of `foo` may _create_ the `foo::bar` crate (and all owners of `f

# Reference-level explanation

`::` is now considered valid inside crate names on Crates.io and Cargo. For now, we will restrict crate names to having a single `::` in them, not at the beginning or end of the name, but this can be changed in the future.
_This section will maintain a distinction between "package" (a crates.io package) and "crate" (the actual rust library). The rest of the RFC does not attempt to make this distinction_

When publishing a crate `foo::bar`, if the crate does not exist, the following must be true:
`::` is now considered valid inside package names on Crates.io. For now, we will restrict package names to having a single `::` in them, not at the beginning or end of the name, but this can be changed in the future.

When publishing a package `foo::bar`, if the package does not exist, the following must be true:

- `foo` must exist
- The user publishing the crate must be an owner of `foo`
- The user publishing the package must be an owner of `foo`

For the crate `foo::bar`, all owners of `foo` are always considered owners of `foo::bar`, however additional owners may be added. People removed from ownership of `foo` will also lose access to `foo::bar` unless they were explicitly added as owners to `foo::bar`.
For the package `foo::bar`, all owners of `foo` are always considered owners of `foo::bar`, however additional owners may be added. People removed from ownership of `foo` will also lose access to `foo::bar` unless they were explicitly added as owners to `foo::bar`.

Crates.io displays `foo::bar` crates with the name `foo::bar`, though it may stylistically make the `foo` part link to the `foo` crate.
Crates.io displays `foo::bar` packages with the name `foo::bar`, though it may stylistically make the `foo` part link to the `foo` package.

The [registry index trie](https://doc.rust-lang.org/nightly/cargo/reference/registries.html#index-format) may represent subpackages by placing `foo::bar` as just `foo/bar` or using some special character..
The [registry index trie](https://doc.rust-lang.org/nightly/cargo/reference/registries.html#index-format) may represent subpackages by placing `foo::bar` as just `foo::bar`.

`rustc` will need some changes. When `--extern foo::bar=crate.rlib` is passed in, `rustc` will include this crate during resolution as if it were a module `bar` living under crate `foo`. If crate `foo` is _also_ in scope, this will not automatically trigger any errors unless `foo::bar` is referenced, `foo` has a module `bar`, and that module is not just a reexport of crate `foo::bar`.

Expand Down

0 comments on commit 482fae8

Please sign in to comment.