From 2e3a3562b4be6459c41d4aa10cbc2939fa8e642e Mon Sep 17 00:00:00 2001 From: Mohammad Omidvar Date: Tue, 13 Dec 2022 14:50:12 -0800 Subject: [PATCH 1/4] Replace NoLandingPad with another alive MIR pass The broken reference to `NoLandingPad` is replaced by `RemoveStorageMarkers` to fix this document. --- src/mir/passes.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/mir/passes.md b/src/mir/passes.md index 5528b7762..e4a4a3e44 100644 --- a/src/mir/passes.md +++ b/src/mir/passes.md @@ -33,9 +33,8 @@ basically consists of one method, `run_pass`, that simply gets an came from). The MIR is therefore modified in place (which helps to keep things efficient). -A good example of a basic MIR pass is [`NoLandingPads`], which walks -the MIR and removes all edges that are due to unwinding – this is -used when configured with `panic=abort`, which never unwinds. As you +A basic example of a MIR pass is [`RemoveStorageMarkers`], which walks +the MIR and removes all storage marks if they won't be emitted during codegen. As you can see from its source, a MIR pass is defined by first defining a dummy type, a struct with no fields, something like: @@ -98,5 +97,5 @@ alternatives in [rust-lang/rust#41710]. [rust-lang/rust#41710]: https://github.com/rust-lang/rust/issues/41710 [mirtransform]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/ -[`NoLandingPads`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/no_landing_pads/struct.NoLandingPads.html +[`RemoveStorageMarkers`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/remove_storage_markers/struct.RemoveStorageMarkers.html [MIR visitor]: ./visitor.html From bbd707ec851d7ef071efa4c5c647e04e79f0389e Mon Sep 17 00:00:00 2001 From: Mohammad Omidvar Date: Tue, 13 Dec 2022 14:53:56 -0800 Subject: [PATCH 2/4] Remove todo note --- src/mir/passes.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mir/passes.md b/src/mir/passes.md index e4a4a3e44..4c7feb04e 100644 --- a/src/mir/passes.md +++ b/src/mir/passes.md @@ -96,6 +96,5 @@ alternatives in [rust-lang/rust#41710]. [rust-lang/rust#41710]: https://github.com/rust-lang/rust/issues/41710 [mirtransform]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/ - [`RemoveStorageMarkers`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/remove_storage_markers/struct.RemoveStorageMarkers.html [MIR visitor]: ./visitor.html From 3060d8642bd337af4c9042a2eb813f0835841dfe Mon Sep 17 00:00:00 2001 From: Mohammad Omidvar Date: Tue, 13 Dec 2022 15:05:39 -0800 Subject: [PATCH 3/4] Replace NoLandingPad with another alive Visitor The broken reference to the non-existing `NoLandingPad` is replaced by `LocalUseCounter` to fix this document. --- src/mir/visitor.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/mir/visitor.md b/src/mir/visitor.md index 5c21d5304..1c3ef13be 100644 --- a/src/mir/visitor.md +++ b/src/mir/visitor.md @@ -37,12 +37,10 @@ code that will execute whenever a `foo` is found. If you want to recursively walk the contents of the `foo`, you then invoke the `super_foo` method. (NB. You never want to override `super_foo`.) -A very simple example of a visitor can be found in [`NoLandingPads`]. -That visitor doesn't even require any state: it just visits all -terminators and removes their `unwind` successors. +A very simple example of a visitor can be found in [`LocalUseCounter`]. +By implementing `visit_local` method, this visitor counts how many tims each local is used. - -[`NoLandingPads`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/no_landing_pads/struct.NoLandingPads.html +[`LocalUseCounter`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/simplify_try/struct.LocalUseCounter.html ## Traversal From af43547864f6f75ddbe0821bc2bbebf9ba30cd13 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 14 Dec 2022 03:17:38 +0200 Subject: [PATCH 4/4] typo --- src/mir/visitor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mir/visitor.md b/src/mir/visitor.md index 1c3ef13be..505b700b3 100644 --- a/src/mir/visitor.md +++ b/src/mir/visitor.md @@ -38,7 +38,7 @@ recursively walk the contents of the `foo`, you then invoke the `super_foo` method. (NB. You never want to override `super_foo`.) A very simple example of a visitor can be found in [`LocalUseCounter`]. -By implementing `visit_local` method, this visitor counts how many tims each local is used. +By implementing `visit_local` method, this visitor counts how many times each local is used. [`LocalUseCounter`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/simplify_try/struct.LocalUseCounter.html