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

Typestate 5 #343

Closed
wants to merge 11 commits into from
Closed

Typestate 5 #343

wants to merge 11 commits into from

Conversation

catamorphism
Copy link
Contributor

git didn't love me much today -- I think everything ended up looking right in the end, but I had to do a lot of rebasing.

Lots of work on typestate_check, seems to get a lot of the way
through checking the standard library.

* Added for, for_each, assign_op, bind, cast, put, check, break,
and cont. (I'm not sure break and cont are actually handled correctly.)

* Fixed side-effect bug in seq_preconds so that unioning the
preconditions of a sequence of statements or expressions
is handled correctly.

* Pass poststate correctly through a stmt_decl.

* Handle expr_ret and expr_fail properly (after execution of a ret
or fail, everything is true -- this is needed to handle ifs and alts
where one branch is a ret or fail)

* Fixed bug in set_prestate_ann where a thing that needed to be
mutated wasn't getting passed as an alias

* Fixed bug in how expr_alt was treated (zero is not the identity
for intersect, who knew, right?)

* Update logging to reflect log_err vs. log

* Fixed find_locals so as to return all local decls and exclude
function arguments.

* Make union_postconds work on an empty vector (needed to handle
empty blocks correctly)

* Added _vec.cat_options, which takes a list of option[T] to a list
of T, ignoring any Nones

* Added two test cases.
Added support for self_method, cont, chan, port, recv, send, be,
do_while, spawn, and ext; handled break and cont correctly.
(However, there are no non-xfailed test cases for ext or spawn in
stage0 currently.)

Although the standard library compiles and all test cases pass with
typestate enabled, I left typestate checking disabled as rustc
terminates abnormally when building the standard library if so,
even though it does generate code correctly.
(needed for typestate_check).

Also changed a (log; fail) to (log_err; fail) in typestate_check,
and added some more logging funs in util.common.
The code for taking pattern-bound variables was being interspersed
with pattern code, so that if a nested pattern failed partway through,
a variable would be taken but never dropped (because the drop code
is inside the block representing the action for the pattern). For
example, in the pattern foo(?i, bar(some[t](_)), _), if the scrutinee
was foo(x, bar(none[t]), y), the variable i would be taken but never
dropped. The patch fixes this bug.
I changed the error message to also suggest checking the -L flag
when this happens.
In rustc, nested patterns were potentially matching when they shouldn't
match, because a loop index wasn't being incremented. Fixed it and added
one test case.
I changed instantiate to print out a more helpful error message,
which required passing it a session argument. To avoid
threading extra arguments through a lot of functions,
I added a session field to ty_ctxt.
Enable typestate checking (just for uninitialized vars) and un-XFAIL the
relevant tests for stage0.
This was supposed to be in a previous commit. I don't know what happened.
@graydon
Copy link
Contributor

graydon commented Apr 28, 2011

Integrated.

@graydon graydon closed this Apr 28, 2011
oli-obk pushed a commit to oli-obk/rust that referenced this pull request Sep 19, 2017
use ui test mode rather than mir-opt
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this pull request Dec 12, 2017
kazcw pushed a commit to kazcw/rust that referenced this pull request Oct 23, 2018
dlrobertson pushed a commit to dlrobertson/rust that referenced this pull request Nov 29, 2018
ZuseZ4 pushed a commit to EnzymeAD/rust that referenced this pull request Mar 7, 2023
* fix malloc placeholder
antoyo added a commit to antoyo/rust that referenced this pull request Oct 9, 2023
Add guide to add new attributes support in libgccjit
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

Successfully merging this pull request may close these issues.

2 participants