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

Labeling a function in a trait pub gives misleading "Non-productive state" diagnostic #34

Open
Dessix opened this issue Jul 8, 2022 · 0 comments

Comments

@Dessix
Copy link

Dessix commented Jul 8, 2022

I just tripped myself up on this one for a little while by porting an impl block to trait signatures.

The error message is misleading for syntax that would otherwise be flat-out invalid.

#[typestate]
mod traffic_light {
    #[automaton]
    pub struct TrafficLight;

    #[state]
    pub struct Green; // Errors with "Non-productive state. For a state to be productive..."
    #[state]
    pub struct Red;

    pub trait Green {
        fn turn_on() -> Green;
        pub fn to_red(self) -> Red;
    }
    pub trait Red {
        fn turn_off(self);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant