-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Tracking issue for namespaced-features #5565
Comments
Indeed a tracking issue is useful! I think though this still has a large piece to implement which is to propagate namespaced features to the registry index |
Yes, I figured as much. So do you have any ideas/guidance about how to go about that? Are there established ideas on how to evolve the registry index? |
The evolution here is just a new key in the registry which we've done a bunch of times before, so it's fine to do whenever once there's an agreed up on design. Most of the time this is hard to undo though so we want to be pretty sure of the design before it lands. Technically it'll involve modifying crates.io as well as the publishing code in Cargo to send more data to the registry |
Can you be a bit more specific about which parts of the cargo and/or crates.io code need changing? |
You may want to hop onto the crates.io channel on discord as they may know more, but it's all around |
@alexcrichton okay, so, I'm still not entirely clear on what needs to be done on the crates.io side here. Is it just propagating the Either way, I'm not sure how the compatibility with old cargo is supposed to work, or who all needs to be on board with a supposed design. |
@djc there's a few things here I think that we'd need to consider:
Before we go much further though I think it'd be good to get weigh-in from @rust-lang/cargo because once we start changing the registry it's sort of the point of no return |
@alexcrichton So, this is exactly the kind of change that really motivated the idea of supporting Cargo version dependencies in a way that older versions of Cargo can handle. We can't make old versions of Cargo unable to parse new versions of the index; that's a serious problem. If we're going to do this, we need to version the index, such that older versions of Cargo don't see crates that use this feature at all. |
@joshtriplett indeed! To be clear though the main issue is that an older Cargo won't understand the newer index, but we get to control how it doesn't understand the new index as well (aka no features, a mapping of features, or something like that). Having a fully versioned index seems far off still so I'd be fine implementing this before that comes along. Now having a versioned index is a good idea though and we can start at any time to add safeguards into Cargo to avoid looking at future revisions! |
Is this going to move towards stabilisation soon? |
Probably not -- I'm still motivated to write code to move this forward, but I don't know exactly what needs to be done. |
Oh, I thought it was already implemented, just needed stabilising. |
The Cargo part is implemented -- it apparently needs complementary stuff in crates.io. |
Aha. What I still don't understand is how this issue relates to implicit features for dependencies, exactly. (I was linked here from that issue.) |
I agree that more could be said here. I find it odd how none of the examples I can locate for this feature show how it can be used to overcome the limitations of optional dependencies (which were its primary motivation)! See this page: And now let me try to put it in context: Suppose you have this: [dependencies]
rand = { version = "0.5.5", optional = true } Without [features]
rand = [] # implicitly generated, always ...and With [features]
rand = ["crate:rand"] # implicitly generated, unless you write your own rand feature ...and If you look closely, the actual namespacing of the dependencies does not, in itself, have anything to do with the issue of implicit features. It is the other changes enabled by the The justification for tying these changes together was given in #1286. Er... maybe. Actually, I can't really find it explicitly spelled out there. But the proposal is strictly more powerful than if we were to simply allow the implicit feature to be overridden with no other changes (because this also allows you to have a |
Is it possible to publish a crate that uses this feature? I'm getting:
|
@tikue I believe not currently. In addition to crates.io checks the registry index isn't ready for namespaced features |
@alexcrichton thanks, it was easy enough to work around, just had to name a serde feature serde1. |
@alexcrichton Does an issue for that exist on the crates.io repo? |
@alexreg I think that's this issue, the tracking issue for this feature. The feature needs to be designed for crates.io first. |
@alexcrichton Hmm? That's what I mean, we need to implement namespaced features on crates.io. There should be a separate issue for that over on that repo, I think, no? |
FWIW, I'd like to move this forward, but I'm currently having a hard time figuring out exactly what needs to be done about the index and crates.io. If someone can provide me with more guidance on that, that would be great. |
@djc I think that rust-lang/crates.io#1487 may be helpful in providing a rough template for how to make progress? |
As discovered in #8832, this unfortunately breaks Cargo versions older than 1.19, even if they have a Cargo.lock file. We'll need to figure out how to address that concern before this can move forward. |
I forgot to post a followup here. #9161 implemented changes to support namespaced features in the index and avoid breaking older versions of cargo. There is some risk that versions older than 1.51 may resolve packages using namespaced features in such a way that those features don't get activated. I'll feel a little more comfortable once more time has passed so that 1.51 is at least a few months old. |
I have posted a proposal to stabilize this in rust-lang/rfcs#3143. |
62: Implementing serde (De)Serialize for GPX structs r=lnicola a=mkroehnert - [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/master/CODE_OF_CONDUCT.md). - [x] I added an entry to `CHANGELOG.md` if knowledge of this change could be valuable to users. --- This PR resolves #59, by implementing optional support for (de-)serializing the GPX structs via serde. I named the feature flag `serde-serialize`, same as in the `wasm-bindgen` crate. Using `serde` for the feature flag name is not yet possible, since it would require the currently unstable [cargo namespaced features](https://doc.rust-lang.org/cargo/reference/unstable.html#namespaced-features) implementation. See also the related [cargo tracking issue](rust-lang/cargo#5565). It was asked in #59, whether it would be possible to use GeoJSON, but for my usecase, it would be overkill to deal with additional data structure conversions. I also checked the [Rust API guidelines](https://rust-lang.github.io/api-guidelines/interoperability.html#c-serde), which mention that it would be good, if structs implemented `serde::{Serialize, Deserialize}`. If the changes are okay and can/should be merged, I'll update the branch with a changelog entry. Co-authored-by: Manfred Kroehnert <7868+mkroehnert@users.noreply.github.com>
Proposal passed, what's next? If there are work items people could pick up, could they be added to the initial comment? |
Also, out of curiosity, why doesn't |
This is just waiting for a review on a PR on crates.io to accept the new syntax.
I'm not sure I fully understand your question, since the point of the |
Posted #10269 as a proposal to stabilized this. |
Huzzah, #10269 has been merged! :) |
Oops, looks like I closed the wrong issue. Thanks! |
Docs: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#namespaced-features
Original issue: #1286
Implementation: #5300
Not sure what the process is for stabilizing experimental Cargo features, I figured a tracking issue might be useful? @alexcrichton any guide on what should be done to move this towards stabilization?
Unresolved issues
features2
to the index. #9161About 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.
The text was updated successfully, but these errors were encountered: