-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Tracking Issue for Packages as (optional) namespaces #122349
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
Comments
Started a zulip thread exploring if there is any UX work we can do for rustdoc / docs.rs to help users. |
Basic cargo support is in as of rust-lang/cargo#13591 (submodule update: #122575) I created a cargo-features = ["open-namespaces"]
[package]
name = "cargo::issue_13576"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
The implementation will need to watch for any files/directories that are created that include |
(centralizing the conversation) |
That gets complicated as cargo assumes the crate-name and extern-name are the same (and both pull from |
Deeper than |
I can't speak to that or most of the rustc side. If someone familiar enough with both wants to put forward a working proposal for how both sides can work, I'd love to look over it and see what the trade offs are. |
Thinking about this some more, some routes we can go
Some things we need to keep in mind
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Can you intercept file system calls to a crate's filename (whether for the crate's download or for the crate's target artifacts) on file open? (Where, in Windows, |
I'd prefer we don't use hacks like this. |
Since I don't recall ever seeing it mentioned, another unresolved question seems to be multi-registry handling: [dependencies]
"foo::bar" = "1"
"foo::baz" = { version = "1", registry = "custom" } |
@Nemo157 I assume that is a question more for rust-lang/cargo#13576 as this tracking issue is just for the rustc side. This was discussed during the RFC without a definitive answer at rust-lang/rfcs#3243 (comment) but I was leaning towards leaving all restrictions for what can participate in a namespace to crates.io |
Also refactors some of the crate name parsing code and adds unit tests Issue rust-lang#122349 Co-authored-by: León Orell Valerian Liehr <[email protected]>
Add unstable parsing of `--extern foo::bar=libbar.rlib` command line options This is a tiny step towards implementing the rustc side of support for implementing packages as optional namespaces (rust-lang#122349). We add support for parsing command line options like `--extern foo::bar=libbar.rlib` when the `-Z namespaced-crates` option is present. We don't do anything further with them. The next step is to plumb this down to the name resolver. This PR also generally refactors the extern argument parsing code and adds some unit tests to make it clear what forms should be accepted with and without the flag. cc `@epage` `@ehuss`
Add unstable parsing of `--extern foo::bar=libbar.rlib` command line options This is a tiny step towards implementing the rustc side of support for implementing packages as optional namespaces (rust-lang#122349). We add support for parsing command line options like `--extern foo::bar=libbar.rlib` when the `-Z namespaced-crates` option is present. We don't do anything further with them. The next step is to plumb this down to the name resolver. This PR also generally refactors the extern argument parsing code and adds some unit tests to make it clear what forms should be accepted with and without the flag. cc ``@epage`` ``@ehuss``
Add unstable parsing of `--extern foo::bar=libbar.rlib` command line options This is a tiny step towards implementing the rustc side of support for implementing packages as optional namespaces (rust-lang#122349). We add support for parsing command line options like `--extern foo::bar=libbar.rlib` when the `-Z namespaced-crates` option is present. We don't do anything further with them. The next step is to plumb this down to the name resolver. This PR also generally refactors the extern argument parsing code and adds some unit tests to make it clear what forms should be accepted with and without the flag. cc ```@epage``` ```@ehuss```
Rollup merge of rust-lang#139647 - eholk:package-namespace, r=fmease Add unstable parsing of `--extern foo::bar=libbar.rlib` command line options This is a tiny step towards implementing the rustc side of support for implementing packages as optional namespaces (rust-lang#122349). We add support for parsing command line options like `--extern foo::bar=libbar.rlib` when the `-Z namespaced-crates` option is present. We don't do anything further with them. The next step is to plumb this down to the name resolver. This PR also generally refactors the extern argument parsing code and adds some unit tests to make it clear what forms should be accepted with and without the flag. cc ```@epage``` ```@ehuss```
Also refactors some of the crate name parsing code and adds unit tests Issue rust-lang#122349 Co-authored-by: León Orell Valerian Liehr <[email protected]>
Also refactors some of the crate name parsing code and adds unit tests Issue rust-lang#122349 Co-authored-by: León Orell Valerian Liehr <[email protected]>
Can I say "No Go" for this proposal from the compiler side? The chosen syntax deliberately introduces a quite nasty ambiguity into name resolution, which is significantly worse than some similar cases that we already have for backward compatibility, and which are considered unfortunate. The core motivation in the RFC 3243 is social - allowing organizations to reserve some names and users to trust those names, it's not about some missing capabilities in the language. |
@petrochenkov I suggest having the compiler team discuss this and weigh tradeoffs then. We did solicit feedback from the compiler team and got some sign off when writing this rfc. I'm not convinced of the implementation difficulty, the list of known crates is small and the crate filtering can be done early, presumably? I think there are some other potential implementation concerns but this doesn't feel like a major one. Also note that the RFC deliberately only introduces a single level of nesting. I don't think the problem is too bad for multiple layers either. This might not have been in the RFC itself but generally the idea was that if you have |
Perhaps we should specify this in some way and a predetermined resolution should be picked? ...I could see "fail the build catastrophically" being the preferred solution, here. Or is this an ambiguity that continues to be a severe problem even if we make it functionally impossible that the ambiguity ever slices two ways? |
This is not accurate. While it originally started as a registry namespacing feature, with the new syntax it shifted towards being an API design feature: "(partially) open (API) namespaces". Because of this, I've shifted the language of the tracking issues to that term even though we didn't officially rename the RFC. For instance, Python users had hacked-in support for this for years and they officially recognized it and added support for it. This design behaves most like Python in that it only allows you to add extend a namespace with sub-namespaces. Python requires the top-level package to exclusively be a namespace package while we allow it to be a regular package. We also add publish-control to our own registry (other registries and other sources of code can do their own thing). Languages like C++ put no limits on how open namespaces are. |
.NET (NuGet), JS (NPM), Java (Maven), Go (URIs), et. al. all have scopes built into their packaging systems. NuGet is an interesting comparison because their registered namespace separator is Alternatively, if resolving |
|
This is a tracking issue for the RFC "3243" (rust-lang/rfcs#3243).
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
instructions?)
Unresolved Questions
lib.name
key work in this world, and how does that integrate with--extern
and-L
and sysroots?Third-parties, like Linux distributions, will need to decide how to encode
cargo package names in their distribution package names according to their
individual rules.
Compared to existing ecosystems with namespaces that they package, the only new
wrinkle is that there can be 0-1 namespace levels.
Implementation history
The text was updated successfully, but these errors were encountered: