Skip to content

Custom closure (and trait) "kind" bounds #3569

Closed
@bblum

Description

@bblum

Needed to make send_mapproperly dual-mode.

The way I see it, ~fn()s should always already be Const. &fn() and @fn() could perhaps be non-const if they had &muts or @muts in their environment.

Can we check for this and support putting closures in arcs?

EDIT: Per @bstrie's request, here is a list of what how the kinds work. For each kind bound K, a closure or trait bounded like fn:K() or TraitName:K can capture any values as long as their types do not contain the following ("mq" means any mutability qualifier):

Copy        anything with a destructor, e.g. pipes, ARCs, fn:()/Trait: without Copy
'static     &'r mq T, where 'r != 'static, fn:()/Trait: without 'static
Const       &mut T, @mut T, &const T, RWARC, Cell, RcMut, fn:()/Trait: without Const
Owned       &mq T, @mq T, Rc, RcMut, fn:()/Trait: without Owned

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions