Skip to content

Classes: handle typestate correctly in ctors #2293

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

Closed
catamorphism opened this issue Apr 25, 2012 · 2 comments
Closed

Classes: handle typestate correctly in ctors #2293

catamorphism opened this issue Apr 25, 2012 · 2 comments
Milestone

Comments

@catamorphism
Copy link
Contributor

Enforce these invariants in typestate:

"The constructor must initialize all fields of the object and cannot call any methods on self until it has done so." (currently there's no check that the ctor initializes fields, even)

"After calling a method on self, the constructor is not allowed to mutate any of its immutable fields."

@ghost ghost assigned catamorphism Apr 25, 2012
@catamorphism
Copy link
Contributor Author

Blocked on #2376 -- if that RFC gets accepted, we'll be able to eliminate ctors and there'll be no need for special cases in typestate.

@nikomatsakis
Copy link
Contributor

this is implemented in the new liveness code. if I'd realized it wasn't implemented at all in typestate I probably wouldn't have bothered, but oh well. =)

@catamorphism catamorphism removed their assignment Jun 16, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 22, 2022
make -Zmiri-env-forward take precedence over -Zmiri-env-exclude

Lets people experiment with the `TERM` env var.
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Use the overflow result operations instead of doing the math twice.

This is related to the performance degradation we are seeing in the toolchain upgrade: rust-lang#2293

Co-authored-by: Michael Tautschnig <[email protected]>
jieyouxu pushed a commit to jieyouxu/rust that referenced this issue Mar 18, 2025
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

2 participants