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

Comments

Projects
None yet
2 participants
@rozaliev

rozaliev commented Jan 26, 2018

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

Zoxc added a commit to Zoxc/rust that referenced this issue Mar 20, 2018

Zoxc added a commit to Zoxc/rust that referenced this issue Mar 20, 2018

Zoxc added a commit to Zoxc/rust that referenced this issue Mar 20, 2018

Zoxc added a commit to Zoxc/rust that referenced this issue Mar 20, 2018

Zoxc added a commit to Zoxc/rust that referenced this issue Mar 20, 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

Rollup merge of rust-lang#49194 - Zoxc:unsafe-generator, r=cramertj
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

Rollup merge of rust-lang#49194 - Zoxc:unsafe-generator, r=cramertj
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

Rollup merge of rust-lang#49194 - Zoxc:unsafe-generator, r=cramertj
Make resuming generators unsafe instead of the creation of immovable generators

cc @withoutboats

Fixes rust-lang#47787

@bors bors closed this in #49194 Mar 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment