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

Correct rust code block in *Dataflow Analysis* #2037

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ci/linkcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ if [ "$GITHUB_EVENT_NAME" = "schedule" ] ; then # running in scheduled job

echo "Doing full link check."
elif [ "$GITHUB_EVENT_NAME" = "pull_request" ] ; then # running in PR CI build
echo "*** WARNING: linkcheck temporarily disabled due to bugs ***"
exit 0

if [ -z "$BASE_SHA" ]; then
echo "error: unexpected state: BASE_SHA must be non-empty in CI"
exit 1
Expand All @@ -25,6 +28,9 @@ elif [ "$GITHUB_EVENT_NAME" = "pull_request" ] ; then # running in PR CI build

echo "Checking files changed since $BASE_SHA: $CHANGED_FILES"
else # running locally
echo "*** WARNING: linkcheck temporarily disabled due to bugs ***"
exit 0

COMMIT_RANGE=master...
CHANGED_FILES=$(git diff --name-only $COMMIT_RANGE | sed 's#^src/##' | tr '\n' ' ')
FLAGS="-f $CHANGED_FILES"
Expand Down
2 changes: 1 addition & 1 deletion src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@

- [Prologue](./part-5-intro.md)
- [MIR optimizations](./mir/optimizations.md)
- [Debugging](./mir/debugging.md)
- [Debugging MIR](./mir/debugging.md)
- [Constant evaluation](./const-eval.md)
- [Interpreter](./const-eval/interpret.md)
- [Monomorphization](./backend/monomorph.md)
Expand Down
10 changes: 6 additions & 4 deletions src/mir/dataflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,18 @@ value will be `true`, since our analysis is done as soon as we determine that
`transmute` has been called. Our join operator will just be the boolean OR (`||`)
operator. We use OR and not AND because of this case:

```
```rust
# unsafe fn example(some_cond: bool) {
let x = if some_cond {
std::mem::transmute<i32, u32>(0_i32); // transmute was called!
std::mem::transmute::<i32, u32>(0_i32) // transmute was called!
} else {
1_u32; // transmute was not called
1_u32 // transmute was not called
};

// Has transmute been called by this point? We conservatively approximate that
// as yes, and that is why we use the OR operator.
println!("x: {}", x);
# }
```

## Inspecting the Results of a Dataflow Analysis
Expand Down Expand Up @@ -219,7 +221,7 @@ the example below:

["gen-kill" problems]: https://en.wikipedia.org/wiki/Data-flow_analysis#Bit_vector_problems
[*Static Program Analysis*]: https://cs.au.dk/~amoeller/spa/
[Debugging MIR]: ./debugging.html
[Debugging MIR]: ./debugging.md
[`AnalysisDomain`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_dataflow/trait.AnalysisDomain.html
[`Analysis`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_dataflow/trait.Analysis.html
[`Engine`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_dataflow/struct.Engine.html
Expand Down