Skip to content

Support Rust's Generator feature #416

Closed

Description

@avanhatt

Rust has a newish Generator type.

We currently fail with unimplemented for this type:

            ty::Generator(_, _, _) => unimplemented!(),

This is used by the popular tokio crate.

Activity

  1. added
    [C] Bug
    [C] Feature / Enhancement
    on Aug 11, 2021
  2. zhassan-aws commented on Mar 16, 2022

    @zhassan-aws
    Contributor

    Kani crashes on the following program:

    #![feature(generators, generator_trait)]
    
    use std::ops::{Generator, GeneratorState};
    use std::pin::Pin;
    
    fn main() {
        let mut generator = || {
            yield 1;
            return "foo"
        };
    
        match Pin::new(&mut generator).resume(()) {
            GeneratorState::Yielded(1) => {}
            _ => panic!("unexpected return from resume"),
        }
        match Pin::new(&mut generator).resume(()) {
            GeneratorState::Complete("foo") => {}
            _ => panic!("unexpected return from resume"),
        }
    }

    We should emit an error and exit gracefully until we support this feature.

  3. zhassan-aws commented on Mar 18, 2022

    @zhassan-aws
    Contributor

    Emit an error instead of crash, then remove the "must have" label, and switch "bug" to "feature".

  4. self-assigned this
    on Apr 19, 2022
  5. moved this to In Progress in Kani v0.7on Jul 19, 2022
  6. Repository owner moved this from In Progress to Done in Kani v0.7on Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[C] Bug[C] Feature / Enhancement

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions