Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Immovable generators and unsafe block #47787

Closed
rozaliev opened this issue Jan 26, 2018 · 0 comments
Closed

Immovable generators and unsafe block #47787

rozaliev opened this issue Jan 26, 2018 · 0 comments
Labels
A-coroutines Area: Coroutines C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@rozaliev
Copy link

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

@pietroalbini pietroalbini added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-coroutines Area: Coroutines labels Jan 26, 2018
Zoxc added a commit to Zoxc/rust that referenced this issue Mar 20, 2018
alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 23, 2018
Make resuming generators unsafe instead of the creation of immovable generators

cc @withoutboats

Fixes rust-lang#47787
kennytm added a commit to kennytm/rust that referenced this issue Mar 24, 2018
Make resuming generators unsafe instead of the creation of immovable generators

Fixes rust-lang#47787
kennytm added a commit to kennytm/rust that referenced this issue Mar 24, 2018
Make resuming generators unsafe instead of the creation of immovable generators

cc @withoutboats

Fixes rust-lang#47787
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-coroutines Area: Coroutines C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

2 participants