I think this is new, yes. I think the point is that you have to choose among a number of possible values. Marker traits are Boolean. And there is nothing in the type system which can tell “implement exactly one of these traits”. On the other hand the associated constant of enum type is telling exactly that.
Sure, that part makes sense. I guess since this doesn’t have any actual participation in the type system (unlike marker traits) I would have expected it to be a builtin attribute instead.
// Tell the borrow checker that multiple references can be made to the// same place at the same time:#[access_kind(Shared)]unsafeimpl<'a, T> BorrowPlace<&'a T> forRefHandle<'a, T> {
I didn’t know you could do that! Oh wait, you can’t yet, I guess — looks like that would require some features still in prototype stage (Generic Constant Arguments MVP)?
I think this is new, yes. I think the point is that you have to choose among a number of possible values. Marker traits are Boolean. And there is nothing in the type system which can tell “implement exactly one of these traits”. On the other hand the associated constant of enum type is telling exactly that.
score 1 · canonical
Sure, that part makes sense. I guess since this doesn’t have any actual participation in the type system (unlike marker traits) I would have expected it to be a builtin attribute instead.
// Tell the borrow checker that multiple references can be made to the // same place at the same time: #[access_kind(Shared)] unsafe impl<'a, T> BorrowPlace<&'a T> for RefHandle<'a, T> {score 1 · canonical
But you cannot predicate on attributes in bounds. Like
T: BorrowPlace<ACCESS = AccessKind::Shared>score 1 · canonical
I didn’t know you could do that! Oh wait, you can’t yet, I guess — looks like that would require some features still in prototype stage (Generic Constant Arguments MVP)?
score 1 · canonical