From e197b2ea8c6e16689138cacdaa0a87dc4cbc933f Mon Sep 17 00:00:00 2001 From: xFrednet Date: Mon, 5 Aug 2024 13:52:39 +0200 Subject: [PATCH 1/3] Correct rust code block in *Dataflow Analysis* --- src/mir/dataflow.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/mir/dataflow.md b/src/mir/dataflow.md index 15bfd6aed..e6e4b9b1a 100644 --- a/src/mir/dataflow.md +++ b/src/mir/dataflow.md @@ -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: -``` -let x = if some_cond { - std::mem::transmute(0_i32); // transmute was called! -} else { - 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); +```rust +# unsafe fn example(some_cond: bool) { + let x = if some_cond { + std::mem::transmute::(0_i32) // transmute was called! + } else { + 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 From be890df1777226a35a9d79a457e75ecc47579aa4 Mon Sep 17 00:00:00 2001 From: xFrednet Date: Tue, 6 Aug 2024 11:20:31 +0200 Subject: [PATCH 2/3] Review comments <3 --- src/SUMMARY.md | 2 +- src/mir/dataflow.md | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 6b70038a3..7950e4687 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -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) diff --git a/src/mir/dataflow.md b/src/mir/dataflow.md index e6e4b9b1a..7bd0f0aab 100644 --- a/src/mir/dataflow.md +++ b/src/mir/dataflow.md @@ -129,15 +129,15 @@ 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::(0_i32) // transmute was called! - } else { - 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); +let x = if some_cond { + std::mem::transmute::(0_i32) // transmute was called! +} else { + 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); # } ``` @@ -221,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 From 2c3b120478536f0f69d3d191d1990a1e1ffdd109 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Tue, 6 Aug 2024 13:17:04 -0700 Subject: [PATCH 3/3] Disable linkcheck in PRs until bugs are fixed See https://github.com/Michael-F-Bryan/mdbook-linkcheck/issues/77 and https://github.com/Michael-F-Bryan/mdbook-linkcheck/issues/86. These bugs are causing linkcheck to erroneously fail because we run it using `-f`, to avoid too many requests. For now, disable linkcheck in PR CI, though leave it enabled in the cron job, where the bug should not occur. --- ci/linkcheck.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ci/linkcheck.sh b/ci/linkcheck.sh index 14cd53ac9..5f523f874 100755 --- a/ci/linkcheck.sh +++ b/ci/linkcheck.sh @@ -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 @@ -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"