You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to allow users to be generic over at least the following keywords:
mut
const
async
extern
unsafe
We already support a limited version for const (only a sugared version, not explictly being generic over it), because const fn foo<T: ~const Trait>(t: T) { t.method() } is usable outside a const context with types that don't impl const Trait, and inside const contexts the types must have an impl const Trait.
As a first step we want to actually change the implementation of this feature inside rustc to re-use the generics and substitution infrastructure.
As a next step we want to play with async to allow the same kind of async if async bounds as well as async trait declarations and impl async Trait for Type declarations for those bounds to be useful.
Most of this will initially happen with attributes instead of syntax changes, but we want to start exploring possible syntax (hopefully without the ~ placeholder modifier) for the sugar.
I've talked about sugar, but what we'll likely want in the farther future is to allow writing the desugared version directly in the surface language. Basically I envision something like the following (modulo syntax bikeshed, but mostly in the right places)
constfnfoo<T: ~constTrait>(t:T)// the above desugars tofor<effectK> const<K> fn foo<T:const<K> Trait>(t:T)
The details of how we think this should work are in a doc that'll be ready for consumption in time for this meeting.
This issue corresponds to a lang-team design meeting proposal. It corresponds
to a possible topic of discussion that may be scheduled for deeper discussion
during one of our design meetings.
The text was updated successfully, but these errors were encountered:
Summary
We want to allow users to be generic over at least the following keywords:
mut
const
async
extern
unsafe
We already support a limited version for
const
(only a sugared version, not explictly being generic over it), becauseconst fn foo<T: ~const Trait>(t: T) { t.method() }
is usable outside a const context with types that don'timpl const Trait
, and inside const contexts the types must have animpl const Trait
.As a first step we want to actually change the implementation of this feature inside rustc to re-use the generics and substitution infrastructure.
As a next step we want to play with
async
to allow the same kind ofasync if async
bounds as well asasync trait
declarations andimpl async Trait for Type
declarations for those bounds to be useful.Most of this will initially happen with attributes instead of syntax changes, but we want to start exploring possible syntax (hopefully without the
~
placeholder modifier) for the sugar.I've talked about sugar, but what we'll likely want in the farther future is to allow writing the desugared version directly in the surface language. Basically I envision something like the following (modulo syntax bikeshed, but mostly in the right places)
The details of how we think this should work are in a doc that'll be ready for consumption in time for this meeting.
Background reading
About this issue
This issue corresponds to a lang-team design meeting proposal. It corresponds
to a possible topic of discussion that may be scheduled for deeper discussion
during one of our design meetings.
The text was updated successfully, but these errors were encountered: