Skip to content

Immovable generators and unsafe block #47787

Closed
@rozaliev

Description

@rozaliev

Immovable generators require unsafe block, thus allowing every unsafe function inside generator to work. There is no way to say I want immovable generator, but its body should not be marked unsafe.

unsafe { 
    static || {
        yield;
        let a =  Box::from_raw(0 as *mut usize);
    }
};

It can probably be fixed by adding new ImmovableGenerator trait and making creation of immovable generators safe.

cc @Zoxc

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-coroutinesArea: CoroutinesC-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