Typestate 5 - #343
Closed
catamorphism wants to merge 11 commits into
Closed
Conversation
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.
…ted with postcond for scrutinee)
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.
Contributor
|
Integrated. |
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
Added Ptrace option parameters
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
consider -> considered
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
carolynzech
pushed a commit
to carolynzech/rust
that referenced
this pull request
May 7, 2025
This is an automated PR to update Kani metrics. The metrics have been updated by running `./scripts/run-kani.sh --run metrics`. Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com>
U007D
pushed a commit
to U007D/rust-mos
that referenced
this pull request
Aug 21, 2026
343: Bump arrayvec from 0.4.9 to 0.4.10 r=matklad a=dependabot[bot] Bumps [arrayvec](https://github.com/bluss/arrayvec) from 0.4.9 to 0.4.10. <details> <summary>Commits</summary> - [`21661fa`](bluss/arrayvec@21661fa) 0.4.10 - [`06930d2`](bluss/arrayvec@06930d2) FIX: Remove unused Copy/Clone for MaybeUninit - [`85d9a06`](bluss/arrayvec@85d9a06) FIX: Use repr(C) MaybeUninit after discussion with RalfJung - See full diff in [compare view](bluss/arrayvec@0.4.9...0.4.10) </details> <br /> [](https://dependabot.com/compatibility-score.html?dependency-name=arrayvec&package-manager=cargo&previous-version=0.4.9&new-version=0.4.10) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- **Note:** This repo was added to Dependabot recently, so you'll receive a maximum of 5 PRs for your first few update runs. Once an update run creates fewer than 5 PRs we'll remove that limit. You can always request more updates by clicking `Bump now` in your [Dependabot dashboard](https://app.dependabot.com). <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Automerge options (never/patch/minor, and dev/runtime dependencies) - Pull request limits (per update run and/or open at any time) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired) Finally, you can contact us by mentioning @dependabot. </details> 344: Bump itertools from 0.7.11 to 0.8.0 r=matklad a=dependabot[bot] Bumps [itertools](https://github.com/bluss/rust-itertools) from 0.7.11 to 0.8.0. <details> <summary>Commits</summary> - [`cd0602a`](rust-itertools/itertools@cd0602a) 0.8.0 - [`5a8f2fd`](rust-itertools/itertools@5a8f2fd) MAINT: Require Rust 1.24 as minimum version - [`4986d92`](rust-itertools/itertools@4986d92) DOC: Minor edits to module docs - [`01f15a0`](rust-itertools/itertools@01f15a0) Merge [rust-lang#288](https://github-redirect.dependabot.com/bluss/rust-itertools/issues/288) - [`883d40a`](rust-itertools/itertools@883d40a) map_into method - [`3bf265d`](rust-itertools/itertools@3bf265d) Merge pull request [rust-lang#321](https://github-redirect.dependabot.com/bluss/rust-itertools/issues/321) from JohnHeitmann/master - [`e820996`](rust-itertools/itertools@e820996) Document the trait extension behavior of Itertools a bit more clearly - [`44c9654`](rust-itertools/itertools@44c9654) Merge pull request [rust-lang#318](https://github-redirect.dependabot.com/bluss/rust-itertools/issues/318) from bluss/std-deprecations - [`d2e254f`](rust-itertools/itertools@d2e254f) API: Fix the mystery deprecation message for Step - [`602f2f6`](rust-itertools/itertools@602f2f6) API: Deprecate .foreach() in favour of std's .for_each() - Additional commits viewable in [compare view](rust-itertools/itertools@0.7.11...0.8.0) </details> <br /> [](https://dependabot.com/compatibility-score.html?dependency-name=itertools&package-manager=cargo&previous-version=0.7.11&new-version=0.8.0) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- **Note:** This repo was added to Dependabot recently, so you'll receive a maximum of 5 PRs for your first few update runs. Once an update run creates fewer than 5 PRs we'll remove that limit. You can always request more updates by clicking `Bump now` in your [Dependabot dashboard](https://app.dependabot.com). <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Automerge options (never/patch/minor, and dev/runtime dependencies) - Pull request limits (per update run and/or open at any time) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired) Finally, you can contact us by mentioning @dependabot. </details> Co-authored-by: dependabot[bot] <support@dependabot.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.