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

MCP: per-edition preludes #44

Closed
scottmcm opened this issue Aug 1, 2020 · 7 comments
Closed

MCP: per-edition preludes #44

scottmcm opened this issue Aug 1, 2020 · 7 comments
Labels
disposition-merge The FCP starter wants to merge (accept) this final-comment-period The FCP has started, most (if not all) team members are in agreement major-change Major change proposal T-lang to-announce Not yet announced MCP proposals

Comments

@scottmcm
Copy link
Member

scottmcm commented Aug 1, 2020

Proposal

Summary and problem statement

To give libs more flexibility, we should allow different preludes per edition.

Motivation, use-cases, and solution sketches

Due to nuances of trait resolution, adding a trait to the prelude is a (technically allowed) breaking change. To help avoid heavy impact, however, it would be nice to be able to make those changes opt-in. The edition mechanism seems like a reasonable place to do this: it means that new code (using cargo new, which defaults to the new edition) will get the new traits in its prelude, but old code using traits that conflict won't be immediately broken.

The basic change here is easy: instead of putting use std::prelude::v1::*; in every module, put use std::prelude::v2018::*; (or analogously for other editions). Giving edition warnings and structured fixes would be much harder, I suspect.

EDIT: petrochenkov points out that preludes for macros may also be hairy.

Out of scope

I would like to leave what, if anything, would change in such a prelude out of scope from this conversation. We can start with all of them being the same as the (could then be deprecated) v1 module. And lang and/or libs can then consider individual changes in a future edition (or existing ones) as separate changes.

Prioritization

This fits decently under "Targeted ergonomic wins and extensions". Having TryInto available in the prelude, for example, would help the compiler give error messages on conversions mentioning that without the confusion of the suggestion not working until an additional trait is used.

Links and related work

rust-lang/rust#65512

Initial people involved

@scottmcm

What happens now?

This issue is part of the experimental MCP process described in RFC 2936. Once this issue is filed, a Zulip topic will be opened for discussion, and the lang-team will review open MCPs in its weekly triage meetings. You should receive feedback within a week or two.

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

@scottmcm scottmcm added major-change Major change proposal T-lang labels Aug 1, 2020
@rustbot
Copy link
Collaborator

rustbot commented Aug 1, 2020

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

@rustbot rustbot added the to-announce Not yet announced MCP proposals label Aug 1, 2020
@nikomatsakis
Copy link
Contributor

Discussed in rust-lang meeting today:

  • We would like to have the capability of modifying the prelude over an edition, so this is worth doing.
  • However, we do probably need to do that work, but we're not sure who is best (or has bandwidth) to do the work.
  • We would like to encourage the interaction with macros and report back. @scottmcm will leave some comments to that effect. =)

Leaving unresolved for now.

@nikomatsakis
Copy link
Contributor

Discussed in rust-lang meeting today:

  • We generally approve of the concept but we would need to have an idea who is being "chartered" to work on this (perhaps @scottmcm is volunteering to serve as the liaison).

Leaving unresolved for now.

@joshtriplett
Copy link
Member

Discussed today: still seeking a project group to drive this forward.

@nikomatsakis nikomatsakis added disposition-merge The FCP starter wants to merge (accept) this final-comment-period The FCP has started, most (if not all) team members are in agreement labels Sep 14, 2020
@nikomatsakis
Copy link
Contributor

Update from 2020-09-14:

Last week we felt like this really needs to be delegated to the @rust-lang/libs team. This is something we're prepared to do work on if the libs team has a proposal for how to use it. Actual change of what should be in the new prelude is up to the libs team (as the proposal itself states).

We don't really feel like an RFC is required for this. It feels like the next step would be the implementation work from the compiler side and we would FCP the PR.

There we are entering final comment period about the intention that we would like to see this proposal implemented and we can FCP the PR.

@scottmcm
Copy link
Member Author

I'm fine with closing this for tracking from our side. Hopefully someone will implement it.

@nikomatsakis
Copy link
Contributor

Update from 2020-09-21:

Closing per the above comment. There has been some @rust-lang/libs discussion, which is good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge The FCP starter wants to merge (accept) this final-comment-period The FCP has started, most (if not all) team members are in agreement major-change Major change proposal T-lang to-announce Not yet announced MCP proposals
Projects
None yet
Development

No branches or pull requests

4 participants