New reserved keywords in 2021 edition

I am wondering, whether there already any information on which new keywords are reserved in the 2021 edition. For example is the auto keyword currently for the auto_traits on the list?

There’s an (unfinished / WIP) blog post on 2021 edition in this PR

I don’t see any new keywords in there. There’s some generically reserved tokens / syntax, allowing for easier introduction of new keywords in the future: A new keyword foo could then already be used as e.g. k#foo in the meantime before the next edition (e.g. 2024) comes along and introduces it properly.

2 Likes

auto there can be just a contextual keyword, as it's part of an item, not an expression.

This is similar to how union Foo { ... } works even though union is not a keyword.

6 Likes

The RFC for auto traits is accepted, but AFAIK there are currently no plans to stabilize them.

It's quite likely that they will never be stabilized, since they're not very useful without negative trait impls, and negative trait impls are also unlikely to get stabilized because of how they interact with API stability.

So that's another reason why auto won't be reserved, in addition to the reason @scottmcm already gave :slight_smile:

1 Like

A great thanks to all of you for this great explanation.

Isn't that an indication that the RFC shouldn't have been accepted at all?

The RFC (0019-opt-in-builtin-traits - The Rust RFC Book) was accepted in 2014. It states

Many of the mechanisms described in this RFC are not needed immediately. Therefore, we would like to implement a minimal "forwards compatible" set of changes now and then leave the remaining work for after the 1.0 release.

The RFC didn't just describe exposing auto traits directly to the user, but also unsafe trait and our current Send/Sync system. In addition at the time it wasn't clear yet what problems negative trait implementations would cause. The reason unstable features exist at all is because problems with features are often unknown until much later.

5 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.