Closed
Description
As part of the discussion in #5922, it became clear that there are a number of cases in which we must inform the compiler about special constraints that pertain to specific types. These constraints almost always arise because of unsafe code that does things the compiler can't know about. We don't have a central mechanism for propagating such constraints:
- Annotations like
#[no_freeze]
are used to inform the builtin-bounds. - Except for non-copyable, which has a special type.
- Variance currently has no mechanism, so unused lifetime parameters don't necessarily behave like people expect.
I think we should centralize on one mechanism. My current thought is to employ 0-sized types for this. So we would remove the #[no_freeze]
annotations and add types like Nonfreezable
, as well as CovariantLifetime<'a>
and so on. These would be lang items specially recognized by the compiler.
Nominating and adding to the agenda for next week.
Metadata
Metadata
Assignees
Labels
No labels