

Github A new prelude for the 2021 edition (trait-only edition) by djc · Pull Req...
source link: https://github.com/rust-lang/rfcs/pull/3114
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Conversation
There's a few comments and small details that need to be addressed before we can merge this. But I'm starting the libs FCP process now to not delay this any further. We already discussed these additions in a meeting earlier this year, but we still need formal approval for these prelude additions.
Specifically, this RFC proposes to make the prelude dependent on the edition, and to add to add three traits to the Rust 2021 prelude:
TryInto
TryFrom
FromIterator
@rfcbot merge
Team member @m-ou-se has proposed to merge this. The next step is review by the rest of the tagged team members:
No concerns currently listed.
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!
See this document for info about what commands tagged team members can give me.
Nit Pick: The inherent impl not
method on bool
was already rejected from being added to core
on the grounds that people would get an unused import warning, and so we'll have to wait for some inherent traits proposal to be accepted and stabilized (which could take far longer than the 2021 edition)
Oh, that's good to know. Do you have a reference for that?
So, yeah, we should just put Not in the darn prelude in 2021 and get all this nonsense over with.
Copy link
CryZe commented 7 days ago
Putting just Not in and not the various other unary operators or even all operators would be pretty inconsistent. Since it's also potentially a pretty strong idiomatic shift even (with many people adopting it and many not), it seems too controversial to just slip into an RFC of common not so controversial imports, especially if this would only be a workaround to the path ahead of adding inherent trait impls.
pretty strong idiomatic shift
this feels like an overstatement of the situation. It's a single method.
@nikomatsakis Can you sign off on the migration plan?
@BurntSushi @dtolnay @sfackler If any of you have time to review this; would be nice to start the FCP soon. (Sorry for the rush, but it'd be nice if we can finish the list of 2021 edition changes before publishing the blog post. This is the last one that still needs fcp. :) )
Copy link
rfcbot commented 4 days ago
This is now entering its final comment period, as per the review above.
LGTM. Thanks for putting this together!
With respect to Not
, I agree with @CryZe's perspective here.
With respect to naming, I personally would prefer rust2021
instead of rust_2021
. I find the former far more aesthetically pleasing, to the point that it outweighs any rigorous consistency argument with naming elsewhere. With that said, I don't believe that these are names that folks will be uttering or even reading frequently, so this is a pretty minor point.
I approve the migration lint description =)
With respect to naming, I personally would prefer
rust2021
instead ofrust_2021
. I find the former far more aesthetically pleasing, to the point that it outweighs any rigorous consistency argument with naming elsewhere. With that said, I don't believe that these are names that folks will be uttering or even reading frequently, so this is a pretty minor point.
Some data: There are zero matches for rust20\d\d
in compiler/
, but 53 matches for rust_20\d\d
. We already have user-facing names like #![warn(rust_2018_idioms)]
with underscores. Internally in rustc it's written like that too for functions like span.rust_2018()
.
@m-ou-se Ah okay. That's enough to change my preference then. Thanks for that data!
No one assigned
None yet
No milestone
Successfully merging this pull request may close these issues.
None yet
Recommend
-
38
At my work , I had an opportunity to start an experiment: Writing a single parser implementation in Rust for the new Gutenberg post f...
-
26
README.md Bach's prelude in C major from WTC book I, written in sed To listen to it on Linux, run: $ echo | ./bach.sed | aplay -r44100
-
8
Conversation Copy link Contributor
-
8
Copy link Collaborator rust-timer commented...
-
5
New issue Fix ICE when lowering trait A where for<'a> Self: 'a #91308
-
14
New issue Add a try_reduce method to the Iterator trait #87054
-
6
New issue Don't lint ptr_arg for &mut _ types in trait items #8369
-
4
Conversation This PR introduces an Equivalent trait, as requested in
-
12
Conversation Not sure why I had made the IsSuggestableVisitor have that rule to not con...
-
9
Conversation Contributor This P...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK